aboutsummaryrefslogtreecommitdiffstats
path: root/cputemp2maxfreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'cputemp2maxfreq.c')
-rw-r--r--cputemp2maxfreq.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c
index 826655a..556e404 100644
--- a/cputemp2maxfreq.c
+++ b/cputemp2maxfreq.c
@@ -25,6 +25,9 @@ struct s_config config={
"stdout", // Logger name
&logger_stdout, // Logger function
0, // Don't log measurement data
+ "", // CSV logfile
+ 0, // Don't overwrite CSV logfile
+ NULL, // File handler for CSV file
};
struct s_cpudata cpudata;
@@ -52,6 +55,13 @@ int main(int argc,char **argv)
config.logger("Interval: %d",config.interval);
config.logger("Logger: %s (%p)",config.logger_name,config.logger);
config.logger("Log measurement data: %d",config.log_data);
+ if (config.csvlog[0]==0)
+ {
+ config.logger("CSV Log file: Disabled");
+ } else {
+ config.logger("CSV Log file: %s",config.csvlog);
+ config.logger("Overwrite CSV log: %d",config.csvoverwrite);
+ }
if ((config.max_temp<VALID_TEMP_MIN) || (config.max_temp>VALID_TEMP_MAX))
{
@@ -114,6 +124,9 @@ int main(int argc,char **argv)
}
}
+// Initialise CSV logging
+ if (config.csvlog[0]!=0) csvlog_init();
+
// Set signal handlers
signal(SIGTERM,signal_handler);
signal(SIGINT,signal_handler);
@@ -141,6 +154,7 @@ int main(int argc,char **argv)
{
config.logger("CPU Temperature: %ld, CPU Frequency: %ld",cpudata.cur_temp/1000,cpudata.cur_freq);
}
+ if (config.csvfile!=NULL) csvlog_write();
// Check if we should increase
if ((cpudata.cur_temp<config.max_temp) && (cpudata.scale_max<cpudata.max_freq))