- status = snprintf(filename, sizeof(filename),
- "/sys/devices/system/cpu/cpu%d/cpufreq/"
- "stats/total_transitions",
- num_cpu);
- if ((status < 1) || ((unsigned int)status >= sizeof(filename)))
- report_total_trans = 0;
+ snprintf(filename, sizeof(filename),
+ "/sys/devices/system/cpu/cpu%d/cpufreq/stats/time_in_state", i);
+ if (access(filename, R_OK)) {
+ NOTICE("cpufreq plugin: File %s not exists or no access. P-State "
+ "statistics will not be reported. Check if `cpufreq-stats' kernel "
+ "module is loaded.",
+ filename);
+ report_p_stats = false;
+ break;
+ }
+
+ snprintf(filename, sizeof(filename),
+ "/sys/devices/system/cpu/cpu%d/cpufreq/stats/total_trans", i);
+ if (access(filename, R_OK)) {
+ NOTICE("cpufreq plugin: File %s not exists or no access. P-State "
+ "statistics will not be reported. Check if `cpufreq-stats' kernel "
+ "module is loaded.",
+ filename);
+ report_p_stats = false;
+ break;