|
|
|
@ -223,12 +223,16 @@ bool CPUStats::UpdateCPUData()
|
|
|
|
|
|
|
|
|
|
bool CPUStats::UpdateCoreMhz() {
|
|
|
|
|
m_coreMhz.clear();
|
|
|
|
|
FILE *fp;
|
|
|
|
|
char str[10];
|
|
|
|
|
for (size_t i = 0; i < m_cpuData.size(); i++)
|
|
|
|
|
{
|
|
|
|
|
std::string val;
|
|
|
|
|
std::ifstream file("/sys/devices/system/cpu/cpu" + std::to_string(i) + "/cpufreq/scaling_cur_freq");
|
|
|
|
|
std::getline(file, val);
|
|
|
|
|
m_cpuData[i].mhz = std::stoi(val) / 1000;
|
|
|
|
|
std::string path = "/sys/devices/system/cpu/cpu" + std::to_string(i) + "/cpufreq/scaling_cur_freq";
|
|
|
|
|
if (fp = fopen(path.c_str(), "r")){
|
|
|
|
|
fscanf(fp, "%s", str);
|
|
|
|
|
m_cpuData[i].mhz = atoi(str) / 1000;
|
|
|
|
|
fclose(fp);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_cpuDataTotal.cpu_mhz = 0;
|
|
|
|
|