RDK Documentation (Open Sourced RDK Components)
|
Data Structures | |
struct | stPrevData |
Holds status of previous data such as Total Major Faults Raised,Total CPU Used Time,User Used CPU Time,System Used CPU Time. More... | |
struct | stCPUInfo |
Holds status of CPU information such as Total Time and Idle Time of CPU. More... | |
struct | EnvVarNode |
struct | stProcData |
Holds status of Process data such as : More... | |
Macros | |
#define | LINE_LIMIT 256 |
FILE LINE LIMIT. | |
#define | NAME_LIMIT 20 |
FILE NAME LIMIT. | |
#define | SLEEP_SECS 60 |
Sleep Interval for the data collection. | |
#define | TIME_TO_RUN_SECS 0 |
0 means, tool should run until it is killed manually | |
#define | BUFF_SIZE_64 64 |
#define | BUFF_SIZE_16 16 |
#define | DEFAULT_MEM_THRESHOLD 1536 |
#define | MONITOR_ALL_PROC_DEF 0 |
#define | DEFAULT_DYNAMIC 1 |
#define | ITERATION_THRESHOLD 25 |
#define | TELEMETRY_ONLY_DEF 0 |
#define | CPU_MASK 0x10 |
#define | MEMORY_MASK 0x08 |
#define | FDCOUNT_MASK 0x04 |
#define | THREADCOUNT_MASK 0x02 |
#define | LOADAVG_MASK 0x02 |
#define | CLICOUNT_MASK 0x01 |
#define | SYS_DEF_MASK 0x1F |
#define | PROC_DEF_MASK 0x1E |
#define | MAX(x, y) ((x>y)?x:y) |
#define | PROC_EVENT_NONE 0x00000000 |
#define | PROC_EVENT_FORK 0x00000001 |
#define | PROC_EVENT_EXEC 0x00000002 |
#define | CONFIG_PATH "/opt" |
#define | LOG_PATH "/opt/logs" |
Typedefs | |
typedef unsigned int | uint |
typedef struct EnvVarNode | EnvVarNode |
Functions | |
char * | removespaces (char *str) |
int | read_config_param (const char *paramname, const char *filename, char *res) |
char * | GetCurTimeStamp () |
This function gives Current Date and Time in the format Year-Month-Day and Hours-Minutes-Seconds. More... | |
void | GetMemParams (char *filename, unsigned long *memParam, char *param) |
This function gives information about the Memory parameters. More... | |
void | GetLoadAverage (float *loadavg) |
This function gives Load Average values. More... | |
void | GetUsedMemory (unsigned long *mem) |
This function gives information about Used memory. More... | |
void | GetIdlePercent (float *idlePercent) |
This function gives the Idle percent value. More... | |
void | CreateExclusionList () |
This function to exclude the process list of least concern. | |
void | GetFDCount (char *filename, int *FDCount) |
This function gives information about the File Descriptors in process. More... | |
void | GetFDCountSystem (int *FDCountSystem) |
This function gives information about the File Descriptors at system level. More... | |
uint | SetMask (char *res) |
This is to set the bit mask for System/Process. | |
int | LogProcData (stProcData *procData, int ppid=0, char *pname="", int is_dynamic=0, bool telemetryOnly=0) |
This function gives status information about the process. More... | |
static int | netlink_connect () |
static int | subscribe_proc_events (int netlink_sock, bool enable) |
static int | handle_process_events (int netlink_sock) |
static void * | handle_proc_ev_thread (void *arg) |
int | checkifdigit (char *ch, int size) |
bool | CheckMemLimit (int itr, unsigned long memLimit) |
int | main (int argc, char **argv) |
Main Function. More... | |
const char * | rdk_logger_module_fetch (void) |
Variables | |
uint | PROC_MASK = 0x1E |
uint | SYS_MASK = 0x1F |
pthread_mutex_t | mtx |
struct stCPUInfo | prevCPUInfo |
map< unsigned int, struct stPrevData > | prevData |
FILE * | fp_selectedps = NULL |
FILE * | fp_stat = NULL |
FILE * | fp_dataOut = NULL |
string | outputDir = "/opt/logs" "/cpuprocanalyzer/" |
string | outputDynamicDir = "/opt/logs" "/cpuprocanalyzer/dynamic/" |
long | totalTimeElapsed_sec = 0 |
char | strTime [80] |
list< string > | exclude_process_list |
list< string >::iterator | it |
static volatile bool | need_exit = false |
struct stPrevData |
Holds status of previous data such as Total Major Faults Raised,Total CPU Used Time,User Used CPU Time,System Used CPU Time.
Definition at line 135 of file cpuproc_analyzer.cpp.
Data Fields | ||
---|---|---|
unsigned int | prevTotalMajFaultsRaised | |
unsigned long | prevTotalUsedCPUTime | |
unsigned long | prevUserUsedCPUTime | |
unsigned long | prevSystemUsedCPUTime | |
double | prevTotalCPUTime_usec | |
bool | status |
struct stCPUInfo |
Holds status of CPU information such as Total Time and Idle Time of CPU.
Definition at line 150 of file cpuproc_analyzer.cpp.
Data Fields | ||
---|---|---|
unsigned long long | total | |
unsigned long long | idle |
struct EnvVarNode |
Definition at line 46 of file rdk_logger_util.c.
Data Fields | ||
---|---|---|
int | number | |
char * | name | |
char * | value | |
struct EnvVarNode * | next |
struct stProcData |
Holds status of Process data such as :
Definition at line 499 of file cpuproc_analyzer.cpp.
Public Member Functions | |
void | ReadProcStat (FILE *fp_procStat) |
This function reads status of the Process and gives information like : More... | |
void | OutFilename (char *outProcFilename, int is_dynamic) |
This function constructs a file name based on parameters such as - output Directory Name,PID value,s_comm data,PID value,s_comm data. For example : "/opt/logs/cpuprocanalyzer/<PID value>/s_comm/<PID value>/s_comm". More... | |
void | OutFilename (char *outProcFilename, int ppid, char *pname) |
This function constructs a file name based on parameters such as - output Directory Name,PPID value,Parent process Name,PID value,s_comm data. For example : "/opt/logs/cpuprocanalyzer/<PPID value>/<Parent process name>/<PID value>/s_comm". More... | |
void | GetTotalUsedTime (unsigned long *outTotalTime) |
This function gives Total CPU used time. More... | |
void | GetUserUsedTime (unsigned long *outUserTime) |
This function gives User used CPU time. More... | |
void | GetSystemUsedTime (unsigned long *outSystemTime) |
This function gives information about System used CPU time. More... | |
void | GetTotalMjrFlts (unsigned int *outTotalMjrFlts) |
This function gives the information about Total Major Faults. More... | |
Data Fields | |
int | d_pid |
char | s_comm [1000] |
char | c_state |
int | d_ppid |
int | d_pgrp |
int | d_session |
int | d_tty_nr |
int | d_tpgid |
unsigned | u_flags |
unsigned long | lu_minflt |
unsigned long | lu_cminflt |
unsigned long | lu_majflt |
unsigned long | lu_cmajflt |
unsigned long | lu_utime |
unsigned long | lu_stime |
long | ld_cutime |
long | ld_cstime |
long | ld_priority |
long | ld_nice |
long | ld_num_threads |
long | ld_itrealvalue |
unsigned long long | llu_starttime |
unsigned long | lu_vsize |
long | ld_rss |
unsigned long | lu_rsslim |
unsigned long | lu_startcode |
unsigned long | lu_endcode |
unsigned long | lu_startstack |
unsigned long | lu_kstkesp |
unsigned long | lu_kstkeip |
unsigned long | lu_signal |
unsigned long | lu_blocked |
unsigned long | lu_sigignore |
unsigned long | lu_sigcatch |
unsigned long | lu_wchan |
unsigned long | lu_nswap |
unsigned long | lu_cnswap |
int | d_exit_signal |
int | d_processor |
unsigned int | u_rt_priority |
unsigned int | u_policy |
unsigned long long | llu_delayacct_blkio_ticks |
unsigned long | lu_guest_time |
long | ld_cguest_time |
char* GetCurTimeStamp | ( | ) |
This function gives Current Date and Time in the format Year-Month-Day and Hours-Minutes-Seconds.
@ret Returns date and time in string format.
Definition at line 628 of file cpuproc_analyzer.cpp.
void GetMemParams | ( | char * | filename, |
unsigned long * | memParam, | ||
char * | param | ||
) |
This function gives information about the Memory parameters.
[in] | filename | Name of the File |
[out] | memParam | Memory Parameters |
[in] | param | It can be parameter like Virtual Memory Size, Resident Set Size and Size Of Stack. |
Definition at line 649 of file cpuproc_analyzer.cpp.
void GetLoadAverage | ( | float * | loadavg | ) |
This function gives Load Average values.
Output Example = 0.75 0.33 0.25 1/25 1747 where :
[out] | loadavg | Load Average value |
Definition at line 692 of file cpuproc_analyzer.cpp.
void GetUsedMemory | ( | unsigned long * | mem | ) |
This function gives information about Used memory.
[out] | mem | Used Memory value |
Definition at line 715 of file cpuproc_analyzer.cpp.
void GetIdlePercent | ( | float * | idlePercent | ) |
This function gives the Idle percent value.
[out] | idlepercent | Idle Percent Value |
Definition at line 765 of file cpuproc_analyzer.cpp.
void GetFDCount | ( | char * | filename, |
int * | FDCount | ||
) |
This function gives information about the File Descriptors in process.
[in] | d_pid | PID of process |
[in] | FDCount | File Descriptor in process |
Definition at line 817 of file cpuproc_analyzer.cpp.
void GetFDCountSystem | ( | int * | FDCountSystem | ) |
This function gives information about the File Descriptors at system level.
[in] | FDCountSystem | File Descriptors at system level |
Definition at line 839 of file cpuproc_analyzer.cpp.
int LogProcData | ( | stProcData * | procData, |
int | ppid = 0 , |
||
char * | pname = "" , |
||
int | is_dynamic = 0 , |
||
bool | telemetryOnly = 0 |
||
) |
This function gives status information about the process.
[in] | procData | Process Data |
[in] | ppid | Parent pid,default to 0 |
[in] | pname | Parent Name |
[in] | is_dynamic | Flag to check dynamically created process. |
Definition at line 923 of file cpuproc_analyzer.cpp.
int main | ( | int | argc, |
char ** | argv | ||
) |
Main Function.
Fetches information such as Load Average value, Used Memory value and Idle Percent value for all the Processes in the list from /opt/logs/cpuprocanalyzer/loadandmem.data.
Definition at line 1471 of file cpuproc_analyzer.cpp.