[REFACTOR] remove unused code from sys_stat.* 03/24403/2
authorVyacheslav Cherkashin <v.cherkashin@samsung.com>
Fri, 11 Jul 2014 12:11:46 +0000 (16:11 +0400)
committerVyacheslav Cherkashin <v.cherkashin@samsung.com>
Mon, 1 Sep 2014 10:06:04 +0000 (14:06 +0400)
file:
daemon/sys_stat.c
daemon/sys_stat.h

Change-Id: Iebaa41ef2745f42838b718ac8659f33d3c8b7cb5
Signed-off-by: Vyacheslav Cherkashin <v.cherkashin@samsung.com>
daemon/sys_stat.c
daemon/sys_stat.h

index f4c3331..2bfa04f 100644 (file)
@@ -90,6 +90,28 @@ enum PROCESS_DATA
        PROCDATA_SMAPS
 };
 
+typedef unsigned long long tic_t;
+
+typedef struct {
+       unsigned long freq;
+       tic_t tick;
+       tic_t tick_sav;
+} cpufreq_t;
+
+typedef struct {
+       tic_t u, n, s, i, w, x, y, z;
+       tic_t u_sav, n_sav, s_sav, i_sav, w_sav, x_sav, y_sav, z_sav;
+       unsigned int id;                // cpu id
+       float cpu_usage;                // cpu load for this core
+       int sav_load_index;             // saved cpu load sampling index
+       int cur_load_index;             // current cpu load sampling index
+       cpufreq_t* pfreq;               // frequency information of cpu
+       int sav_freq_index;             // sav cpu frequency sampling index
+       int cur_freq_index;             // current cpu frequency sampling index
+       long long idle_ticks;
+       long long total_ticks;
+} CPU_t;       // for each cpu core
+
 // declared by greatim
 static int Hertz = 0;
 static int num_of_cpu = 0;
@@ -121,7 +143,7 @@ static int get_file_status_no_open(int pfd, const char *filename)
 }
 // daemon api : get status from file
 // pfd must not be null
-int get_file_status(int *pfd, const char *filename)
+static int get_file_status(int *pfd, const char *filename)
 {
        int status = 0;
 
@@ -315,6 +337,36 @@ static void get_cpu_frequency(float *freqs)
 // ========================================================================
 // get cpu and memory info for each process and whole system
 // ========================================================================
+typedef struct {
+       unsigned int pid;
+       char command[MAXNAMESIZE];
+       char state;
+       int ppid;
+       int pgrp;
+       int sid;
+       int tty_nr;
+       int tty_pgrp;
+       unsigned long flags;
+       unsigned long minor_fault;
+       unsigned long cminor_fault;
+       unsigned long major_fault;
+       unsigned long cmajor_fault;
+       unsigned long long utime;
+       unsigned long long stime;
+       unsigned long long cutime;
+       unsigned long long cstime;
+       long priority;
+       long nice;
+       int numofthread;
+       long dummy;
+       unsigned long long start_time;
+       unsigned long vir_mem;
+       unsigned long sh_mem;
+       long res_memblock;
+       unsigned long pss;
+       float cpu_load;
+} proc_t;
+
 typedef struct _proc_node {
        proc_t proc_data;
        void *thread_prochead;
@@ -850,6 +902,11 @@ static void init_update_system_memory_data()
 
 static int update_system_memory_data(uint64_t *memtotal, uint64_t *memused)
 {
+       typedef struct _mem_t {
+               const char* name;       // memory slot name
+               unsigned long* slot;    // memory value slot
+       } mem_t;
+
        int meminfo_fd = manager.fd.procmeminfo;
        char *head, *tail;
        int i, num;
index fc01095..237ecbc 100644 (file)
@@ -37,7 +37,6 @@
 extern "C" {
 #endif
 
-#define CHARGERFD                                      "/sys/class/power_supply/battery/charge_now"
 #define VOLTAGEFD                                      "/sys/class/power_supply/battery/voltage_now"
 
 #define BRIGHTNESS_FILENAME                    "brightness"
@@ -47,29 +46,19 @@ extern "C" {
 #define EMUL_BRIGHTNESSFD                      "/sys/class/backlight/emulator/brightness"
 #define EMUL_MAX_BRIGHTNESSFD          "/sys/class/backlight/emulator/max_brightness"
 
-#define AUDIOFD                                                "/sys/devices/platform/soc-audio/WM1811 Voice/dapm_widget"
-
 #define MFCFD                                          "/sys/devices/platform/samsung-pd.0/power/runtime_status"
 
-#define FREQFD                                         "/sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq"
-
 #define CPUDIR                                         "/sys/devices/system/cpu"
 #define CPUFREQ_FILE                           "cpufreq/stats/time_in_state"
 #define CPUNUM_OF_FREQ                         CPUDIR"/cpu0/"CPUFREQ_FILE
 
 
-#define MEMINFOFD                                      "/sys/class/memnotify/meminfo"
 #define UMSFD                                          "/mnt/ums"
 #define MMCBLKFD                                       "/dev/mmcblk1"
 #define MMCFD                                          "/mnt/mmc"
 
 #define PROCSTAT                                       "/proc/stat"
 #define PROCMEMINFO                                    "/proc/meminfo"
-#define PROCCPUINFO                                    "/proc/cpuinfo"
-
-#define MEM_TYPE_TOTAL                         1
-#define MEM_TYPE_USED                          2
-#define MEM_TYPE_FREE                          3
 
 #define FSINFO_TYPE_TOTAL                      1
 #define FSINFO_TYPE_FREE                       2
@@ -81,63 +70,6 @@ extern "C" {
 #include <stdint.h>
 #include "da_protocol.h"
 
-typedef unsigned long long tic_t;
-
-typedef struct {
-       unsigned int pid;
-       char command[MAXNAMESIZE];
-       char state;
-       int ppid;
-       int pgrp;
-       int sid;
-       int tty_nr;
-       int tty_pgrp;
-       unsigned long flags;
-       unsigned long minor_fault;
-       unsigned long cminor_fault;
-       unsigned long major_fault;
-       unsigned long cmajor_fault;
-       unsigned long long utime;
-       unsigned long long stime;
-       unsigned long long cutime;
-       unsigned long long cstime;
-       long priority;
-       long nice;
-       int numofthread;
-       long dummy;
-       unsigned long long start_time;
-       unsigned long vir_mem;
-       unsigned long sh_mem;
-       long res_memblock;
-       unsigned long pss;
-       float cpu_load;
-} proc_t;
-
-typedef struct {
-       unsigned long freq;
-       tic_t tick;
-       tic_t tick_sav;
-} cpufreq_t;
-
-typedef struct {
-       tic_t u, n, s, i, w, x, y, z;
-       tic_t u_sav, n_sav, s_sav, i_sav, w_sav, x_sav, y_sav, z_sav;
-       unsigned int id;                // cpu id
-       float cpu_usage;                // cpu load for this core
-       int sav_load_index;             // saved cpu load sampling index
-       int cur_load_index;             // current cpu load sampling index
-       cpufreq_t* pfreq;               // frequency information of cpu
-       int sav_freq_index;             // sav cpu frequency sampling index
-       int cur_freq_index;             // current cpu frequency sampling index
-       long long idle_ticks;
-       long long total_ticks;
-} CPU_t;       // for each cpu core
-
-typedef struct _mem_t {
-       const char* name;               // memory slot name
-       unsigned long* slot;    // memory value slot
-} mem_t;
-
 struct target_info_t {
        uint64_t sys_mem_size;
        uint64_t storage_size;
@@ -152,10 +84,6 @@ struct target_info_t {
 
 int get_system_info(struct system_info_t *sys_info);
 
-int get_device_info(char* buffer, int buffer_len);
-
-int get_file_status(int* pfd, const char* filename);
-
 int initialize_system_info(void);
 
 int finalize_system_info(void);