diff --git a/src/pmdas/linux_proc/help b/src/pmdas/linux_proc/help index 8e2971c..bd0123c 100644 --- a/src/pmdas/linux_proc/help +++ b/src/pmdas/linux_proc/help @@ -87,2 +87,3 @@ The search path for the namelist file is as follows: @ proc.psinfo.sigcatch_s caught signals mask in string form (from /proc//status) +@ proc.psinfo.thread number of threads in this process @ proc.memory.size instantaneous virtual size of process, excluding page table and task structure. @@ -102,2 +103,3 @@ The search path for the namelist file is as follows: @ proc.memory.vmlib virtual memory used for libraries (from /proc//status) +@ proc.memory.vmswap virtual memory that has been brought in and out. @ proc.id.uid real user ID from /proc//status diff --git a/src/pmdas/linux_proc/pmda.c b/src/pmdas/linux_proc/pmda.c index 6bbc772..f0fcee4 100644 --- a/src/pmdas/linux_proc/pmda.c +++ b/src/pmdas/linux_proc/pmda.c @@ -435,2 +435,13 @@ pmdaMetric proc_metrictab[] = { +/* proc.memory.vmswap */ + { NULL, + { PMDA_PMID(CLUSTER_PID_STATUS,27), PM_TYPE_U32, PROC_INDOM, PM_SEM_INSTANT, + PMDA_PMUNITS(1,0,0,PM_SPACE_KBYTE,0,0)}}, + +/* proc.psinfo.threads */ + { NULL, + { PMDA_PMID(CLUSTER_PID_STATUS,28), PM_TYPE_U32, PROC_INDOM, PM_SEM_DISCRETE, + PMDA_PMUNITS(0,0,0,0,0,0)}}, + + /* @@ -1267,2 +1278,16 @@ proc_fetchCallBack(pmdaMetric *mdesc, unsigned int inst, pmAtomValue *atom) + case PROC_PID_STATUS_VMSWAP: + if ((f = _pm_getfield(entry->status_lines.vmswap, 1)) == NULL) + atom->ul = 0; + else + sscanf(f, "%u", &atom->ul); + break; + + case PROC_PID_STATUS_THREADS: + if ((f = _pm_getfield(entry->status_lines.threads, 1)) == NULL) + atom->ul = 0; + else + sscanf(f, "%u", &atom->ul); + break; + default: diff --git a/src/pmdas/linux_proc/pmns b/src/pmdas/linux_proc/pmns index e3be007..2b283a7 100644 --- a/src/pmdas/linux_proc/pmns +++ b/src/pmdas/linux_proc/pmns @@ -84,2 +84,3 @@ proc.psinfo { sigcatch_s PROC:24:19 + threads PROC:24:28 } @@ -121,2 +122,3 @@ proc.memory { vmlib PROC:24:26 + vmswap PROC:24:27 } diff --git a/src/pmdas/linux_proc/proc_pid.c b/src/pmdas/linux_proc/proc_pid.c index 4f7f4a1..bb2f86c 100644 --- a/src/pmdas/linux_proc/proc_pid.c +++ b/src/pmdas/linux_proc/proc_pid.c @@ -403,2 +403,6 @@ fetch_proc_pid_status(int id, proc_pid_t *proc_pid) ep->status_lines.vmlck = strsep(&curline, "\n"); + if (strncmp(curline, "VmRSS:", 6) != 0) + curline = index(curline, '\n') + 1; // Have VmPin: ? + if (strncmp(curline, "VmRSS:", 6) != 0) + curline = index(curline, '\n') + 1; // Have VmHWM: ? ep->status_lines.vmrss = strsep(&curline, "\n"); @@ -408,2 +412,5 @@ fetch_proc_pid_status(int id, proc_pid_t *proc_pid) ep->status_lines.vmlib = strsep(&curline, "\n"); + curline = index(curline, '\n') + 1; // skip VmPTE + ep->status_lines.vmswap = strsep(&curline, "\n"); + ep->status_lines.threads = strsep(&curline, "\n"); } else diff --git a/src/pmdas/linux_proc/proc_pid.h b/src/pmdas/linux_proc/proc_pid.h index 53ff1a3..7f990d3 100644 --- a/src/pmdas/linux_proc/proc_pid.h +++ b/src/pmdas/linux_proc/proc_pid.h @@ -103,2 +103,4 @@ #define PROC_PID_STATUS_VMLIB 26 +#define PROC_PID_STATUS_VMSWAP 27 +#define PROC_PID_STATUS_THREADS 28 @@ -160,2 +162,4 @@ typedef struct { /* /proc//status */ char *vmlib; + char *vmswap; + char *threads; } status_lines_t;