[IMPROVE] Add support for LCD energy information
authorDmitry Bogatov <d.bogatov@samsung.com>
Mon, 18 Nov 2013 12:00:06 +0000 (16:00 +0400)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Mon, 18 Nov 2013 13:32:32 +0000 (13:32 +0000)
Change-Id: Id0dcae7978f0d392f91b947356af63dcba6d56b4
Signed-off-by: Dmitry Bogatov <d.bogatov@samsung.com>
daemon/da_protocol.h
daemon/sys_stat.c

index ca1c68b8af00ee02e0e0d2ca49208976a55901ed..fdd9a516edf5c5cc3ad556a66468f91e7685e084 100644 (file)
@@ -135,12 +135,14 @@ enum app_type {
        AT_COMMON       =0x03
 };
 enum supported_device {
-  DEVICE_FLASH,
-  DEVICE_CPU
+       DEVICE_FLASH,
+       DEVICE_CPU,
+       DEVICE_LCD
 };
 static const char *supported_devices_strings[] = {
        "FLASH",
-       "CPU"
+       "CPU",
+       "LCD"
 };
 #define array_size(x) (sizeof(x)/sizeof((x)[0]))
 enum { supported_devices_count = array_size(supported_devices_strings) };
index ccf9aea95a7b92e5116af4f242be43337118538e..ad2f90a3b1873208355733dfcd084343735db561 100644 (file)
@@ -2373,9 +2373,9 @@ static uint64_t read_int64_from_file(const char *fname)
 // Stores mutable state in static variables.
 static uint32_t pop_sys_energy_per_device(enum supported_device dev)
 {
-       static uint64_t cpu_old, flash_old;
-       uint64_t cpu_new, flash_new;
-       uint64_t cpu_diff, flash_diff;
+       static uint64_t cpu_old, flash_old, lcd_old;
+       uint64_t cpu_new, flash_new, lcd_new;
+       uint64_t cpu_diff, flash_diff, lcd_diff;
 
        switch (dev) {
        case DEVICE_CPU:
@@ -2391,6 +2391,11 @@ static uint32_t pop_sys_energy_per_device(enum supported_device dev)
                flash_diff = flash_new - flash_old;
                flash_old = flash_new;
                return (uint32_t)flash_diff;
+       case DEVICE_LCD:
+               lcd_new = swap_read_int64(lcd/maru/system);
+               lcd_diff = lcd_new - lcd_old;
+               lcd_old = lcd_new;
+               return (uint32_t)lcd_diff;
        default:
                assert(0 && "Unknown device. This should not happen");
                return -41;
@@ -2417,6 +2422,12 @@ static uint32_t pop_app_energy_per_device(enum supported_device dev)
                flash_diff = flash_new - flash_old;
                flash_old = flash_new;
                return (uint32_t)flash_diff;
+       case DEVICE_LCD:
+               /**
+                * Per-application energy accounting
+                * is not supported for LCD.
+                */
+               return 0;
        default:
                assert(0 && "Unknown device. This should not happen");
                return -41;