summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2024-10-19 16:15:37 -0700
committerVito Caputo <vcaputo@pengaru.com>2024-10-19 16:15:37 -0700
commit556368154db41283f9a26b1a5197916a6cc4fadb (patch)
tree4f42b9f598bbe4267b040e052ddb6b4058a2bda4 /src
parent1123184e5092aabe12b50ffb356213a74a26862f (diff)
vmon: wire up the new markers API to vmon's CLI
This plumbs the charts marker distance down to vmon's CLI flags in the form of -m/--marker, which you provide the number of pixels distance to put between markers as the argument for.
Diffstat (limited to 'src')
-rw-r--r--src/vmon.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/vmon.c b/src/vmon.c
index c9b3d6c..0a63fff 100644
--- a/src/vmon.c
+++ b/src/vmon.c
@@ -48,6 +48,7 @@ typedef struct vmon_t {
time_t start_time;
int snapshots_interval;
int snapshot;
+ int marker_distance;
int now_names;
int headless;
int hertz;
@@ -189,6 +190,7 @@ static void print_help(void)
" -h --help Show this help\n"
" -H --height Chart height\n"
" -l --linger Don't exit when top-level process exits\n"
+ " -m --markers Draw markers every N pixels in row borders (0 disables)\n"
" -n --name Name of chart, shows in window title and output filenames\n"
" -N --now-names Use current time in filenames instead of start time\n"
" -o --output-dir Directory to store saved output to (\".\" if unspecified)\n"
@@ -420,6 +422,11 @@ static int vmon_handle_argv(vmon_t *vmon, int argc, const char * const *argv)
return 0;
last = ++argv;
+ } else if (is_flag(*argv, "-m", "--markers")) {
+ if (!parse_flag_int(argv, end, argv + 1, 0, INT_MAX, &vmon->marker_distance))
+ return 0;
+
+ last = ++argv;
} else if (is_flag(*argv, "-o", "--output-dir")) {
if (!parse_flag_str(argv, end, argv + 1, 1, &vmon->output_dir))
return 0;
@@ -622,6 +629,9 @@ static vmon_t * vmon_startup(int argc, const char * const *argv)
if (vmon->hertz)
vwm_charts_rate_set(vmon->charts, vmon->hertz);
+ if (vmon->marker_distance)
+ vwm_charts_marker_distance_set(vmon->charts, vmon->marker_distance);
+
if (signal(SIGUSR1, handle_sigusr1) == SIG_ERR) {
VWM_PERROR("unable to set SIGUSR1 handler");
goto _err_vcr;
© All Rights Reserved