[REFACTOR] Move start.sh/stop.sh from swap-modules 56/24756/1
authorVasiliy Ulyanov <v.ulyanov@samsung.com>
Mon, 21 Jul 2014 07:24:57 +0000 (11:24 +0400)
committerVasiliy Ulyanov <v.ulyanov@samsung.com>
Mon, 21 Jul 2014 07:24:57 +0000 (11:24 +0400)
swap-modules commit: beb4f68781174b046bd650311318369a9717ec8e

Change-Id: I9abff1126e84cd0bf126d6485bcd3667248f1e95
Signed-off-by: Vasiliy Ulyanov <v.ulyanov@samsung.com>
daemon/Makefile
daemon/start.sh [new file with mode: 0755]
daemon/stop.sh [new file with mode: 0755]
packaging/swap-manager.spec

index b3f80d1..665f208 100644 (file)
@@ -50,6 +50,8 @@ DAEMON_OBJS = $(patsubst %.c,%.o, $(DAEMON_SRCS))
 
 TARGET = da_manager
 DASCRIPT = da_command
+START_SH = start.sh
+STOP_SH = stop.sh
 
 all: debug
 debug release: $(TARGET_LIBS)
@@ -58,9 +60,12 @@ debug release: $(DAEMON_OBJS)
        $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $(TARGET)
 
 install: BINDIR = $(DESTDIR)/usr/bin
+install: OPTDIR = $(DESTDIR)/opt/swap/sdk
 install: $(TARGET)
        mkdir -p $(BINDIR)
+       mkdir -p $(OPTDIR)
        install $(TARGET) $(DASCRIPT) -t $(BINDIR)
+       install -m 755 $(START_SH) $(STOP_SH) -t $(OPTDIR)
 
 clean:
        rm -f $(TARGET) $(DAEMON_OBJS)
diff --git a/daemon/start.sh b/daemon/start.sh
new file mode 100755 (executable)
index 0000000..9249164
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+if [ ! -e /sys/kernel/debug/swap/writer/raw ]; then
+
+    insmod swap_buffer.ko || exit 1  # buffer is loaded
+    insmod swap_ksyms.ko || exit 1
+    insmod swap_driver.ko || exit 1  # driver is loaded
+    insmod swap_writer.ko || exit 1
+    insmod swap_kprobe.ko || exit 1  # kprobe is loaded
+    insmod swap_ks_manager.ko || exit 1  # ks_manager is loaded
+    insmod swap_uprobe.ko || exit 1  # uprobe is loaded
+    insmod swap_us_manager.ko || exit 1  # us_manager is loaded
+    insmod swap_ks_features.ko || exit 1  # ks_features is loaded
+    insmod swap_sampler.ko || exit 1
+    insmod swap_energy.ko || exit 1
+    insmod swap_message_parser.ko || exit 1  # parser is loaded
+
+fi
+
+# Energy coefficients
+# CPU coefficients are divided by 10^6 because
+#  - they were calculated for mAs
+#  - SWAP modules count nanoseconds
+#  - result should be exposed in uAs
+# Flash coefficients are multiplied by 10^3 because
+#  - they were calculated for mAs
+#  - result should be exposed in uAs
+# LCD coefficients are divided by 10^6 because
+#  - they were calculated for mAs
+#  - result should be exposed in uAs
+
+# cpu idle: 62.27 / 1
+echo 62270 > /sys/kernel/debug/swap/energy/cpu_idle/numerator &&
+echo 1000000000 > /sys/kernel/debug/swap/energy/cpu_idle/denominator &&
+
+# cpu0 running: 213.21 / 1
+echo 213210 > /sys/kernel/debug/swap/energy/cpu_running/numerator &&
+echo 1000000000 > /sys/kernel/debug/swap/energy/cpu_running/denominator &&
+
+# cpuN running: 97.29 / 1
+echo 97290 > /sys/kernel/debug/swap/energy/cpuN_running/numerator &&
+echo 1000000000 > /sys/kernel/debug/swap/energy/cpuN_running/denominator &&
+
+# flash read:  74.32 / 33154239
+echo 74320 > /sys/kernel/debug/swap/energy/flash_read/numerator &&
+echo 33154239 > /sys/kernel/debug/swap/energy/flash_read/denominator &&
+
+# flash write: 141.54 / 27920983
+echo 141540 > /sys/kernel/debug/swap/energy/flash_write/numerator &&
+echo 27920983 > /sys/kernel/debug/swap/energy/flash_write/denominator &&
+
+# LCD:
+if [ -d /sys/kernel/debug/swap/energy/lcd/ ]
+then
+       # lcd max (white max - black max) / 2: 255 / 1
+       echo 255 > `ls /sys/kernel/debug/swap/energy/lcd/*/max_num` &&
+       echo 1000000 > `ls /sys/kernel/debug/swap/energy/lcd/*/max_denom` &&
+
+       # lcd min (white min - black min) / 2: 179 / 1
+       echo 179 > `ls /sys/kernel/debug/swap/energy/lcd/*/min_num` &&
+       echo 1000000 > `ls /sys/kernel/debug/swap/energy/lcd/*/min_denom`
+fi
diff --git a/daemon/stop.sh b/daemon/stop.sh
new file mode 100755 (executable)
index 0000000..dcb4706
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+rmmod swap_message_parser
+rmmod swap_energy
+rmmod swap_sampler
+rmmod swap_ks_features
+rmmod swap_us_manager
+rmmod swap_uprobe
+rmmod swap_ks_manager
+rmmod swap_kprobe
+rmmod swap_writer
+rmmod swap_driver
+rmmod swap_ksyms
+rmmod swap_buffer
+
+
+
+
+
+
+
+
+
index d563cff..61966a6 100644 (file)
@@ -38,6 +38,8 @@ cd daemon
 %defattr(-,root,root,-)
 %{_prefix}/bin/da_manager
 %{_prefix}/bin/da_command
+/opt/swap/sdk/start.sh
+/opt/swap/sdk/stop.sh
 
 %changelog