| 90 | } |
| 91 | |
| 92 | void SystemStateInfo::CaptureSystemStateSnapshot() { |
| 93 | // Capture and compute CPU usage |
| 94 | ReadCurrentProcStat(); |
| 95 | ComputeCpuRatios(); |
| 96 | |
| 97 | int64_t now = MonotonicMillis(); |
| 98 | ReadCurrentProcNetDev(); |
| 99 | DCHECK_GT(last_net_update_ms_, 0L); |
| 100 | ComputeNetworkUsage(now - last_net_update_ms_); |
| 101 | last_net_update_ms_ = now; |
| 102 | |
| 103 | now = MonotonicMillis(); |
| 104 | ReadCurrentProcDiskStats(); |
| 105 | DCHECK_GT(last_disk_update_ms_, 0L); |
| 106 | ComputeDiskStats(now - last_disk_update_ms_); |
| 107 | last_disk_update_ms_ = now; |
| 108 | } |
| 109 | |
| 110 | void SystemStateInfo::ReadCurrentProcStat() { |
| 111 | string path = "/proc/stat"; |