aboutsummaryrefslogtreecommitdiffstats
path: root/cputemp2maxfreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'cputemp2maxfreq.c')
-rw-r--r--cputemp2maxfreq.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c
index 434fb70..d146158 100644
--- a/cputemp2maxfreq.c
+++ b/cputemp2maxfreq.c
@@ -92,7 +92,6 @@ int main(int argc,char **argv)
struct s_sensor sensor;
char *transition_latency_remark;
char sensor_string[20];
- char sysfs_file[128];
argparse(argc,argv);
config.logger("%s version %s, buildtime %s %s",config.name,version(),__DATE__,__TIME__);
@@ -205,17 +204,13 @@ int main(int argc,char **argv)
}
// Get and validate CPU data
- sprintf(sysfs_file,"/sys/devices/system/cpu/%s/cpufreq/cpuinfo_min_freq",cpudata.cpulist[0]);
- cpudata.min_freq=sysfs_read_long_int(sysfs_file);
- sprintf(sysfs_file,"/sys/devices/system/cpu/%s/cpufreq/cpuinfo_max_freq",cpudata.cpulist[0]);
- cpudata.max_freq=sysfs_read_long_int(sysfs_file);
- sprintf(sysfs_file,"/sys/devices/system/cpu/%s/cpufreq/scaling_max_freq",cpudata.cpulist[0]);
- cpudata.scale_max=sysfs_read_long_int(sysfs_file);
+ cpudata.min_freq=cpufreq_get_long_int("cpuinfo_min_freq");
+ cpudata.max_freq=cpufreq_get_long_int("cpuinfo_max_freq");
+ cpudata.scale_max=cpufreq_get_long_int("scaling_max_freq");
if (config.transition_latency<0)
{
transition_latency_remark=transition_latency_remarks[0];
- sprintf(sysfs_file,"/sys/devices/system/cpu/%s/cpufreq/cpuinfo_transition_latency",cpudata.cpulist[0]);
- cpudata.transition_latency=sysfs_read_long_int(sysfs_file);
+ cpudata.transition_latency=cpufreq_get_long_int("cpuinfo_transition_latency");
if (cpudata.transition_latency<1000) transition_latency_remark=transition_latency_remarks[2];
} else {
transition_latency_remark=transition_latency_remarks[1];
@@ -275,7 +270,7 @@ int main(int argc,char **argv)
while(1)
{
// Get new measurements
- cpudata.cur_freq=sysfs_read_long_int("/sys/devices/system/cpu/cpufreq/policy0/scaling_cur_freq");
+ cpudata.cur_freq=cpufreq_get_long_int("scaling_cur_freq");
if ((cpudata.cur_freq<VALID_FREQ_MIN) || (cpudata.cur_freq>VALID_FREQ_MAX))
{
config.logger("Invalid current frequency reported by CPU, exiting");