diff options
author | Vito Caputo <vcaputo@pengaru.com> | 2025-01-01 17:03:54 -0800 |
---|---|---|
committer | Vito Caputo <vcaputo@pengaru.com> | 2025-01-01 19:32:12 -0800 |
commit | 3a7106b731aa58f25dc95b86c706a79c7e8d6ae5 (patch) | |
tree | baff07b2cff646468d2527df4ded79853913e28a | |
parent | 245e0d229518830a9a0398fbe190fb2edffaf0bb (diff) |
vmon: wire up charts_vmon_dump_procs() to -D/--dump-procs
This is useful for debugging purposes.
-rw-r--r-- | src/vmon.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -45,6 +45,7 @@ typedef struct vmon_t { int pid; int done; int linger; + int dump_procs; time_t start_time; int snapshots_interval; int snapshot; @@ -199,6 +200,7 @@ static void print_help(void) " -s --snapshot Save a PNG snapshot upon receiving SIG{CHLD,TERM,USR1}\n" " -w --wip-name Name to use for work-in-progress snapshot filename\n" " -v --version Print version\n" + " -D --dump-procs Dump libvmon internal processes table (debugging aid)\n" " -W --width Chart width\n" " -z --hertz Sample rate in hertz\n" "-------------------------------------------------------------------------------" @@ -486,6 +488,9 @@ static int vmon_handle_argv(vmon_t *vmon, int argc, const char * const *argv) } else if (is_flag(*argv, "-v", "--version")) { print_version(); exit(EXIT_SUCCESS); + } else if (is_flag(*argv, "-D", "--dump-procs")) { + vmon->dump_procs = 1; + last = argv; } else if ((*argv)[0] == '-') { VWM_ERROR("Unrecognized argument: \"%s\", try --help\n", argv[0]); exit(EXIT_FAILURE); @@ -866,6 +871,11 @@ int main(int argc, const char * const *argv) vwm_chart_compose(vmon->charts, vmon->chart); vwm_chart_render(vmon->charts, vmon->chart, VCR_PRESENT_OP_SRC, vmon->vcr_dest, -1, -1, -1, -1); } + + if (vmon->dump_procs) { + charts_vmon_dump_procs(vmon->charts, stdout); + fflush(stdout); + } } if (vcr_backend_poll(vmon->vcr_backend, delay_us) > 0) |