diff options
| author | Vito Caputo <vcaputo@pengaru.com> | 2026-09-07 21:19:32 -0700 |
|---|---|---|
| committer | Vito Caputo <vcaputo@pengaru.com> | 2026-09-08 05:40:28 -0700 |
| commit | a64346e3547172ddde4806598203fbf010f13acd (patch) | |
| tree | 0d4a3c24ed0028352dd5320eb25cb0a08ac2aaf6 /src | |
| parent | 9219a26acdb798271437612ba52a99747174ae57 (diff) | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/charts.c | 13 |
1 files changed, 13 insertions, 0 deletions
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; |
