MCPcopy Create free account
hub / github.com/apple/foundationdb / getProcessorTimeProcess

Function getProcessorTimeProcess

flow/Platform.actor.cpp:264–279  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

262}
263
264double getProcessorTimeProcess() {
265 INJECT_FAULT(platform_error, "getProcessorTimeProcess"); // Get CPU Process Time failed
266#if defined(_WIN32)
267 FILETIME ftCreate, ftExit, ftKernel, ftUser;
268 if (!GetProcessTimes(GetCurrentProcess(), &ftCreate, &ftExit, &ftKernel, &ftUser)) {
269 TraceEvent(SevError, "GetProcessCPUTime").GetLastError();
270 throw platform_error();
271 }
272 return FiletimeAsInt64(ftKernel) / double(1e7) + FiletimeAsInt64(ftUser) / double(1e7);
273#elif defined(__unixish__)
274 return getProcessorTimeGeneric(RUSAGE_SELF);
275#else
276#warning getProcessorTimeProcess unimplemented on this platform
277 return 0.0;
278#endif
279}
280
281uint64_t getResidentMemoryUsage() {
282#if defined(__linux__)

Callers 2

getSystemStatisticsFunction · 0.85

Calls 3

TraceEventClass · 0.85
FiletimeAsInt64Function · 0.85
getProcessorTimeGenericFunction · 0.85

Tested by

no test coverage detected