| 108 | } |
| 109 | |
| 110 | void SystemStateInfo::ReadCurrentProcStat() { |
| 111 | string path = "/proc/stat"; |
| 112 | faststring buf; |
| 113 | if (!ReadFileOrWarn(path, &buf)) return; |
| 114 | StringPiece buf_sp(reinterpret_cast<const char*>(buf.data()), buf.size()); |
| 115 | vector<StringPiece> lines = strings::Split(buf_sp, "\n"); |
| 116 | DCHECK_GT(lines.size(), 0); |
| 117 | ReadProcStatString(lines[0].ToString()); |
| 118 | } |
| 119 | |
| 120 | void SystemStateInfo::ReadProcStatString(const string& stat_string) { |
| 121 | cpu_val_idx_ = 1 - cpu_val_idx_; |