From b8bcb930e265123a5e498c81b05354f0b376f503 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 12 Apr 2025 18:56:16 -0700 Subject: charts: render mem row-columns in the overlay text This adds overlay text rendering of the per-proc mem rows. It's not entirely complete yet, the main missing piece is the hierarchy branches need to get drawn into the per-proc mem row. It's not readily possible yet, since there's no way to inherit the offset of the tree column from the cpu row-column - and there's no way or the mem row-column to replicate the same horizontal offset, since it lacks the other columns like uesr/sys/wall to cumulatively get to the same offset. --- src/charts.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/charts.c b/src/charts.c index 16f8dc7..1040d45 100644 --- a/src/charts.c +++ b/src/charts.c @@ -903,14 +903,23 @@ static void draw_overlay_row(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc /* skip if obviously unnecessary (this can be further improved, but this makes a big difference as-is) */ if (!deferred_pass && !chart->redraw_needed && - !columns_changed(charts, chart, chart->proc_cpu_columns, row, proc)) + !columns_changed(charts, chart, chart->proc_cpu_columns, row, proc) && + (proc->is_thread || !columns_changed(charts, chart, chart->proc_mem_columns, row + 1, proc))) return; - if (!proc->is_new) /* XXX for now always clear the row, this should be capable of being optimized in the future (if the datums driving the text haven't changed...) */ + if (!proc->is_new) { /* XXX for now always clear the row, this should be capable of being optimized in the future (if the datums driving the text haven't changed...) */ vcr_clear_row(chart->vcr, VCR_LAYER_TEXT, row, -1, -1); + if (!proc->is_thread) + vcr_clear_row(chart->vcr, VCR_LAYER_TEXT, row + 1, -1, -1); + } draw_row_columns(charts, chart, chart->proc_cpu_row_columns, 0 /* heading */, depth, row, proc); vcr_shadow_row(chart->vcr, VCR_LAYER_TEXT, row); + + if (!proc->is_thread) { + draw_row_columns(charts, chart, chart->proc_mem_row_columns, 0 /* heading */, depth, row + 1, proc); + vcr_shadow_row(chart->vcr, VCR_LAYER_TEXT, row + 1); + } } @@ -1018,6 +1027,11 @@ static void draw_chart_rest(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_ /* extract the row from the various layers */ snowflake_row(charts, chart, (*row)); chart->snowflakes_cnt++; + + /* stamp the final RSS (and whatever else we include) into chart.text_picture */ + draw_row_columns(charts, chart, chart->snowflake_mem_row_columns, 0 /* heading */, 0 /* depth */, chart->hierarchy_end, proc); + vcr_shadow_row(chart->vcr, VCR_LAYER_TEXT, chart->hierarchy_end); + chart->hierarchy_end--; (*row)--; } -- cgit v1.2.3