From 11a8202d6ee7d81d3137c0561713b7df61ed6bc7 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 31 Jul 2024 09:13:19 -0700 Subject: *: %s/heirarch/hierarch/ Mechnical fix of longstanding typo I'm tired of ignoring... --- README | 6 ++--- TODO | 12 ++++----- src/charts.c | 58 ++++++++++++++++++++--------------------- src/libvmon/defs/proc_wants.def | 4 +-- src/libvmon/vmon.c | 22 ++++++++-------- src/libvmon/vmon.h | 2 +- 6 files changed, 52 insertions(+), 52 deletions(-) diff --git a/README b/README index 588a458..ae0d426 100644 --- a/README +++ b/README @@ -358,7 +358,7 @@ Composite/Monitoring: Here are some relevant things worth noting: - - The monitoring is only heirarchical if your kernel is configured with + - The monitoring is only hierarchical if your kernel is configured with CONFIG_CHECKPOINT_RESTORE, which seems to be common nowadays. This is required for the /proc/$pid/task/$tid/children files, which is what libvmon uses to efficiently scope monitoring to just the descendants of @@ -459,7 +459,7 @@ Composite/Monitoring: exacerbate the situation. - The monitoring is implemented using sampling, not tracing. Below the - current process heirarchy for every window there is an exited tasks + current process hierarchy for every window there is an exited tasks snowflakes section filling the remaining space. Do not mistake this for something lossless like bash history or strace output, it's lossy since it's produced from sampled data. In part to try avoid @@ -495,7 +495,7 @@ Composite/Monitoring: - In the interests of being efficient, nothing is being logged historically. The snowflakes area is all you get, which is limited to - the free pixel space below the instantaneous process heirarchy within + the free pixel space below the instantaneous process hierarchy within the window. Everything which falls off the edges of the screen is lost forever, diff --git a/TODO b/TODO index 32511b3..7328492 100644 --- a/TODO +++ b/TODO @@ -3,34 +3,34 @@ COMPOSITE (only relevant when monitoring overlays are enabled): observed in GIMP during testing. Right clicking in the image took two tries. -- There's often an extra row included after the process heirarchy in the +- There's often an extra row included after the process hierarchy in the overlays. This depends on wether the client process' monitor was installed first by the automatic following of children in libvmon or the vwm explicit process monitoring of _NET_WM_PID. There's an extra row included depending on how the race played out, and it's probably because count_rows() is - employed in xwin_monitor() to initialize xwin->heirarchy_end but it's not + employed in xwin_monitor() to initialize xwin->hierarchy_end but it's not making any effort to be proc->is_new aware or something. Since an extra row is relatively harmless I haven't bothered to fix it yet. - There are a number of optimization opportunities left on the table. - * The heirarchy (top) portion of the overlay text is redrawn on every + * The hierarchy (top) portion of the overlay text is redrawn on every maintain_overlay(), even if it has no changes. (text only, not the graphs) *** this has been changed to only happen if compositing is enabled. * The shadow layer is inefficiently created with 4 renders through the text as a stencil at 4 offsets to create a shadow on every compose_overlay() call, even if the text is unchanged since the last compose. - keep a cached version of the text shadow for reuse if the text is - unchanged. (depends not just on the heirarchy portion, _all_ the text + unchanged. (depends not just on the hierarchy portion, _all_ the text layer) - find a better way to create the text shadow than 4x renders through the stencil. *** already improved with a shadow layer maintained as the text layer - changes. When the heirarchy rendering becomes more change-aware, so + changes. When the hierarchy rendering becomes more change-aware, so will the shadow updates. * Snowflake maintenance is probably copying more area than it needs to when shifting, it's not aware of snowflakes_cnt. * Heirarchy rows are erased unnecessarily in maintain_overlays(), but this is - part of excessive heirarchy redraws. + part of excessive hierarchy redraws. * poll() timeout isn't calculated very well, extraneous wakeups and gettimeofday() calls are being performed. - This matters even when compositing is off, since we always maintain diff --git a/src/charts.c b/src/charts.c index cf39480..8ebdc4b 100644 --- a/src/charts.c +++ b/src/charts.c @@ -125,7 +125,7 @@ typedef struct _vwm_chart_t { int visible_width; /* currently visible width of the chart */ int visible_height; /* currently visible height of the chart */ int phase; /* current position within the (horizontally scrolling) graphs */ - int heirarchy_end; /* row where the process heirarchy currently ends */ + int hierarchy_end; /* row where the process hierarchy currently ends */ int snowflakes_cnt; /* count of snowflaked rows (reset to zero to truncate snowflakes display) */ int gen_last_composed; /* the last composed vmon generation */ int redraw_needed; /* if a redraw is required (like when the window is resized...) */ @@ -373,7 +373,7 @@ static void shift_below_row_up(vwm_charts_t *charts, vwm_chart_t *chart, int row 0, (rows + row) * CHART_ROW_HEIGHT, /* src */ 0, 0, /* mask */ 0, row * CHART_ROW_HEIGHT, /* dest */ - chart->width, (rows + chart->heirarchy_end) * CHART_ROW_HEIGHT - (rows + row) * CHART_ROW_HEIGHT); /* dimensions */ + chart->width, (rows + chart->hierarchy_end) * CHART_ROW_HEIGHT - (rows + row) * CHART_ROW_HEIGHT); /* dimensions */ XRenderChangePicture(xserver->display, pic, CPRepeat, &pa_repeat); } @@ -381,7 +381,7 @@ static void shift_below_row_up(vwm_charts_t *charts, vwm_chart_t *chart, int row /* moves what's below a given row up above it if specified, the row becoming discarded */ static void snowflake_row(vwm_charts_t *charts, vwm_chart_t *chart, Picture pic, int copy, int row) { - VWM_TRACE("pid=%i chart=%p row=%i copy=%i heirarhcy_end=%i", chart->monitor->pid, chart, row, copy, chart->heirarchy_end); + VWM_TRACE("pid=%i chart=%p row=%i copy=%i heirarhcy_end=%i", chart->monitor->pid, chart, row, copy, chart->hierarchy_end); if (copy) copy_row(charts, chart, row, pic, 0, chart->tmp_picture); @@ -389,14 +389,14 @@ static void snowflake_row(vwm_charts_t *charts, vwm_chart_t *chart, Picture pic, shift_below_row_up(charts, chart, row, pic, 1); if (copy) { - copy_row(charts, chart, 0, chart->tmp_picture, chart->heirarchy_end, pic); + copy_row(charts, chart, 0, chart->tmp_picture, chart->hierarchy_end, pic); } else { - fill_row(charts, chart, chart->heirarchy_end, pic, &chart_trans_color); + fill_row(charts, chart, chart->hierarchy_end, pic, &chart_trans_color); } } /* XXX TODO libvmon automagic children following races with explicit X client pid monitoring with different outcomes, it should be irrelevant which wins, - * currently the only visible difference is the snowflakes gap (heirarchy_end) varies, which is why I haven't bothered to fix it, I barely even notice. + * currently the only visible difference is the snowflakes gap (hierarchy_end) varies, which is why I haven't bothered to fix it, I barely even notice. */ @@ -509,8 +509,8 @@ static int count_rows(vmon_proc_t *proc) } -/* helper for detecting if any children/threads in the process heirarchy rooted @ proc are new/stale this sample */ -static int proc_heirarchy_changed(vmon_proc_t *proc) +/* helper for detecting if any children/threads in the process hierarchy rooted @ proc are new/stale this sample */ +static int proc_hierarchy_changed(vmon_proc_t *proc) { vmon_proc_t *child; @@ -519,13 +519,13 @@ static int proc_heirarchy_changed(vmon_proc_t *proc) if (!proc->is_thread) { list_for_each_entry(child, &proc->threads, threads) { - if (proc_heirarchy_changed(child)) + if (proc_hierarchy_changed(child)) return 1; } } list_for_each_entry(child, &proc->children, siblings) { - if (proc_heirarchy_changed(child)) + if (proc_hierarchy_changed(child)) return 1; } @@ -605,7 +605,7 @@ static void print_argv(const vwm_charts_t *charts, const vwm_chart_t *chart, int } -/* determine if a given process has subsequent siblings in the heirarchy */ +/* determine if a given process has subsequent siblings in the hierarchy */ static inline int proc_has_subsequent_siblings(vmon_t *vmon, vmon_proc_t *proc) { struct list_head *sib, *head = &vmon->processes; @@ -817,7 +817,7 @@ static void draw_columns(vwm_charts_t *charts, vwm_chart_t *chart, vwm_column_t str_justify = VWM_JUSTIFY_RIGHT; break; - case VWM_COLUMN_PROC_TREE: { /* print a row of the process heirarchy tree */ + case VWM_COLUMN_PROC_TREE: { /* print a row of the process hierarchy tree */ int width = 0; advance = 0; /* tree column manages its own advance; c->width is meaningless */ @@ -1006,7 +1006,7 @@ static int columns_changed(const vwm_charts_t *charts, const vwm_chart_t *chart, } -/* draws proc in a row of the process heirarchy */ +/* draws proc in a row of the process hierarchy */ static void draw_overlay_row(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *proc, int depth, int row) { /* skip if obviously unnecessary (this can be further improved, but this makes a big difference as-is) */ @@ -1023,7 +1023,7 @@ static void draw_overlay_row(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc } -/* recursive draw function for "rest" of chart: the per-process rows (heirarchy, argv, state, wchan, pid...) */ +/* recursive draw function for "rest" of chart: the per-process rows (hierarchy, argv, state, wchan, pid...) */ static void draw_chart_rest(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *proc, int *depth, int *row) { vmon_proc_stat_t *proc_stat = proc->stores[VMON_STORE_PROC_STAT]; @@ -1032,7 +1032,7 @@ static void draw_chart_rest(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_ double utime_delta, stime_delta; /* Some parts of this we must do on every sample to maintain coherence in the graphs, since they're incrementally kept - * in sync with the process heirarchy, allocating and shifting the rows as processes are created and destroyed. Everything + * in sync with the process hierarchy, allocating and shifting the rows as processes are created and destroyed. Everything * else we should be able to skip doing unless chart.redraw_needed or their contents changed. */ @@ -1080,11 +1080,11 @@ static void draw_chart_rest(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_ chart->snowflakes_cnt++; /* stamp the name (and whatever else we include) into chart.text_picture */ - // print_argv(charts, chart, 5, chart->heirarchy_end, proc, NULL); - draw_columns(charts, chart, chart->snowflake_columns, 0, chart->heirarchy_end, proc); - shadow_row(charts, chart, chart->heirarchy_end); + // print_argv(charts, chart, 5, chart->hierarchy_end, proc, NULL); + draw_columns(charts, chart, chart->snowflake_columns, 0, chart->hierarchy_end, proc); + shadow_row(charts, chart, chart->hierarchy_end); - chart->heirarchy_end--; + chart->hierarchy_end--; if (in_stale_entrypoint) { VWM_TRACE("exited stale at chart=%p depth=%i row=%i", chart, *depth, *row); @@ -1101,7 +1101,7 @@ static void draw_chart_rest(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_ allocate_row(charts, chart, chart->text_picture, (*row)); allocate_row(charts, chart, chart->shadow_picture, (*row)); - chart->heirarchy_end++; + chart->hierarchy_end++; } /* CPU utilization graphs */ @@ -1165,7 +1165,7 @@ static void draw_chart(vwm_charts_t *charts, vwm_chart_t *chart, vmon_proc_t *pr (*row)++; if (!chart->redraw_needed) - chart->redraw_needed = proc_heirarchy_changed(proc); + chart->redraw_needed = proc_hierarchy_changed(proc); prev_redraw_needed = chart->redraw_needed; draw_chart_rest(charts, chart, proc, depth, row); @@ -1243,7 +1243,7 @@ static int vwm_chart_composed_height(vwm_charts_t *charts, vwm_chart_t *chart) { int snowflakes = chart->snowflakes_cnt ? 1 + chart->snowflakes_cnt : 0; /* don't include the separator row if there are no snowflakes */ - return MIN((chart->heirarchy_end + snowflakes) * CHART_ROW_HEIGHT, chart->visible_height); + return MIN((chart->hierarchy_end + snowflakes) * CHART_ROW_HEIGHT, chart->visible_height); } @@ -1381,7 +1381,7 @@ vwm_chart_t * vwm_chart_create(vwm_charts_t *charts, int pid, int width, int hei chart->snowflake_columns[3] = (vwm_column_t){ .enabled = 1, .type = VWM_COLUMN_PROC_WALL, .side = VWM_SIDE_LEFT }; chart->snowflake_columns[4] = (vwm_column_t){ .enabled = 1, .type = VWM_COLUMN_PROC_ARGV, .side = VWM_SIDE_LEFT }; - /* add the client process to the monitoring heirarchy */ + /* add the client process to the monitoring hierarchy */ /* XXX note libvmon here maintains a unique callback for each unique callback+xwin pair, so multi-window processes work */ chart->monitor = vmon_proc_monitor(&charts->vmon, NULL, pid, VMON_WANT_PROC_INHERIT, (void (*)(vmon_t *, void *, vmon_proc_t *, void *))proc_sample_callback, chart); if (!chart->monitor) { @@ -1390,8 +1390,8 @@ vwm_chart_t * vwm_chart_create(vwm_charts_t *charts, int pid, int width, int hei } /* FIXME: count_rows() isn't returning the right count sometimes (off by ~1), it seems to be related to racing with the automatic child monitoring */ - /* the result is an extra row sometimes appearing below the process heirarchy */ - chart->heirarchy_end = 1 + count_rows(chart->monitor); + /* the result is an extra row sometimes appearing below the process hierarchy */ + chart->hierarchy_end = 1 + count_rows(chart->monitor); chart->gen_last_composed = -1; if (!vwm_chart_set_visible_size(charts, chart, width, height)) { @@ -1471,13 +1471,13 @@ void vwm_chart_compose(vwm_charts_t *charts, vwm_chart_t *chart, XserverRegion * 0, 0, 0, 0, 0, 0, - chart->visible_width, (chart->heirarchy_end * CHART_ROW_HEIGHT)); + chart->visible_width, (chart->hierarchy_end * CHART_ROW_HEIGHT)); XRenderComposite(xserver->display, PictOpOver, charts->snowflakes_text_fill, chart->text_picture, chart->picture, 0, 0, - 0, chart->heirarchy_end * CHART_ROW_HEIGHT, - 0, chart->heirarchy_end * CHART_ROW_HEIGHT, - chart->visible_width, height - (chart->heirarchy_end * CHART_ROW_HEIGHT)); + 0, chart->hierarchy_end * CHART_ROW_HEIGHT, + 0, chart->hierarchy_end * CHART_ROW_HEIGHT, + chart->visible_width, height - (chart->hierarchy_end * CHART_ROW_HEIGHT)); /* damage the window to ensure the updated chart is drawn (TODO: this can be done more selectively/efficiently) */ if (res_damaged_region) { diff --git a/src/libvmon/defs/proc_wants.def b/src/libvmon/defs/proc_wants.def index 7f02602..f08f08c 100644 --- a/src/libvmon/defs/proc_wants.def +++ b/src/libvmon/defs/proc_wants.def @@ -1,7 +1,7 @@ #include "_begin.def" -/* the available per-process wants, the order here matters, put wants which affect the sampling heirarchy first */ -/* otherwise they will change the heirarchy after samples have been collected, leaving newly introduced nodes with uninitialized sample stores after return from vmon_sample() */ +/* the available per-process wants, the order here matters, put wants which affect the sampling hierarchy first */ +/* otherwise they will change the hierarchy after samples have been collected, leaving newly introduced nodes with uninitialized sample stores after return from vmon_sample() */ /* sym, name, internal fulfilllment function */ vmon_want(PROC_FOLLOW_CHILDREN, proc_follow_children, proc_follow_children) diff --git a/src/libvmon/vmon.c b/src/libvmon/vmon.c index af3c3d8..8e8067f 100644 --- a/src/libvmon/vmon.c +++ b/src/libvmon/vmon.c @@ -1160,8 +1160,8 @@ vmon_proc_t * vmon_proc_monitor(vmon_t *vmon, vmon_proc_t *parent, int pid, vmon /* if a parent was supplied, and there is no current parent, the process is a top-level currently by external callers, but now appears to be a child of something as well, * so in this scenario, we'll remove it from the top-level siblings list, and make it a child of the new parent. I don't think there needs to be concern about its being a thread here. */ /* Note we can't simply move the process from its current processes list and add it to the supplied parent's children list, as that would break the iterator above us at the top-level, so - * we must defer the migration until the processes iterator context can do it for us - but this is tricky because we're in the middle of traversing our heirarchy and this process may - * be in a critical is_new state which must be realized this sample at its location in the heirarchy for correctness, there will be no reappearance of that critical state in the correct + * we must defer the migration until the processes iterator context can do it for us - but this is tricky because we're in the middle of traversing our hierarchy and this process may + * be in a critical is_new state which must be realized this sample at its location in the hierarchy for correctness, there will be no reappearance of that critical state in the correct * tree position for users like vwm. */ /* the VMON_FLAG_2PASS flag has been introduced for users like vwm */ proc->parent = parent; @@ -1372,7 +1372,7 @@ static int sample_siblings(vmon_t *vmon, list_head_t *siblings) } /* XXX note that sample_callbacks are called only after all the descendants have had their sampling performed (and their potential callbacks invoked) - * this enables the installation of a callback at a specific node in the process heirarchy which can also perform duties on behalf of the children + * this enables the installation of a callback at a specific node in the process hierarchy which can also perform duties on behalf of the children * being monitored, handy when automatically following children, an immediately relevant use case (vwm) */ list_for_each_entry(cb, &proc->sample_callbacks, callbacks) @@ -1393,7 +1393,7 @@ static int sample_siblings(vmon_t *vmon, list_head_t *siblings) } -/* 2pass version of the internal heirarchical sampling helper */ +/* 2pass version of the internal hierarchical sampling helper */ static int sample_siblings_pass1(vmon_t *vmon, list_head_t *siblings) { vmon_proc_t *proc, *_proc; @@ -1537,12 +1537,12 @@ int vmon_sample(vmon_t *vmon) /* then the per-process samplers */ if ((vmon->flags & VMON_FLAG_PROC_ARRAY)) { int j; - /* TODO: determine if this really makes sense, if we always maintain a heirarchy even in array mode, then we - * should probably always sample in the heirarchical order, or maybe make it caller-specified. - * There is a benefit to invoking the callbacks in heirarchical order, the callbacks can make assumptions about the children + /* TODO: determine if this really makes sense, if we always maintain a hierarchy even in array mode, then we + * should probably always sample in the hierarchical order, or maybe make it caller-specified. + * There is a benefit to invoking the callbacks in hierarchical order, the callbacks can make assumptions about the children * having the callbacks invoked prior to the current node, if done in depth-first order.... - * XXX this is a problem, figure out what to do with this, for now we don't even maintain the heirarchy in VMON_FLAG_PROC_ALL - * mode, only FOLLOW_CHILDREN mode, and it's likely PROC_ARRAY will generally be used together with PROC_ALL, so no heirarchy + * XXX this is a problem, figure out what to do with this, for now we don't even maintain the hierarchy in VMON_FLAG_PROC_ALL + * mode, only FOLLOW_CHILDREN mode, and it's likely PROC_ARRAY will generally be used together with PROC_ALL, so no hierarchy * is available to traverse even if we wanted to. */ @@ -1566,7 +1566,7 @@ int vmon_sample(vmon_t *vmon) } } } else if ((vmon->flags & VMON_FLAG_2PASS)) { - /* recursive heirarchical depth-first processes tree sampling, at each node threads come before children, done in two passes: + /* recursive hierarchical depth-first processes tree sampling, at each node threads come before children, done in two passes: * Pass 1. samplers * Pass 2. callbacks * XXX this is the path vwm utilizes, everything else is for other uses, like implementing top-like programs. @@ -1574,7 +1574,7 @@ int vmon_sample(vmon_t *vmon) ret = sample_siblings_pass1(vmon, &vmon->processes); /* XXX TODO: errors */ ret = sample_siblings_pass2(vmon, &vmon->processes); } else { - /* recursive heirarchical depth-first processes tree sampling, at each node threads come before children, done in a single pass: + /* recursive hierarchical depth-first processes tree sampling, at each node threads come before children, done in a single pass: * Pass 1. samplers; callbacks (for every node) */ ret = sample_siblings(vmon, &vmon->processes); diff --git a/src/libvmon/vmon.h b/src/libvmon/vmon.h index cefcb43..44b2b7b 100644 --- a/src/libvmon/vmon.h +++ b/src/libvmon/vmon.h @@ -265,7 +265,7 @@ typedef struct _vmon_t { int array_hint_free; /* hint for a free element in the list */ list_head_t htab[VMON_HTAB_SIZE]; /* hash table for quickly finding processes being monitored */ - list_head_t processes; /* top of the processes heirarchy */ + list_head_t processes; /* top of the processes hierarchy */ list_head_t orphans; /* ephemeral list of processes orphaned this sample, orphans wind up becoming top-level processes */ int processes_changed:1; /* flag set when the toplevel processes list changes */ -- cgit v1.2.3