cpufreq: Review p-state transitions metric
authorPavel Rochnyack <pavel2000@ngs.ru>
Sat, 20 Oct 2018 12:11:47 +0000 (19:11 +0700)
committerPavel Rochnyack <pavel2000@ngs.ru>
Mon, 22 Oct 2018 01:46:01 +0000 (08:46 +0700)
src/cpufreq.c
src/types.db

index 18e79d4..679d81e 100644 (file)
@@ -31,7 +31,6 @@ static int num_cpu;
 
 struct thread_data {
   value_to_rate_state_t time_state[MAX_AVAIL_FREQS];
-  long long transition_prev;
 } * t_data;
 
 /* Flags denoting capability of reporting stats. */
@@ -62,17 +61,6 @@ static int counter_init(void) {
                       num_cpu);
     if ((status < 1) || ((unsigned int)status >= sizeof(filename)))
       report_total_trans = 0;
-
-    /* Initialize total transitions for cpu frequency */
-    if (report_total_trans) {
-      value_t v;
-      snprintf(filename, sizeof(filename),
-               "/sys/devices/system/cpu/cpu%d/cpufreq/stats/total_trans", i);
-      if (parse_value_file(filename, &v, DS_TYPE_COUNTER) != 0) {
-        WARNING("cpufreq plugin: Reading \"%s\" failed.", filename);
-        continue;
-      }
-      t_data[i].transition_prev = v.counter;
     }
   }
   return 0;
@@ -152,9 +140,7 @@ static int cpufreq_read(void) {
         WARNING("cpufreq plugin: Reading \"%s\" failed.", filename);
         continue;
       }
-      counter_t c = counter_diff(t_data[i].transition_prev, v.counter);
-      t_data[i].transition_prev = v.counter;
-      cpufreq_submit(i, "transitions", NULL, &(value_t){.counter = c});
+      cpufreq_submit(i, "counter", "transitions", &v);
     }
 
     /*
index e9de64f..0370b7f 100644 (file)
@@ -260,7 +260,6 @@ total_threads           value:DERIVE:0:U
 total_time_in_ms        value:DERIVE:0:U
 total_values            value:DERIVE:0:U
 turbo_enabled           value:GAUGE:0:1
-transitions             value:DERIVE:0:U
 uptime                  value:GAUGE:0:4294967295
 uncore_ratio            value:GAUGE:0:U
 users                   value:GAUGE:0:65535