diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libvmon/vmon.c | 18 | ||||
-rw-r--r-- | src/libvmon/vmon.h | 2 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/libvmon/vmon.c b/src/libvmon/vmon.c index 4ce0974..69dc99b 100644 --- a/src/libvmon/vmon.c +++ b/src/libvmon/vmon.c @@ -1689,3 +1689,21 @@ int vmon_sample(vmon_t *vmon) return ret; } + + +void vmon_dump_procs(vmon_t *vmon, FILE *out) +{ + assert(vmon); + assert(out); + + fprintf(out, "generation=%i\n", vmon->generation); + for (int i = 0; i < VMON_HTAB_SIZE; i++) { + vmon_proc_t *proc; + + list_for_each_entry(proc, &vmon->htab[i], bucket) { + fprintf(out, "[%i] proc=%p parent=%p gen=%i pid=%i rc=%i is_threaded=%i is_thread=%i is_new=%u is_stale=%u\n", + i, proc, proc->parent, proc->generation, proc->pid, proc->refcnt, (unsigned)proc->is_threaded, (unsigned)proc->is_thread, (unsigned)proc->is_new, (unsigned)proc->is_stale); + + } + } +} diff --git a/src/libvmon/vmon.h b/src/libvmon/vmon.h index 325a44a..974d27f 100644 --- a/src/libvmon/vmon.h +++ b/src/libvmon/vmon.h @@ -4,6 +4,7 @@ #include <sys/types.h> #include <dirent.h> #include <stdint.h> +#include <stdio.h> /* just for vmon_dump_procs() */ #include <string.h> /* I use strcmp() in the type comparator definitions */ #include "bitmap.h" @@ -308,5 +309,6 @@ void vmon_destroy(vmon_t *); vmon_proc_t * vmon_proc_monitor(vmon_t *, vmon_proc_t *, int, vmon_proc_wants_t, void (*)(vmon_t *, void *, vmon_proc_t *, void *), void *); void vmon_proc_unmonitor(vmon_t *, vmon_proc_t *, void (*)(vmon_t *, void *, vmon_proc_t *, void *), void *); int vmon_sample(vmon_t *); +void vmon_dump_procs(vmon_t *vmon, FILE *out); #endif |