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;
}
// 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;
// ========================================================================
// 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;
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;
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"
#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
#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;
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);