From a64346e3547172ddde4806598203fbf010f13acd Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Mon, 7 Sep 2026 21:19:32 -0700 Subject: charts: add VWM_COLUMN_PROC_PPID column type This serves to also expose TGID when used on is_thread procs, which is something I'd also like to include in the snowflakes. A subsequent commit will include this column in snowflake rows to make it more clear which process the snowflake descended from. --- src/charts.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src') diff --git a/src/charts.c b/src/charts.c index 573e121..6d7a230 100644 --- a/src/charts.c +++ b/src/charts.c @@ -90,6 +90,7 @@ typedef enum _vwm_column_type_t { VWM_COLUMN_PROC_TREE, VWM_COLUMN_PROC_ARGV, VWM_COLUMN_PROC_PID, + VWM_COLUMN_PROC_PPID, VWM_COLUMN_PROC_WCHAN, VWM_COLUMN_PROC_STATE, VWM_COLUMN_PROC_RSS, @@ -795,7 +796,15 @@ static void draw_row_columns(vwm_charts_t *charts, vwm_chart_t *chart, vwm_row_c str_len = snpf(str, sizeof(str), "PID"); else str_len = snpf(str, sizeof(str), "%5i", proc->pid); + break; + case VWM_COLUMN_PROC_PPID: /* print the process' parent's PID (or TGID if a thread)*/ + if (heading) + str_len = snpf(str, sizeof(str), "PPID/TGID"); + else if (proc->parent) + str_len = snpf(str, sizeof(str), "%5i", proc->parent->pid); + else + str_len = snpf(str, sizeof(str), "???"); break; case VWM_COLUMN_PROC_WCHAN: /* print the process' wchan */ @@ -973,6 +982,10 @@ static int columns_changed(const vwm_charts_t *charts, const vwm_chart_t *chart, if (BITTEST(proc_stat->changed, VMON_PROC_STAT_PID)) return 1; break; + case VWM_COLUMN_PROC_PPID: + if (!proc->is_thread && BITTEST(proc_stat->changed, VMON_PROC_STAT_PPID)) + return 1; + break; case VWM_COLUMN_PROC_WCHAN: if (BITTEST(proc_stat->changed, VMON_PROC_STAT_WCHAN)) return 1; -- cgit v1.2.3