cpupower: Add cpuidle parts into library
[cascardo/linux.git] / tools / power / cpupower / utils / idle_monitor / cpuidle_sysfs.c
index bcd22a1..1b5da00 100644 (file)
@@ -10,8 +10,8 @@
 #include <stdint.h>
 #include <string.h>
 #include <limits.h>
+#include <cpuidle.h>
 
-#include "helpers/sysfs.h"
 #include "helpers/helpers.h"
 #include "idle_monitor/cpupower-monitor.h"
 
@@ -51,7 +51,7 @@ static int cpuidle_start(void)
                for (state = 0; state < cpuidle_sysfs_monitor.hw_states_num;
                     state++) {
                        previous_count[cpu][state] =
-                               sysfs_get_idlestate_time(cpu, state);
+                               cpuidle_state_time(cpu, state);
                        dprint("CPU %d - State: %d - Val: %llu\n",
                               cpu, state, previous_count[cpu][state]);
                }
@@ -70,7 +70,7 @@ static int cpuidle_stop(void)
                for (state = 0; state < cpuidle_sysfs_monitor.hw_states_num;
                     state++) {
                        current_count[cpu][state] =
-                               sysfs_get_idlestate_time(cpu, state);
+                               cpuidle_state_time(cpu, state);
                        dprint("CPU %d - State: %d - Val: %llu\n",
                               cpu, state, previous_count[cpu][state]);
                }
@@ -132,13 +132,13 @@ static struct cpuidle_monitor *cpuidle_register(void)
        char *tmp;
 
        /* Assume idle state count is the same for all CPUs */
-       cpuidle_sysfs_monitor.hw_states_num = sysfs_get_idlestate_count(0);
+       cpuidle_sysfs_monitor.hw_states_num = cpuidle_state_count(0);
 
        if (cpuidle_sysfs_monitor.hw_states_num <= 0)
                return NULL;
 
        for (num = 0; num < cpuidle_sysfs_monitor.hw_states_num; num++) {
-               tmp = sysfs_get_idlestate_name(0, num);
+               tmp = cpuidle_state_name(0, num);
                if (tmp == NULL)
                        continue;
 
@@ -146,7 +146,7 @@ static struct cpuidle_monitor *cpuidle_register(void)
                strncpy(cpuidle_cstates[num].name, tmp, CSTATE_NAME_LEN - 1);
                free(tmp);
 
-               tmp = sysfs_get_idlestate_desc(0, num);
+               tmp = cpuidle_state_desc(0, num);
                if (tmp == NULL)
                        continue;
                strncpy(cpuidle_cstates[num].desc, tmp, CSTATE_DESC_LEN - 1);