| 1673 | #endif |
| 1674 | |
| 1675 | void 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 |
no test coverage detected