Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
impala::ProcessStateInfo Class Reference

#include <process-state-info.h>

Collaboration diagram for impala::ProcessStateInfo:

Public Member Functions

 ProcessStateInfo ()
 
string DebugString () const
 
int GetInt (const string &state_key) const
 
int64_t GetInt64 (const string &state_key) const
 
string GetString (const string &state_key) const
 
int64_t GetBytes (const string &state_key) const
 Original data's unit is B or KB. More...
 

Private Types

typedef map< string, string > ProcessStateMap
 
typedef map< int, string > FileDescriptorMap
 The description info for each file. More...
 

Private Member Functions

void ReadProcIO ()
 Read I/O info from /proc/<pid>/io. More...
 
void ReadProcCgroup ()
 Read cgroup info from /proc/<pid>/cgroup. More...
 
void ReadProcSched ()
 Read schedule info from /proc/<pid>/sched. More...
 
void ReadProcStatus ()
 Read status from /proc/<pid>/status. More...
 
void ReadProcFileDescriptorInfo ()
 Read file descriptors belong the process from /proc/<pid>/fd. More...
 

Private Attributes

ProcessStateMap process_state_map_
 
FileDescriptorMap fd_desc_
 

Detailed Description

ProcessStateInfo is an interface to query for process state information at runtime. This contains information about I/O, Cgroup, Scheduler, Process status, as well as the file descriptors that belong to the process. Below are some of the I/O information will be read from /proc/pid/io. io/rchar[int64]: Number of bytes which this task has caused to be read from storage. io/wchar[int64]: Number of bytes which this task has caused to be written to storage. io/syscr[int64]: Number of read I/O operations. io/syscw[int64]: Number of write I/O operations. io/read_bytes[int64]: Number of bytes which this process fetched from storage. io/write_bytes[int64]: Number of bytes which this process wrote to storage. io/cancelled_write_bytes[int64]: Number of bytes which this process did not write, by truncating pagecache. Below are some of the Cgroup information that will be read from /proc/pid/cgroup. cgroup/hierarchy_id[int]: Hierarchy ID number. cgroup/subsystems[string]: Set of subsystems bound to the hierarchy. cgroup/control_group[string]: Control group in the hierarchy to which the process belongs. Below are some of the Scheduler information that will be read from /proc/pid/sched. sched/se.sum_exec_runtime[string]: Sum of execute time. sched/se.statistics.wait_max[string]: Max wait time in ready queue. sched/se.statistics.wait_sum[string]: Sum of wait time in ready queue. sched/se.statistics.wait_count[int64]: Total of wait times. sched/se.statistics.iowait_sum[string]: Sum of wait time for I/O. sched/se.statistics.iowait_count[int64]: Total of wait times for I/O. sched/se.statistics.nr_wakeups_migrate[int64]: Number of wakeups with cpu migration. sched/nr_switches[int64]: Total number of context switches. sched/nr_voluntary_switches[int]: Number of voluntary context switches. sched/nr_involuntary_switches[int]: Number of involuntary context switches. sched/prio[int]: The process priority. Below are some of the Process status information that will be read from /proc/pid/status. status/Threads[int]: Number of threads in process. status/VmPeak[string]: Peak virtual memory size. status/VmSize[string]: Virtual memory size. status/VmLck[string]: Locked memory size. status/VmPin[string]: Pinned memory size. status/VmHWM[string]: Peak resident set size ("high water mark"). status/VmRSS[string]: Resident Set Size. status/VmData[string], status/VmStk[string], status/VmExe[string]: Size of data, stack, and text segments. status/VmLib[string]: Shared library code size. status/VmPTE[string]: Page table entries size (since Linux 2.6.10). status/VmSwap[string]: Swap memory size. status/Cpus_allowed_list[string]: List of CPUs on which this process may run. status/Mems_allowed_list[string]: Memory nodes allowed to this process. File Descriptors information will be read from /proc/pid/fd. The number of files the process has open. The description info for each file.

Definition at line 80 of file process-state-info.h.

Member Typedef Documentation

typedef map<int, string> impala::ProcessStateInfo::FileDescriptorMap
private

The description info for each file.

Definition at line 99 of file process-state-info.h.

typedef map<string, string> impala::ProcessStateInfo::ProcessStateMap
private

Definition at line 95 of file process-state-info.h.

Constructor & Destructor Documentation

impala::ProcessStateInfo::ProcessStateInfo ( )

Read the current process state info when constructed. There is no need to be thread safe.

Definition at line 171 of file process-state-info.cc.

Member Function Documentation

string impala::ProcessStateInfo::DebugString ( ) const

Definition at line 179 of file process-state-info.cc.

int64_t impala::ProcessStateInfo::GetBytes ( const string &  state_key) const

Original data's unit is B or KB.

Definition at line 65 of file process-state-info.cc.

Referenced by impala::TEST().

int impala::ProcessStateInfo::GetInt ( const string &  state_key) const

Definition at line 42 of file process-state-info.cc.

Referenced by impala::TEST().

int64_t impala::ProcessStateInfo::GetInt64 ( const string &  state_key) const

Definition at line 48 of file process-state-info.cc.

string impala::ProcessStateInfo::GetString ( const string &  state_key) const

Definition at line 59 of file process-state-info.cc.

void impala::ProcessStateInfo::ReadProcCgroup ( )
private

Read cgroup info from /proc/<pid>/cgroup.

Definition at line 98 of file process-state-info.cc.

References path().

void impala::ProcessStateInfo::ReadProcFileDescriptorInfo ( )
private

Read file descriptors belong the process from /proc/<pid>/fd.

Definition at line 150 of file process-state-info.cc.

void impala::ProcessStateInfo::ReadProcIO ( )
private

Read I/O info from /proc/<pid>/io.

Definition at line 82 of file process-state-info.cc.

References path().

void impala::ProcessStateInfo::ReadProcSched ( )
private

Read schedule info from /proc/<pid>/sched.

Definition at line 116 of file process-state-info.cc.

References path().

void impala::ProcessStateInfo::ReadProcStatus ( )
private

Read status from /proc/<pid>/status.

Definition at line 133 of file process-state-info.cc.

References path().

Member Data Documentation

FileDescriptorMap impala::ProcessStateInfo::fd_desc_
private

Definition at line 100 of file process-state-info.h.

ProcessStateMap impala::ProcessStateInfo::process_state_map_
private

Definition at line 96 of file process-state-info.h.


The documentation for this class was generated from the following files: