From b344491bc4df349bf0cccb776054c1c977bf4311 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 28 Oct 2026 17:21:03 -0700 Subject: vmon: support --short-argv for VWM_CHARTS_SHORT_ARGV Passing this flag will suppress printing the full argv for processes, leaving just the comm/argv[0] --- src/vmon.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/vmon.c b/src/vmon.c index b42b5df..1599c47 100644 --- a/src/vmon.c +++ b/src/vmon.c @@ -52,6 +52,7 @@ typedef struct vmon_t { int mem_locked; int reaper; int no_threads; + int short_argv; time_t start_time; int snapshots_interval; int snapshot; @@ -212,6 +213,7 @@ static void print_help(void) " -L --mem-locked Lock in memory using mlockall(MCL_CURRENT|MCL_FUTURE)\n" " -R --reaper Become the child subreaper (see prctl(2); PR_SET_CHILD_SUBREAPER)\n" " -T --no-threads Don't monitor threads beyond tracking their potential children\n" + " -V --short-argv Don't show the full argv of processes, include only the comm/argv[0]\n" " -W --width Chart width\n" " -z --hertz Sample rate in hertz\n" "-------------------------------------------------------------------------------" @@ -522,6 +524,9 @@ static int vmon_handle_argv(vmon_t *vmon, int argc, const char * const *argv) } else if (is_flag(*argv, "-T", "--no-threads")) { vmon->no_threads = 1; last = argv; + } else if (is_flag(*argv, "-V", "--short-argv")) { + vmon->short_argv= 1; + last = argv; } else if ((*argv)[0] == '-') { VWM_ERROR("Unrecognized argument: \"%s\", try --help\n", argv[0]); exit(EXIT_FAILURE); @@ -661,6 +666,9 @@ static vmon_t * vmon_startup(int argc, const char * const *argv) if (vmon->no_threads) charts_flags |= VWM_CHARTS_NO_THREADS; + if (vmon->short_argv) + charts_flags |= VWM_CHARTS_SHORT_ARGV; + vmon->charts = vwm_charts_create(vmon->vcr_backend, charts_flags); if (!vmon->charts) { VWM_ERROR("unable to create charts instance"); -- cgit v1.2.3