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

Function updateProcessStats

fdbserver/storageserver.actor.cpp:1675–1689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1673#endif
1674
1675void updateProcessStats(StorageServer* self) {
1676 if (g_network->isSimulated()) {
1677 // diskUsage and cpuUsage are not relevant in the simulator,
1678 // and relying on the actual values could break seed determinism
1679 self->cpuUsage = 100.0;
1680 self->diskUsage = 100.0;
1681 return;
1682 }
1683
1684 SystemStatistics sysStats = getSystemStatistics();
1685 if (sysStats.initialized) {
1686 self->cpuUsage = 100 * sysStats.processCPUSeconds / sysStats.elapsed;
1687 self->diskUsage = 100 * std::max(0.0, (sysStats.elapsed - sysStats.processDiskIdleSeconds) / sysStats.elapsed);
1688 }
1689}
1690
1691///////////////////////////////////// Queries /////////////////////////////////
1692#ifndef __INTEL_COMPILER

Callers 2

whenFunction · 0.70

Calls 2

getSystemStatisticsFunction · 0.50
isSimulatedMethod · 0.45

Tested by

no test coverage detected