From 1123184e5092aabe12b50ffb356213a74a26862f Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 19 Oct 2024 16:13:55 -0700 Subject: charts: stub out marker API This introduces the concept of border markers intended to serve as timeline references/milestones. Here only the minimal API for setting their distance is added, nothing is actually implemented yet. --- src/charts.c | 10 ++++++++++ src/charts.h | 1 + 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/charts.c b/src/charts.c index 8001526..9d31603 100644 --- a/src/charts.c +++ b/src/charts.c @@ -65,6 +65,7 @@ typedef struct _vwm_charts_t { vmon_t vmon; float prev_sampling_interval_secs, sampling_interval_secs; int sampling_paused, contiguous_drops, primed; + unsigned marker_distance; float inv_ticks_per_sec, inv_total_delta; unsigned defer_maintenance:1; } vwm_charts_t; @@ -1300,6 +1301,15 @@ void vwm_charts_rate_set(vwm_charts_t *charts, unsigned hertz) } +/* set an arbitrary marker spacing in pixels, 0 disables markers (default) */ +void vwm_charts_marker_distance_set(vwm_charts_t *charts, unsigned distance) +{ + assert(charts); + + charts->marker_distance = distance; +} + + /* convenience function for returning the time delta as a seconds.fraction float */ static float delta(struct timespec *cur, struct timespec *prev) { diff --git a/src/charts.h b/src/charts.h index e175d18..888fc9d 100644 --- a/src/charts.h +++ b/src/charts.h @@ -18,6 +18,7 @@ void vwm_charts_destroy(vwm_charts_t *charts); void vwm_charts_rate_increase(vwm_charts_t *charts); void vwm_charts_rate_decrease(vwm_charts_t *charts); void vwm_charts_rate_set(vwm_charts_t *charts, unsigned hertz); +void vwm_charts_marker_distance_set(vwm_charts_t *charts, unsigned distance); int vwm_charts_update(vwm_charts_t *charts, int *desired_delay_us); vwm_chart_t * vwm_chart_create(vwm_charts_t *charts, int pid, int width, int height, const char *name); -- cgit v1.2.3