[IMPROVE] energy: add support cpu_idle in debugfs
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 20 Sep 2013 09:31:23 +0000 (13:31 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 20 Sep 2013 09:31:23 +0000 (13:31 +0400)
Change-Id: I2bda13fedd594d99dfdb0a72e9b58ca7a44a1ff3
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
energy/debugfs_energy.c

index 1ff1b3d..1a1e33e 100644 (file)
@@ -29,7 +29,7 @@
 #include <driver/swap_debugfs.h>
 
 
-/* CPU */
+/* CPU running */
 static u64 cpu_numerator = 1;
 static u64 cpu_denominator = 1;
 
@@ -46,6 +46,17 @@ static u64 cpu_apps(void)
 }
 
 
+/* CPU idle */
+static u64 cpu_idle_numerator = 1;
+static u64 cpu_idle_denominator = 1;
+
+static u64 cpu_idle_system(void)
+{
+       /* TODO: implement */
+       return 0;
+}
+
+
 /* flash read */
 static u64 fr_numerator = 1;
 static u64 fr_denominator = 1;
@@ -148,10 +159,12 @@ static struct dentry *create_parameter(struct dentry *parent,
        if (system == NULL)
                goto rm_denominator;
 
-       apps = debugfs_create_file("apps", 0600, name, param->apps,
-                                  &fops_get_u64);
-       if (apps == NULL)
-               goto rm_system;
+       if (param->apps) {
+               apps = debugfs_create_file("apps", 0600, name, param->apps,
+                                          &fops_get_u64);
+               if (apps == NULL)
+                       goto rm_system;
+       }
 
        return name;
 
@@ -169,13 +182,20 @@ rm_name:
 
 struct param_data parameters[] = {
        {
-               .name = "CPU",
+               .name = "cpu_running",
                .numerator = &cpu_numerator,
                .denominator = &cpu_denominator,
                .system = cpu_system,
                .apps = cpu_apps
        },
        {
+               .name = "cpu_idle",
+               .numerator = &cpu_idle_numerator,
+               .denominator = &cpu_idle_denominator,
+               .system = cpu_idle_system,
+               .apps = NULL
+       },
+       {
                .name = "flash_read",
                .numerator = &fr_numerator,
                .denominator = &fr_denominator,