summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2024-10-06 23:20:27 -0700
committerVito Caputo <vcaputo@pengaru.com>2024-10-08 01:21:05 -0700
commit56f1ddab1bcd223e3175980c4fdda36c37016afe (patch)
tree1de0af73363b6cabf7f9945bf58e991f40cf12e5 /src
parent7a78dcec324c441eea09ad7490a9e49e153c5f82 (diff)
charts: {depth,row}=0 in draw_chart() not maintain_chart()
This should have been done when draw_chart() and draw_chart_rest() were split apart making draw_chart() non-recursive. But it becomes much more glaringly obvious in a world where maintain_chart() is calling draw_chart() in multiple places.
Diffstat (limited to 'src')
-rw-r--r--src/charts.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/charts.c b/src/charts.c
index 1f9999a..24ffe7d 100644
--- a/src/charts.c
+++ b/src/charts.c
@@ -977,9 +977,10 @@ static void draw_chart_rest(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_
/* recursive draw function entrypoint, draws the IOWait/Idle/HZ row, then enters draw_chart_rest() */
-static void draw_chart(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *proc, int *depth, int *row, int deferred_pass, unsigned sample_duration_idx)
+static void draw_chart(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *proc, int deferred_pass, unsigned sample_duration_idx)
{
int prev_redraw_needed = chart->redraw_needed;
+ int row = 0, depth = 0;
/* IOWait and Idle % @ row 0 */
draw_bars(charts, chart, 0, 1.0, charts->iowait_delta, charts->total_delta, charts->idle_delta, charts->total_delta);
@@ -987,17 +988,17 @@ static void draw_chart(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *pr
/* only draw the \/\/\ and HZ if necessary */
if (sample_duration_idx == (charts->this_sample_duration - 1)) {
if (deferred_pass || (!charts->defer_maintenance && (chart->redraw_needed || charts->prev_sampling_interval_secs != charts->sampling_interval_secs))) {
- vcr_clear_row(chart->vcr, VCR_LAYER_TEXT, 0, -1, -1);
- draw_columns(charts, chart, chart->columns, 1 /* heading */, 0 /* depth */, 0, proc);
- shadow_row(charts, chart, 0);
+ vcr_clear_row(chart->vcr, VCR_LAYER_TEXT, row, -1, -1);
+ draw_columns(charts, chart, chart->columns, 1 /* heading */, 0 /* depth */, row, proc);
+ shadow_row(charts, chart, row);
}
if (!prev_redraw_needed)
chart->redraw_needed = proc_hierarchy_changed(proc);
}
- (*row)++;
+ row++;
- draw_chart_rest(charts, chart, proc, depth, row, deferred_pass, sample_duration_idx);
+ draw_chart_rest(charts, chart, proc, &depth, &row, deferred_pass, sample_duration_idx);
if (sample_duration_idx == (charts->this_sample_duration - 1)) {
if (chart->redraw_needed > prev_redraw_needed) {
/* Drawing bumped redraw_needed (like a layout change from widths changing),
@@ -1042,19 +1043,14 @@ static void maintain_chart(vwm_charts_t *charts, vwm_chart_t *chart, int deferre
*/
/* deferred pass updates the arbitrarily reproducible overlays, not incrementally rendered graphs; this_sample_duration is irrelevant */
- if (deferred_pass) {
- int row = 0, depth = 0;
-
- return draw_chart(charts, chart, chart->proc, &depth, &row, deferred_pass, 0 /* sample_duration_idx */);
- }
+ if (deferred_pass)
+ return draw_chart(charts, chart, chart->proc, deferred_pass, 0 /* sample_duration_idx */);
for (unsigned i = 0; i < charts->this_sample_duration; i++) {
- int row = 0, depth = 0;
-
vcr_advance_phase(chart->vcr, -1); /* change this to +1 to scroll the other direction */
/* recursively draw the monitored processes to the chart */
- draw_chart(charts, chart, chart->proc, &depth, &row, 0 /* deferred_pass */, i);
+ draw_chart(charts, chart, chart->proc, 0 /* deferred_pass */, i);
}
}
© All Rights Reserved