dtactivity: each tab says what its graph colours are; stacked graphs scale to their total (t0091)

The same three paints meant different things on the four tabs (user/system/nice,
used/cached, read/write, receive/send) and nothing said which; each tab has a
"Graph: ..." line under its numbers now.  The Disk and Network graphs stack
read on write but were scaled to the larger of the two, so a second with both
could clip: they scale to the highest stacked column (Peak sums the two).
Seen in a PID-namespace session with a disk writer: the line fits under the
numbers, the red writes fill the height at the peak.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
lotherkandClaude Sonnet 5.5 committed 2026-11-15 05:21:56 +00:00
1 parent 5ea507d4dc
commit 8b6d56f572
2 files changed
+18 -11

No files matched your search

+2 -1
View File
@@ -284,7 +284,8 @@ narratives and test notes, is `docs/reference/mcde-agents-history-2026-11-13.txt
a process that ignores SIGTERM survives Quit and dies of Force Quit. Not
built yet: Show "with window", the global menu, Cmd+F and Cmd+1..5, the
administrator's way for another user's process (t0079: it says "belongs to
somebody else"), a legend for the graph colours, and the dtappscan entry.
somebody else") and the dtappscan entry. Each tab says in a line what its
colours are; the Disk and Network graphs scale to the highest stacked second.
The NetBSD backends of the numbers were never run.
- **Device events** (`mcde_sys_disk_events`, `lib/McdeSys/events.c`): a
non-blocking descriptor of the kernel's uevent socket (Linux, AF_NETLINK
+16 -10
View File
@@ -538,17 +538,17 @@ Columns(Display *dpy, Window win, int w, int h, const double *a,
}
}
/* the highest column of two stacked histories: what the graph must hold */
static double
Peak(const double *a, const double *b)
{
double m = 0;
double m = 0, v;
int i;
for (i = 0; i < HISTORY; i++) {
if (a[i] > m)
m = a[i];
if (b != NULL && b[i] > m)
m = b[i];
v = a[i] + (b != NULL ? b[i] : 0);
if (v > m)
m = v;
}
return m;
}
@@ -563,8 +563,9 @@ DrawValues(void)
case TAB_CPU:
snprintf(text, sizeof text, "%% User: %5.2f %% System: "
"%5.2f %% Nice: %5.2f %% Idle: %5.2f\nThreads: %ld"
" Processes: %lu", lastUser, lastSystem, lastNice,
lastIdle, nthreads, (unsigned long) nall);
" Processes: %lu\nGraph: blue user, red system, green "
"nice", lastUser, lastSystem, lastNice, lastIdle, nthreads,
(unsigned long) nall);
break;
case TAB_MEMORY:
Human(mem.free, a, sizeof a);
@@ -576,7 +577,8 @@ DrawValues(void)
Human(mem.swap_used, a, sizeof a);
Human(mem.swap_total, b, sizeof b);
snprintf(text + strlen(text), sizeof text - strlen(text),
"\nSwap used: %s of %s", a, b);
"\nSwap used: %s of %s\nGraph: blue used, red cached "
"(the rest is free)", a, b);
break;
case TAB_DISK:
Human((unsigned long long) rateDiskR, a, sizeof a);
@@ -584,7 +586,9 @@ DrawValues(void)
Human(totalDiskR, c, sizeof c);
Human(totalDiskW, d, sizeof d);
snprintf(text, sizeof text, "Reading: %s/s Writing: %s/s"
"\nRead in all: %s Written in all: %s", a, b, c, d);
"\nRead in all: %s Written in all: %s\nGraph: blue "
"reading, red writing (scaled to the highest second)", a, b,
c, d);
break;
default:
Human((unsigned long long) rateNetR, a, sizeof a);
@@ -592,7 +596,9 @@ DrawValues(void)
Human(totalNetR, c, sizeof c);
Human(totalNetT, d, sizeof d);
snprintf(text, sizeof text, "Receiving: %s/s Sending: %s/s"
"\nReceived in all: %s Sent in all: %s", a, b, c, d);
"\nReceived in all: %s Sent in all: %s\nGraph: blue "
"receiving, red sending (scaled to the highest second)", a,
b, c, d);
break;
}
SetLabel(values, text);