diff options
author | Stef Walter <stef@memberwebs.com> | 2009-01-16 17:19:02 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2009-01-16 17:19:02 +0000 |
commit | 390ef9a08c1f5e8547a35e2d38e6928a4b1ac5b5 (patch) | |
tree | 0be8218bd1d9214a7b4e846c3be7eb0f823700e5 /module | |
parent | 2316a0d0c4a584b565f2cf9d2d1ec38ac4592e97 (diff) |
Add RSS size
Diffstat (limited to 'module')
-rw-r--r-- | module/bsnmp-jails.c | 9 | ||||
-rw-r--r-- | module/jails-tree.def | 8 |
2 files changed, 14 insertions, 3 deletions
diff --git a/module/bsnmp-jails.c b/module/bsnmp-jails.c index b6eca88..542d30c 100644 --- a/module/bsnmp-jails.c +++ b/module/bsnmp-jails.c @@ -169,6 +169,7 @@ struct jaildat { uint32_t cpu_time_offset; uint32_t n_processes; uint32_t n_threads; + uint64_t rss_memory; /* Top process information */ uint32_t n_ptops; @@ -887,6 +888,7 @@ process_refresh_all (void) int nentries, i, jid; uint32_t cpu_time; void *alloc; + int pagesize; /* Get a process listing */ kp = kvm_getprocs (kvm_handle, KERN_PROC_PROC, 0, &nentries); @@ -897,6 +899,7 @@ process_refresh_all (void) /* Sort the input we get, in reverse */ qsort (kp, nentries, sizeof (*kp), process_compar_kp_pid); + pagesize = getpagesize (); /* Mark all processes in the jail for later sweep */ TAILQ_FOREACH (jail, &jaildats, link) { @@ -905,6 +908,7 @@ process_refresh_all (void) jail->n_processes = 0; jail->n_threads = 0; + jail->rss_memory = 0; jail->cpu_time_total = jail->cpu_time_offset; } @@ -923,6 +927,8 @@ process_refresh_all (void) jail->n_processes += 1; jail->n_threads += kp[i].ki_numthreads; + jail->rss_memory += (kp[i].ki_rssize * pagesize); + /* Find the top level process within jail to account to */ tkp = &kp[i]; @@ -1453,6 +1459,9 @@ op_jailentry (struct snmp_context *ctx, struct snmp_value *value, case LEAF_jailDiskFiles: value->v.counter64 = jail->disk_files; return SNMP_ERR_NOERROR; + case LEAF_jailResidentSize: + value->v.counter64 = jail->rss_memory; + return SNMP_ERR_NOERROR; default: ASSERT (0); return SNMP_ERR_NOSUCHNAME; diff --git a/module/jails-tree.def b/module/jails-tree.def index 3be0826..c89e07f 100644 --- a/module/jails-tree.def +++ b/module/jails-tree.def @@ -53,11 +53,13 @@ (13 jailOutPackets COUNTER64 GET) (20 jailProcesses INTEGER GET) - (21 jailThreads INTEGER GET) + (21 jailThreads INTEGER GET) (25 jailCpuTime TIMETICKS GET) - (30 jailDiskSpace COUNTER64 GET) - (31 jailDiskFiles COUNTER64 GET) + (30 jailDiskSpace COUNTER64 GET) + (31 jailDiskFiles COUNTER64 GET) + + (40 jailResidentSize COUNTER64 GET) ) ) |