From 2c9fe3973a28504e664c5d7c9d990bc2f16c0348 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 7 Mar 2017 18:27:41 -0800 Subject: libvmon: add "sys-wide" arg for sample callbacks We need to eventually plumb an vwm_overlays_t reference back to sample_cb, for now we'll just obviate the need for the vwm_ptr global by plumbing the vwm_t through. --- src/libvmon/vmon.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/libvmon/vmon.h') diff --git a/src/libvmon/vmon.h b/src/libvmon/vmon.h index 06a062b..56c7b56 100644 --- a/src/libvmon/vmon.h +++ b/src/libvmon/vmon.h @@ -217,7 +217,7 @@ struct _vmon_t; /* list of callbacks is maintained for the per-process callbacks, it's convenient to do things like update multiple dynamic contexts associated with a given process monitor (think multiple windows) */ typedef struct _vmon_proc_callback_t { - void (*func)(struct _vmon_t *, struct _vmon_proc_t *, void *); + void (*func)(struct _vmon_t *, void *, struct _vmon_proc_t *, void *); void *arg; list_head_t callbacks; } vmon_proc_callback_t; @@ -283,7 +283,8 @@ typedef struct _vmon_t { vmon_sys_wants_t activity; /* bits updated when there's activity on the respective wants (stores have changes) */ void *stores[VMON_STORE_SYS_NR]; /* stores for the sys-wide wants */ - void (*sample_cb)(struct _vmon_t *); /* callback invoked after executing the selected sys wants (once per vmon_sample() call)) */ + void (*sample_cb)(struct _vmon_t *, void *); /* callback invoked after executing the selected sys wants (once per vmon_sample() call)) */ + void *sample_cb_arg; /* user pointer for sample_cb */ char buf[8192]; /* scratch buffer for private use XXX: it may make sense to dynamically size these... */ char buf_bis[8192]; /* secondary scratch buffer for private use */ @@ -301,8 +302,8 @@ typedef struct _vmon_t { int vmon_init(vmon_t *, vmon_flags_t, vmon_sys_wants_t, vmon_proc_wants_t); void vmon_destroy(vmon_t *); -vmon_proc_t * vmon_proc_monitor(vmon_t *, vmon_proc_t *, int, vmon_proc_wants_t, void (*)(vmon_t *, vmon_proc_t *, void *), void *); -void vmon_proc_unmonitor(vmon_t *, vmon_proc_t *, void (*)(vmon_t *, vmon_proc_t *, void *), void *); +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 *); #endif -- cgit v1.2.3