Tizen 2.4.0 rev3 SDK Public Release accepted/tizen_2.3.1_mobile accepted/tizen_2.3.1_wearable tizen_2.3.1 accepted/tizen/2.3.1/mobile/20160306.221613 accepted/tizen/2.3.1/wearable/20160306.221617 submit/tizen_2.3.1/20160304.093512
authorjk7744.park <jk7744.park@samsung.com>
Fri, 4 Mar 2016 04:19:53 +0000 (13:19 +0900)
committerjk7744.park <jk7744.park@samsung.com>
Fri, 4 Mar 2016 04:19:53 +0000 (13:19 +0900)
daemon/da_protocol.h
daemon/start.sh
daemon/sys_stat.c
packaging/swap-manager.spec

index 24aeefd..496287a 100644 (file)
@@ -159,12 +159,16 @@ enum app_type {
 enum supported_device {
        DEVICE_FLASH,
        DEVICE_CPU,
-       DEVICE_LCD
+       DEVICE_LCD,
+       DEVICE_WIFI,
+       DEVICE_BT
 };
 static const char *supported_devices_strings[] = {
        "FLASH",
        "CPU",
-       "LCD"
+       "LCD",
+       "WIFI",
+       "BT"
 };
 #define array_size(x) (sizeof(x)/sizeof((x)[0]))
 enum { supported_devices_count = array_size(supported_devices_strings) };
index 0efd426..40d685d 100644 (file)
@@ -54,6 +54,22 @@ echo 33154239 > /sys/kernel/debug/swap/energy/flash_read/denominator &&
 echo 141540 > /sys/kernel/debug/swap/energy/flash_write/numerator &&
 echo 27920983 > /sys/kernel/debug/swap/energy/flash_write/denominator &&
 
+# recv through wifi : 1.01901550e-05
+/bin/echo 1019 > /sys/kernel/debug/swap/energy/wf_recv/numerator &&
+/bin/echo 100000000 > /sys/kernel/debug/swap/energy/wf_recv/denominator &&
+
+# send through wifi : 2.11865993e-05
+/bin/echo 2118 > /sys/kernel/debug/swap/energy/wf_send/numerator &&
+/bin/echo 100000000 > /sys/kernel/debug/swap/energy/wf_send/denominator &&
+
+# send through bluetooth : 2.53633107e-04
+/bin/echo 2536 > /sys/kernel/debug/swap/energy/hci_send_acl/numerator &&
+/bin/echo 10000000 > /sys/kernel/debug/swap/energy/hci_send_acl/denominator &&
+
+# recv through bluetooth : 4.08411717e-04
+/bin/echo 4084 > /sys/kernel/debug/swap/energy/l2cap_recv_acldata/numerator &&
+/bin/echo 10000000 > /sys/kernel/debug/swap/energy/l2cap_recv_acldata/denominator &&
+
 # LCD:
 if [ -d /sys/kernel/debug/swap/energy/lcd/ ]
 then
index e9fcbae..e031325 100644 (file)
@@ -1770,15 +1770,16 @@ static uint64_t get_system_lcd_energy()
        globfree(&glob_buf);
        return sum_energy;
 }
+
 /*
  * Calculates difference between current and previous sample (system).
  * 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, lcd_old;
-       uint64_t cpu_new, flash_new, lcd_new;
-       uint64_t cpu_diff, flash_diff, lcd_diff;
+       static uint64_t cpu_old, flash_old, lcd_old, wifi_old, bt_old;
+       uint64_t cpu_new, flash_new, lcd_new, wifi_new, bt_new;
+       uint64_t cpu_diff, flash_diff, lcd_diff, wifi_diff, bt_diff;
 
        switch (dev) {
        case DEVICE_CPU:
@@ -1799,6 +1800,22 @@ static uint32_t pop_sys_energy_per_device(enum supported_device dev)
                lcd_diff = val_diff(lcd_new, lcd_old);
                lcd_old = lcd_new;
                return (uint32_t)lcd_diff;
+       case DEVICE_WIFI:
+               wifi_new = swap_read_int64(wf_send/system) +
+                       swap_read_int64(wf_recv/system);
+               wifi_diff = val_diff(wifi_new, wifi_old);
+               wifi_old = wifi_new;
+               return (uint32_t)wifi_diff;
+       case DEVICE_BT:
+               bt_new = swap_read_int64(hci_send_sco/system) +
+                       swap_read_int64(hci_send_acl/system) +
+                       swap_read_int64(sco_recv_scodata/system) +
+                       swap_read_int64(l2cap_recv_acldata/system);
+               bt_diff = val_diff(bt_new, bt_old);
+               bt_old = bt_new;
+               return (uint32_t)bt_diff;
+
+
        default:
                assert(0 && "Unknown device. This should not happen");
                return -41;
@@ -1809,9 +1826,9 @@ static uint32_t pop_sys_energy_per_device(enum supported_device dev)
 // Stores mutable state in static variables.
 static uint32_t pop_app_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, wifi_old, bt_old;
+       uint64_t cpu_new, flash_new, wifi_new, bt_new;
+       uint64_t cpu_diff, flash_diff, wifi_diff, bt_diff;
 
        switch (dev) {
        case DEVICE_CPU:
@@ -1831,6 +1848,22 @@ static uint32_t pop_app_energy_per_device(enum supported_device dev)
                 * is not supported for LCD.
                 */
                return 0;
+       case DEVICE_WIFI:
+               wifi_new = swap_read_int64(wf_send/apps) +
+                       swap_read_int64(wf_recv/apps);
+               wifi_diff = val_diff(wifi_new, wifi_old);
+               wifi_old = wifi_new;
+               return (uint32_t)wifi_diff;
+       case DEVICE_BT:
+               bt_new = swap_read_int64(hci_send_sco/apps) +
+                       swap_read_int64(hci_send_acl/apps) +
+                       swap_read_int64(sco_recv_scodata/apps) +
+                       swap_read_int64(l2cap_recv_acldata/apps);
+               bt_diff = val_diff(bt_new, bt_old);
+               bt_old = bt_new;
+               return (uint32_t)bt_diff;
+
+
        default:
                assert(0 && "Unknown device. This should not happen");
                return -41;
index 9e7a6bf..14a5fb3 100644 (file)
@@ -40,12 +40,8 @@ mkdir -p %{buildroot}%{_libdir}/systemd/system
 
 %ifarch %{ix86}
 install -m 0644 swap.service %{buildroot}%{_libdir}/systemd/system/swap.service
-mkdir -p %{buildroot}/%{_libdir}/systemd/system/emulator.target.wants
-ln -s %{_libdir}/systemd/system/swap.service %{buildroot}/%{_libdir}/systemd/system/emulator.target.wants/
 %else
 install -m 0644 swap.service %{buildroot}%{_libdir}/systemd/system/swap.service
-mkdir -p %{buildroot}/%{_libdir}/systemd/system/multi-user.target.wants
-ln -s %{_libdir}/systemd/system/swap.service %{buildroot}/%{_libdir}/systemd/system/multi-user.target.wants/
 %endif
 
 cd daemon
@@ -54,13 +50,6 @@ cd daemon
 %files
 %{_libdir}/systemd/system/swap.service
 
-%ifarch %{ix86}
-%{_libdir}/systemd/system/emulator.target.wants/swap.service
-%else
-
-%{_libdir}/systemd/system/multi-user.target.wants/swap.service
-%endif
-
 /usr/share/license/%{name}
 %manifest swap-manager.manifest
 %defattr(-,root,root,-)