@johngaynor/ocnus 2.0.1-next.22 → 2.0.1-next.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -54
- package/cli/lib/host.sh +18 -348
- package/cli/lib/tests.sh +2 -3
- package/cli/ocnus +9 -39
- package/herdr/README.md +2 -138
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -885,7 +885,7 @@ read afterwards. It is off until you turn it on, and works on macOS only.
|
|
|
885
885
|
|
|
886
886
|
```sh
|
|
887
887
|
ocnus host on # turn recording on
|
|
888
|
-
ocnus host report [<period>] # how often CPU, memory and disk were at their limit,
|
|
888
|
+
ocnus host report [<period>] # how often CPU, memory and disk were at their limit, what used the most, and where the steps' time went
|
|
889
889
|
ocnus host off # turn it off, and delete every reading
|
|
890
890
|
ocnus host # whether recording is on, and what it has
|
|
891
891
|
ocnus tests run <command> # run a test command, and record the test run
|
|
@@ -956,31 +956,7 @@ and disk it says how much of the recorded time it was at its limit: the CPU
|
|
|
956
956
|
at least 90% busy across all cores, memory pressure at warning or critical,
|
|
957
957
|
or under 10% of the home folder's disk free. Time with no reading, such as
|
|
958
958
|
when no agent was open, is shown as missing, never as idle. It also says how
|
|
959
|
-
much of the CPU recording used, watching the test runs included. Then
|
|
960
|
-
each number of agents working at once, from none up, it says how long that
|
|
961
|
-
many were working and how much of that time the CPU or memory was at its
|
|
962
|
-
limit. It names the fewest working at which that was at least a quarter of
|
|
963
|
-
the time, as the number from which the host was the limit, so you can tell
|
|
964
|
-
how many agents to run at once, or says the host was not the limit at any
|
|
965
|
-
number. Readings from before the agents working were counted are left out
|
|
966
|
-
of these figures, and their time is counted on a line of its own. Under
|
|
967
|
-
each number from 2 up, it says how much slower test runs were than with one
|
|
968
|
-
agent working, as a percentage, such as `test runs 30% slower than with 1
|
|
969
|
-
working, from 3 runs of 1 command against 3 with 1 working`. It sets only
|
|
970
|
-
runs of the same command in the same repo against each other, and a command
|
|
971
|
-
counts only once it has run at least 3 times with that many working and 3
|
|
972
|
-
times with one; with none that has, it says it cannot tell yet. A test run
|
|
973
|
-
counts at the number of agents working for most of its time. Runs cut
|
|
974
|
-
short, runs from before the fingerprints were kept, and runs while no
|
|
975
|
-
reading counted the agents working are left out. Then it names the 5
|
|
976
|
-
longest stretches in the period when the CPU or memory was at its limit,
|
|
977
|
-
longest first: when each started, how long it lasted and which of the two
|
|
978
|
-
was at its limit, then every card going then, with its step, or its phase
|
|
979
|
-
when it was in none, and every test run going then, each with its share of
|
|
980
|
-
all cores over the stretch and the most memory it held. Each card also says
|
|
981
|
-
for how much of the stretch its agent was working. With none, it says the
|
|
982
|
-
host was never at its limit for CPU or memory. Disk is not among them: a
|
|
983
|
-
full disk is not caused by a moment's work. Then it lists the
|
|
959
|
+
much of the CPU recording used, watching the test runs included. Then it lists the
|
|
984
960
|
10 steps and the 10 phases that used the most CPU time in the period, and
|
|
985
961
|
the 10 of each that held the most memory at once, each one card's own, such
|
|
986
962
|
as LAB-150's build step, with how long it ran. Then come the 10 test runs
|
|
@@ -990,34 +966,6 @@ Then it says where the steps' time went: the agents' time in all on the
|
|
|
990
966
|
host, waiting on the model and the rest, then the same for the 10 steps open
|
|
991
967
|
longest, each one card's own, such as LAB-152's build step, and how many
|
|
992
968
|
steps had no split.
|
|
993
|
-
|
|
994
|
-
Then it says whether the network may be the cause, as a slow wait on the
|
|
995
|
-
model can be the network rather than the host. A wait is slow when it took
|
|
996
|
-
over twice the median of every wait on the model recorded, up to 90 days.
|
|
997
|
-
When waits that ended in the period were slow while CPU, memory and disk
|
|
998
|
-
were all below their limit, in every reading over the wait, it says so:
|
|
999
|
-
`The network may be the cause: 14 of 120 waits on the model were slow (over
|
|
1000
|
-
twice the median of 6.2s) while CPU, memory and disk were below their
|
|
1001
|
-
limit.` A slow wait with no reading over it does not count. With none, it
|
|
1002
|
-
says nothing. It cannot tell a slow network from a slow model.
|
|
1003
|
-
|
|
1004
|
-
Last comes the verdict, one line with the numbers behind it, so that money
|
|
1005
|
-
goes on what slows the agents' work on the host. It weighs each reading by
|
|
1006
|
-
the agents' time on the host in it, the seconds their tools ran, an agent's
|
|
1007
|
-
second each, from the splits. With fewer than 10 steps with their time
|
|
1008
|
-
split in the period, or under 1 hour of the agents' time on the host, there
|
|
1009
|
-
is too little data yet, and it says how many and how long. Otherwise, of
|
|
1010
|
-
CPU, memory and disk, the one at its limit for the most of the agents' time
|
|
1011
|
-
on the host, when that is at least 10% of it, is the one to upgrade first:
|
|
1012
|
-
`upgrade memory first: it was at its limit for 23.0% of the agents' 6h 10m
|
|
1013
|
-
on the host (CPU 8.0%, disk 0.0%)`. When over half of its time at its limit
|
|
1014
|
-
was on battery, in Low Power Mode or with the thermal state at serious or
|
|
1015
|
-
critical, the verdict is that the power state was the limit, in place of an
|
|
1016
|
-
upgrade: plugging in, or letting the machine cool, costs nothing. With none
|
|
1017
|
-
at its limit for 10%, the network was the limit when at least 10% of the
|
|
1018
|
-
period's waits on the model were slow while CPU, memory and disk were below
|
|
1019
|
-
their limit, so that no host upgrade is bought that would not have helped.
|
|
1020
|
-
Otherwise no upgrade is needed.
|
|
1021
969
|
See [herdr/README.md](herdr/README.md#recording-the-host) for what a
|
|
1022
970
|
reading holds.
|
|
1023
971
|
|
package/cli/lib/host.sh
CHANGED
|
@@ -33,9 +33,7 @@
|
|
|
33
33
|
# turn, as herdr-core's status for its terminal says, and waiting while it is
|
|
34
34
|
# open but its turn has ended, it waits on the human in its tab, it hit an
|
|
35
35
|
# error, or it reports no status. A tab that holds its shell alone is not
|
|
36
|
-
# open, so it is neither.
|
|
37
|
-
# working, how much of the time the host was at its limit, and from which
|
|
38
|
-
# number the host was the limit.
|
|
36
|
+
# open, so it is neither.
|
|
39
37
|
#
|
|
40
38
|
# Beside the readings go the test runs: each run of a repo's tests that an
|
|
41
39
|
# agent starts through `ocnus tests run` (tests.sh), with its card and
|
|
@@ -43,16 +41,12 @@
|
|
|
43
41
|
# memory it held at once. A test run is named by its card and repo alone.
|
|
44
42
|
# Its command is kept only as a fingerprint, a number the same for the same
|
|
45
43
|
# command and from which its text cannot be read back, and nothing else of
|
|
46
|
-
# its command line is kept. `host report` ranks the test runs too
|
|
47
|
-
# runs of the same command in the same repo against each other to say how
|
|
48
|
-
# much slower they were with more agents working.
|
|
44
|
+
# its command line is kept. `host report` ranks the test runs too.
|
|
49
45
|
#
|
|
50
46
|
# With each reading go the shares of the test runs going then, too, each
|
|
51
47
|
# worked out as a terminal's is, from the processes under the run's job,
|
|
52
48
|
# which are in their terminal's share as well. A run that ended since the
|
|
53
|
-
# reading before gets the rest of its CPU in the next one.
|
|
54
|
-
# names the cards' steps and the test runs going in the longest stretches
|
|
55
|
-
# when the CPU or memory was at its limit.
|
|
49
|
+
# reading before gets the rest of its CPU in the next one.
|
|
56
50
|
#
|
|
57
51
|
# While recording is on, `task new` and `task build` start claude with hooks
|
|
58
52
|
# that mark its agent's time (host_hooks): cli/host-mark appends a word and
|
|
@@ -64,16 +58,10 @@
|
|
|
64
58
|
# those marks (host_splits): on the host, while its tools run, and waiting
|
|
65
59
|
# on the model. The rest of the time its agent was open is neither, such as
|
|
66
60
|
# waiting on the human. `host report` says where the steps' time went by
|
|
67
|
-
# them
|
|
68
|
-
# the agents' time on the host in it: what to upgrade first, if anything.
|
|
61
|
+
# them.
|
|
69
62
|
#
|
|
70
63
|
# From the same marks, each wait on the model is kept too, as its start and
|
|
71
|
-
# end alone, by the reading it ended in.
|
|
72
|
-
# median of every wait kept. When slow waits came while the CPU, memory and
|
|
73
|
-
# disk were all below their limit, `host report` says the network may be the
|
|
74
|
-
# cause, and when they were at least a tenth of the period's waits, and no
|
|
75
|
-
# resource was the one to upgrade, its verdict is that the network was the
|
|
76
|
-
# limit.
|
|
64
|
+
# end alone, by the reading it ended in.
|
|
77
65
|
#
|
|
78
66
|
# A share's card, phase and step, a split's, a wait's, and a test run's card
|
|
79
67
|
# and repo, are the only text the readings hold, and only the values
|
|
@@ -1218,11 +1206,11 @@ host_day() {
|
|
|
1218
1206
|
|
|
1219
1207
|
# How the CPU, memory and disk were, over a period: how much of the time it
|
|
1220
1208
|
# was recorded, and how much of that each was at its limit. Time with no
|
|
1221
|
-
# reading is shown as missing, never as idle.
|
|
1222
|
-
#
|
|
1223
|
-
# the
|
|
1209
|
+
# reading is shown as missing, never as idle. Then come the steps, phases
|
|
1210
|
+
# and test runs that used the most (host_ranks_sql), and it ends with where
|
|
1211
|
+
# the steps' time went (host_split_sql).
|
|
1224
1212
|
host_report() {
|
|
1225
|
-
local period=${1:-7d} now start end n first last row works
|
|
1213
|
+
local period=${1:-7d} now start end n first last row works splits
|
|
1226
1214
|
[ "$#" -le 1 ] || die "$HOST_USAGE"
|
|
1227
1215
|
now=$(date +%s)
|
|
1228
1216
|
case $period in
|
|
@@ -1262,38 +1250,20 @@ host_report() {
|
|
|
1262
1250
|
say "Recording is on, and takes a reading every $HOST_EVERY seconds while an ocnus agent is open."
|
|
1263
1251
|
return 0
|
|
1264
1252
|
fi
|
|
1265
|
-
# A store the recorder has not opened since the
|
|
1266
|
-
# test runs and
|
|
1267
|
-
#
|
|
1268
|
-
#
|
|
1269
|
-
# the power state how many of its 3 columns it has. The report only reads
|
|
1270
|
-
# the store, so it never adds them, and leaves out what is missing.
|
|
1253
|
+
# A store the recorder has not opened since the cores, the shares, the
|
|
1254
|
+
# test runs and the splits came has none of them: one digit each, 1 for
|
|
1255
|
+
# what it has. The report only reads the store, so it never adds them, and
|
|
1256
|
+
# leaves out what is missing.
|
|
1271
1257
|
row=$(store "$HOST_DB" "select (select count(*) from pragma_table_info('readings') where name = 'cores')
|
|
1272
1258
|
|| (select count(*) from sqlite_master where type = 'table' and name = 'shares')
|
|
1273
1259
|
|| (select count(*) from sqlite_master where type = 'table' and name = 'test_runs')
|
|
1274
|
-
|| (select count(*) from sqlite_master where type = 'table' and name = '
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|| (select count(*) from pragma_table_info('test_runs') where name = 'cmd')
|
|
1280
|
-
|| (select count(*) from sqlite_master where type = 'table' and name = 'model_waits');") || row=
|
|
1281
|
-
works=0 runs=0 working=0 shared=0 splits=0 power=0 slower=0 waits=0
|
|
1282
|
-
case $row in ?1????????) works=1 ;; esac
|
|
1283
|
-
case $row in ??11??????) runs=1 ;; esac
|
|
1284
|
-
case $row in ????1?????) working=1 ;; esac
|
|
1285
|
-
case $row in ?1???1????) shared=1 ;; esac
|
|
1286
|
-
case $row in ?1????1???) splits=1 ;; esac
|
|
1287
|
-
case $row in ???????3??) power=1 ;; esac
|
|
1288
|
-
case $row in ????1???1?) slower=1 ;; esac
|
|
1289
|
-
case $row in ?????????1) waits=1 ;; esac
|
|
1290
|
-
case $row in 111???????) row=1 ;; *) row=0 ;; esac
|
|
1260
|
+
|| (select count(*) from sqlite_master where type = 'table' and name = 'splits');") || row=
|
|
1261
|
+
works=0 splits=0
|
|
1262
|
+
case $row in ?1??) works=1 ;; esac
|
|
1263
|
+
case $row in ?1?1) splits=1 ;; esac
|
|
1264
|
+
case $row in 111?) row=1 ;; *) row=0 ;; esac
|
|
1291
1265
|
store "$HOST_DB" "$(host_report_sql "$start" "$end" "$period" "$row")" ||
|
|
1292
1266
|
die "could not read $HOST_DB"
|
|
1293
|
-
store "$HOST_DB" "$(host_working_sql "$start" "$end" "$working" "$slower")" ||
|
|
1294
|
-
die "could not read $HOST_DB"
|
|
1295
|
-
store "$HOST_DB" "$(host_peaks_sql "$start" "$end" "$works" "$runs" "$shared")" ||
|
|
1296
|
-
die "could not read $HOST_DB"
|
|
1297
1267
|
if [ "$row" = 1 ]; then
|
|
1298
1268
|
store "$HOST_DB" "$(host_ranks_sql "$start" "$end")" || die "could not read $HOST_DB"
|
|
1299
1269
|
else
|
|
@@ -1301,7 +1271,6 @@ host_report() {
|
|
|
1301
1271
|
say 'No step, phase or test run was recorded in this period.'
|
|
1302
1272
|
fi
|
|
1303
1273
|
store "$HOST_DB" "$(host_split_sql "$start" "$end" "$works" "$splits")" || die "could not read $HOST_DB"
|
|
1304
|
-
store "$HOST_DB" "$(host_verdict_sql "$start" "$end" "$splits" "$power" "$waits")" || die "could not read $HOST_DB"
|
|
1305
1274
|
}
|
|
1306
1275
|
|
|
1307
1276
|
# The report's query, for the period from $1 to $2, named $3. A reading
|
|
@@ -1366,178 +1335,6 @@ select line from lines order by n, k;
|
|
|
1366
1335
|
EOF
|
|
1367
1336
|
}
|
|
1368
1337
|
|
|
1369
|
-
# The agents working at once, from $1 to $2: for each number of agents
|
|
1370
|
-
# working that the readings counted, from none up, how long that many were
|
|
1371
|
-
# working, and how much of that time the CPU or the memory was at its limit,
|
|
1372
|
-
# as the report counts it. Each reading counts for the part of it in the
|
|
1373
|
-
# period. A reading from before the agents working were counted has no
|
|
1374
|
-
# count, and nor has any when $3 is not 1, as the store has no column for
|
|
1375
|
-
# them yet: it is left out, never counted as none working, and its time is
|
|
1376
|
-
# on a line of its own. Last, the fewest working at which the CPU or memory
|
|
1377
|
-
# was at its limit for at least a quarter of the time is named as the number
|
|
1378
|
-
# from which the host was the limit; or it says there is no such number, or
|
|
1379
|
-
# that no reading counted the agents working.
|
|
1380
|
-
#
|
|
1381
|
-
# Under each number from 2 up, with $4 as 1, which says the store has the
|
|
1382
|
-
# fingerprints of the test runs' commands, comes how much slower test runs
|
|
1383
|
-
# were than with one working. A test run that started in the period counts
|
|
1384
|
-
# at the number working that covers most of its time, over the readings
|
|
1385
|
-
# that counted them, and at the larger number on a tie. A run that was cut
|
|
1386
|
-
# short, is still going, has no fingerprint, as one from before they were
|
|
1387
|
-
# kept, or overlaps no reading with a count, is left out. A command is a
|
|
1388
|
-
# repo and a fingerprint, so only runs of the same command in the same repo
|
|
1389
|
-
# are set against each other, and a command counts at a number when it ran
|
|
1390
|
-
# at least 3 times with that many working and 3 times with one. Its ratio is
|
|
1391
|
-
# its runs' median time with that many working over their median time with
|
|
1392
|
-
# one, and the figure is the median of the commands' ratios, so one odd run,
|
|
1393
|
-
# such as one that failed early, does not move it. With no such command, it
|
|
1394
|
-
# says it cannot tell yet.
|
|
1395
|
-
host_working_sql() {
|
|
1396
|
-
local s=$1 e=$2 working=working slower=0 runs='select null, null, null, null, null where 0' counted=null
|
|
1397
|
-
[ "${3:-0}" = 1 ] || working=null
|
|
1398
|
-
if [ "$working" = working ] && [ "${4:-0}" = 1 ]; then
|
|
1399
|
-
slower=1 counted=g.working
|
|
1400
|
-
runs="select id, repo, cmd, started, secs from test_runs
|
|
1401
|
-
where started >= $s and started < $e and ended is not null and cut = 0 and cmd is not null and secs is not null"
|
|
1402
|
-
fi
|
|
1403
|
-
cat <<EOF
|
|
1404
|
-
with
|
|
1405
|
-
parts(n, d, lim) as (
|
|
1406
|
-
select $working, max(0, min(at, $e) - max(at - secs, $s)), coalesce(cpu_busy >= 90 or mem_pressure >= 2, 0)
|
|
1407
|
-
from readings where at > $s and at < $e + $HOST_GAP and at - secs < $e),
|
|
1408
|
-
counts(n, len, lim) as (
|
|
1409
|
-
select n, sum(d), sum(case when lim then d else 0 end) from parts where n is not null group by n),
|
|
1410
|
-
uncounted(len) as (select coalesce(sum(d), 0) from parts where n is null),
|
|
1411
|
-
fewest(n) as (select min(n) from counts where len > 0 and 4 * lim >= len),
|
|
1412
|
-
runs(id, repo, cmd, started, secs) as ($runs),
|
|
1413
|
-
-- A cross join keeps the runs outside, so that each one looks up only its
|
|
1414
|
-
-- own readings by their at, never every reading for each run.
|
|
1415
|
-
over(id, n, d) as (
|
|
1416
|
-
select r.id, $counted, sum(max(0, min(g.at, r.started + r.secs) - max(g.at - g.secs, r.started)))
|
|
1417
|
-
from runs r cross join readings g
|
|
1418
|
-
on g.at > r.started and g.at < r.started + r.secs + $HOST_GAP and g.at - g.secs < r.started + r.secs
|
|
1419
|
-
where $counted is not null group by r.id, $counted),
|
|
1420
|
-
at_n(id, n) as (
|
|
1421
|
-
select id, n from (select id, n, row_number() over (partition by id order by d desc, n desc) k from over) where k = 1),
|
|
1422
|
-
timed(repo, cmd, n, secs, i, c) as (
|
|
1423
|
-
select r.repo, r.cmd, a.n, r.secs, row_number() over (partition by r.repo, r.cmd, a.n order by r.secs),
|
|
1424
|
-
count(*) over (partition by r.repo, r.cmd, a.n)
|
|
1425
|
-
from runs r join at_n a on a.id = r.id),
|
|
1426
|
-
medians(repo, cmd, n, runs, secs) as (
|
|
1427
|
-
select repo, cmd, n, max(c), avg(secs) from timed where i in ((c + 1) / 2, (c + 2) / 2) group by repo, cmd, n),
|
|
1428
|
-
ratios(n, ratio, runs, base, i, c) as (
|
|
1429
|
-
select m.n, m.secs / b.secs, m.runs, b.runs, row_number() over (partition by m.n order by m.secs / b.secs),
|
|
1430
|
-
count(*) over (partition by m.n)
|
|
1431
|
-
from medians m join medians b on b.repo = m.repo and b.cmd = m.cmd and b.n = 1
|
|
1432
|
-
where m.n >= 2 and m.runs >= 3 and b.runs >= 3 and b.secs > 0),
|
|
1433
|
-
slower(n, ratio) as (select n, avg(ratio) from ratios where i in ((c + 1) / 2, (c + 2) / 2) group by n),
|
|
1434
|
-
rested(n, cmds, runs, base) as (select n, count(*), sum(runs), sum(base) from ratios group by n),
|
|
1435
|
-
lines(part, n, o, line) as (
|
|
1436
|
-
select 0, 0, 0, ''
|
|
1437
|
-
union all select 0, 1, 0, 'Agents working at once:'
|
|
1438
|
-
union all
|
|
1439
|
-
select 1, n, 0, ' ' || printf('%-11s', n || ' working') || ' ' || $(sql_took len) || ', CPU or memory at its limit '
|
|
1440
|
-
|| $(sql_took lim) || ', ' || printf('%.1f%%', 100.0 * lim / nullif(len, 0)) || ' of it'
|
|
1441
|
-
from counts
|
|
1442
|
-
union all
|
|
1443
|
-
select 1, c.n, 1, ' test runs' || case when s.ratio is null
|
|
1444
|
-
then ': cannot tell yet, as no command ran at least 3 times with ' || c.n || ' working and 3 times with 1'
|
|
1445
|
-
else ' ' || case when s.ratio >= 1 then printf('%.0f%% slower', 100.0 * (s.ratio - 1))
|
|
1446
|
-
else printf('%.0f%% faster', 100.0 * (1 - s.ratio)) end
|
|
1447
|
-
|| ' than with 1 working, from ' || r.runs || ' runs of ' || r.cmds || case when r.cmds = 1 then ' command' else ' commands' end
|
|
1448
|
-
|| ' against ' || r.base || ' with 1 working' end
|
|
1449
|
-
from counts c left join slower s on s.n = c.n left join rested r on r.n = c.n
|
|
1450
|
-
where c.n >= 2 and $slower
|
|
1451
|
-
union all
|
|
1452
|
-
select 2, 0, 0, ' not counted ' || $(sql_took len) || ', by readings from before the agents working were counted'
|
|
1453
|
-
from uncounted where len > 0
|
|
1454
|
-
union all
|
|
1455
|
-
select 3, 0, 0, case
|
|
1456
|
-
when not exists (select 1 from counts) then ' No reading in this period counted the agents working.'
|
|
1457
|
-
when n is null then ' The host was not the limit at any number of working agents in this period: at each, the CPU or memory was at its limit for under a quarter of the time.'
|
|
1458
|
-
else ' The host was the limit from ' || n || ' working ' || case when n = 1 then 'agent' else 'agents' end
|
|
1459
|
-
|| ': the fewest at which the CPU or memory was at its limit for at least a quarter of the time.' end
|
|
1460
|
-
from fewest)
|
|
1461
|
-
select line from lines order by part, n, o;
|
|
1462
|
-
EOF
|
|
1463
|
-
}
|
|
1464
|
-
|
|
1465
|
-
# The longest stretches from $1 to $2 when the CPU or the memory was at its
|
|
1466
|
-
# limit, as the report counts it, five at most, longest first. A stretch is
|
|
1467
|
-
# readings in a row at the limit, each starting where the one before ended,
|
|
1468
|
-
# and each counts for the part of it in the period, as the report counts a
|
|
1469
|
-
# reading. Each says when it started, how long it lasted and which of the
|
|
1470
|
-
# two was at its limit, then the work going in it: each card's step, or its
|
|
1471
|
-
# phase when its card is in none, from the shares when $3 is 1, then each
|
|
1472
|
-
# test run, from their shares when $4 is 1. Each has its share of all cores
|
|
1473
|
-
# over the stretch, its share in each reading counted for that reading's
|
|
1474
|
-
# part, and the most memory it held in one reading. Each card also has how
|
|
1475
|
-
# much of the stretch its agent was working: the parts of the readings in
|
|
1476
|
-
# which a share of its was working, over the stretch's length. With $5 not 1,
|
|
1477
|
-
# the shares have no column for it, and with no share that says, as from
|
|
1478
|
-
# before the agents working were told apart, it says it was not read. A
|
|
1479
|
-
# share that names no card is left out. With no stretch, it says the host was
|
|
1480
|
-
# never at its limit.
|
|
1481
|
-
host_peaks_sql() {
|
|
1482
|
-
local s=$1 e=$2 shares runs
|
|
1483
|
-
shares='select at, card, phase, step, cpu, mem_mb, working from shares'
|
|
1484
|
-
[ "${5:-0}" = 1 ] || shares='select at, card, phase, step, cpu, mem_mb, null from shares'
|
|
1485
|
-
[ "${3:-0}" = 1 ] || shares='select null, null, null, null, null, null, null where 0'
|
|
1486
|
-
runs='select r.at, r.run, t.card, t.repo, t.started, r.cpu, r.mem_mb from run_shares r join test_runs t on t.id = r.run'
|
|
1487
|
-
[ "${4:-0}" = 1 ] || runs='select null, null, null, null, null, null, null where 0'
|
|
1488
|
-
cat <<EOF
|
|
1489
|
-
with
|
|
1490
|
-
lim(at, start, d, cpu, mem, new) as (
|
|
1491
|
-
select at, max(at - secs, $s), max(0, min(at, $e) - max(at - secs, $s)),
|
|
1492
|
-
coalesce(cpu_busy >= 90, 0), coalesce(mem_pressure >= 2, 0),
|
|
1493
|
-
case when lag(at) over (order by at) = at - secs then 0 else 1 end
|
|
1494
|
-
from readings
|
|
1495
|
-
where at > $s and at < $e + $HOST_GAP and at - secs < $e and (cpu_busy >= 90 or mem_pressure >= 2)),
|
|
1496
|
-
grouped(at, start, d, cpu, mem, n) as (
|
|
1497
|
-
select at, start, d, cpu, mem, sum(new) over (order by at rows between unbounded preceding and current row) from lim),
|
|
1498
|
-
stretches(n, start, len, cpu, mem) as (
|
|
1499
|
-
select n, min(start), sum(d), max(cpu), max(mem) from grouped group by n),
|
|
1500
|
-
ranked(k, n, start, len, cpu, mem) as (
|
|
1501
|
-
select row_number() over (order by len desc, start), n, start, len, cpu, mem from stretches),
|
|
1502
|
-
top(k, n, start, len, cpu, mem) as (select k, n, start, len, cpu, mem from ranked where k <= 5),
|
|
1503
|
-
parts(k, len, at, d) as (select t.k, t.len, g.at, g.d from top t join grouped g on g.n = t.n),
|
|
1504
|
-
sh(at, card, phase, step, cpu, mem, working) as ($shares),
|
|
1505
|
-
rs(at, run, card, repo, started, cpu, mem) as ($runs),
|
|
1506
|
-
cards(k, len, at, d, name, cpu, mem, working) as (
|
|
1507
|
-
select p.k, p.len, p.at, p.d, sh.card || ' ' || coalesce(sh.step || ' step', sh.phase || ' phase'), sum(sh.cpu), sum(sh.mem),
|
|
1508
|
-
max(sh.working)
|
|
1509
|
-
from parts p join sh on sh.at = p.at
|
|
1510
|
-
where sh.card is not null and coalesce(sh.step, sh.phase) is not null
|
|
1511
|
-
group by p.k, p.at, sh.card, sh.step, sh.phase),
|
|
1512
|
-
work(k, part, name, cpu, mem, working) as (
|
|
1513
|
-
select k, 1, name, sum(1.0 * cpu * d) / len, max(mem),
|
|
1514
|
-
case when count(working) > 0 then 100.0 * sum(case when working = 1 then d else 0 end) / len end
|
|
1515
|
-
from cards group by k, name
|
|
1516
|
-
union all
|
|
1517
|
-
select p.k, 2, rs.card || ' ' || rs.repo || ' test run ' || strftime('%Y-%m-%d %H:%M', rs.started, 'unixepoch', 'localtime'),
|
|
1518
|
-
sum(1.0 * rs.cpu * p.d) / p.len, max(rs.mem), null
|
|
1519
|
-
from parts p join rs on rs.at = p.at group by p.k, rs.run),
|
|
1520
|
-
lines(k, part, o, line) as (
|
|
1521
|
-
select -1, 0, 0, ''
|
|
1522
|
-
union all select 0, 0, 0, 'Longest stretches with CPU or memory at its limit:' where exists (select 1 from top)
|
|
1523
|
-
union all select 0, 0, 0, 'The host was never at its limit for CPU or memory in this period.' where not exists (select 1 from top)
|
|
1524
|
-
union all
|
|
1525
|
-
select k, 0, 0, ' ' || strftime('%Y-%m-%d %H:%M:%S', start, 'unixepoch', 'localtime') || ' for ' || $(sql_took len) || ', '
|
|
1526
|
-
|| case when cpu and mem then 'CPU and memory at their limit' when cpu then 'CPU at its limit' else 'memory at its limit' end
|
|
1527
|
-
from top
|
|
1528
|
-
union all
|
|
1529
|
-
select k, part, row_number() over (partition by k, part order by cpu desc, name),
|
|
1530
|
-
' ' || printf('%-44s', name) || ' ' || case when cpu is null then 'CPU not read' else 'CPU ' || printf('%.1f%%', cpu) end
|
|
1531
|
-
|| ', ' || case when mem is null then 'memory not read' else 'memory ' || mem || ' MB' end
|
|
1532
|
-
|| case when part = 2 then '' when working is null then ', working not read'
|
|
1533
|
-
else ', working ' || printf('%.0f%%', working) || ' of it' end
|
|
1534
|
-
from work
|
|
1535
|
-
union all
|
|
1536
|
-
select k, 3, 0, ' no card or test run was going' from top t where not exists (select 1 from work w where w.k = t.k))
|
|
1537
|
-
select line from lines order by k, part, o;
|
|
1538
|
-
EOF
|
|
1539
|
-
}
|
|
1540
|
-
|
|
1541
1338
|
# The steps and the phases that used the most CPU time, and that held the
|
|
1542
1339
|
# most memory at once, from $1 to $2: ten of each, each one card's own. Each
|
|
1543
1340
|
# counts what its shares say for the part of their reading in the period,
|
|
@@ -1663,133 +1460,6 @@ select line from lines order by k;
|
|
|
1663
1460
|
EOF
|
|
1664
1461
|
}
|
|
1665
1462
|
|
|
1666
|
-
# The verdict on the host from $1 to $2, from the splits when $3 is 1, and
|
|
1667
|
-
# the power state of the readings when $4 is 1, and the waits on the model
|
|
1668
|
-
# when $5 is 1: the report's last line, after the network line when there
|
|
1669
|
-
# is one.
|
|
1670
|
-
#
|
|
1671
|
-
# A wait on the model is slow when it took over twice the median of every
|
|
1672
|
-
# wait in model_waits, so 90 days at most: the wait halfway in order of
|
|
1673
|
-
# length, the later of the two for an even count. A slow wait counts for the
|
|
1674
|
-
# network when there is a reading over it, and every reading over it, in
|
|
1675
|
-
# whole or in part, had the CPU, memory and disk below their limit, as the
|
|
1676
|
-
# report counts it. The period's waits are those that ended in it. With any
|
|
1677
|
-
# that count, the network line, between blank lines, says the network may
|
|
1678
|
-
# be the cause: how many of the period's waits were slow while the host was
|
|
1679
|
-
# below its limit, and the median. A store with no waits on the model has
|
|
1680
|
-
# none.
|
|
1681
|
-
#
|
|
1682
|
-
# The agents' time on the host is their splits' seconds on the host, an
|
|
1683
|
-
# agent's second each, each split counted for the part of its reading in the
|
|
1684
|
-
# period, as the report counts a reading. The verdict is the first of these
|
|
1685
|
-
# that holds:
|
|
1686
|
-
# - too little data yet, with under HOST_VERDICT_STEPS steps with a split
|
|
1687
|
-
# in the period, each one card's own, or under HOST_VERDICT_SECS of the
|
|
1688
|
-
# agents' time on the host. It says how many and how long, against them.
|
|
1689
|
-
# - of the CPU, memory and disk, the one at its limit, as the report counts
|
|
1690
|
-
# it, for the most of the agents' time on the host, and for at least
|
|
1691
|
-
# HOST_VERDICT_PCT% of it, the CPU before memory before the disk when two
|
|
1692
|
-
# were as long: the power state was the limit, when over half of that
|
|
1693
|
-
# one's time at its limit was on battery, in Low Power Mode or with the
|
|
1694
|
-
# thermal state at serious or critical, and otherwise it is the one to
|
|
1695
|
-
# upgrade first.
|
|
1696
|
-
# - the network was the limit, when the waits that count for it are at
|
|
1697
|
-
# least HOST_VERDICT_PCT% of the period's waits on the model. It gives
|
|
1698
|
-
# that share and the median.
|
|
1699
|
-
# - no upgrade is needed.
|
|
1700
|
-
# All but the first say how much of the agents' time on the host each was at
|
|
1701
|
-
# its limit. A store with no splits has too little data, and one whose
|
|
1702
|
-
# readings have no power state counts them as on power, as a reading with
|
|
1703
|
-
# none of it does.
|
|
1704
|
-
HOST_VERDICT_STEPS=10
|
|
1705
|
-
HOST_VERDICT_SECS=3600
|
|
1706
|
-
HOST_VERDICT_PCT=10
|
|
1707
|
-
host_verdict_sql() {
|
|
1708
|
-
local s=$1 e=$2 splits power waits took median
|
|
1709
|
-
splits='select at, card, step, host_secs from splits'
|
|
1710
|
-
[ "${3:-0}" = 1 ] || splits='select null, null, null, null where 0'
|
|
1711
|
-
power='coalesce(on_battery = 1 or low_power = 1 or thermal >= 2, 0)'
|
|
1712
|
-
[ "${4:-0}" = 1 ] || power=0
|
|
1713
|
-
waits='select ended - started, started, ended from model_waits'
|
|
1714
|
-
[ "${5:-0}" = 1 ] || waits='select null, null, null where 0'
|
|
1715
|
-
took=$(sql_took 'cast(round(t.host) as integer)')
|
|
1716
|
-
# A median under a minute is given to a tenth of a second.
|
|
1717
|
-
median="case when m < 59.95 then printf('%.1fs', m) else $(sql_took 'cast(round(m) as integer)') end"
|
|
1718
|
-
cat <<EOF
|
|
1719
|
-
with
|
|
1720
|
-
parts(at, secs, d, cpu, mem, disk, power) as (
|
|
1721
|
-
select at, secs, max(0, min(at, $e) - max(at - secs, $s)),
|
|
1722
|
-
coalesce(cpu_busy >= 90, 0), coalesce(mem_pressure >= 2, 0), coalesce(disk_free_pct < 10, 0), $power
|
|
1723
|
-
from readings where at > $s and at < $e + $HOST_GAP and at - secs < $e and secs > 0),
|
|
1724
|
-
x(at, card, step, host) as ($splits),
|
|
1725
|
-
sp(card, step, host, cpu, mem, disk, power) as (
|
|
1726
|
-
select x.card, x.step, 1.0 * coalesce(x.host, 0) * p.d / p.secs, p.cpu, p.mem, p.disk, p.power
|
|
1727
|
-
from parts p join x on x.at = p.at),
|
|
1728
|
-
total(steps, host) as (
|
|
1729
|
-
select (select count(*) from (select distinct card, step from sp where card is not null and step is not null)),
|
|
1730
|
-
coalesce(sum(host), 0) from sp),
|
|
1731
|
-
res(o, name, lim, pow) as (
|
|
1732
|
-
select 1, 'the CPU', coalesce(sum(case when cpu then host end), 0), coalesce(sum(case when cpu and power then host end), 0) from sp
|
|
1733
|
-
union all
|
|
1734
|
-
select 2, 'memory', coalesce(sum(case when mem then host end), 0), coalesce(sum(case when mem and power then host end), 0) from sp
|
|
1735
|
-
union all
|
|
1736
|
-
select 3, 'the disk', coalesce(sum(case when disk then host end), 0), coalesce(sum(case when disk and power then host end), 0) from sp),
|
|
1737
|
-
pcts(cpu, mem, disk) as (
|
|
1738
|
-
select max(case when o = 1 then pct end), max(case when o = 2 then pct end), max(case when o = 3 then pct end)
|
|
1739
|
-
from (select o, printf('%.1f%%', 100.0 * lim / nullif(t.host, 0)) pct from res, total t)),
|
|
1740
|
-
named(o, name, lim, pow) as (
|
|
1741
|
-
select o, name, lim, pow from res, total t
|
|
1742
|
-
where lim > 0 and 100.0 * lim >= $HOST_VERDICT_PCT * t.host order by lim desc, o limit 1),
|
|
1743
|
-
w(d, started, ended) as ($waits),
|
|
1744
|
-
med(m) as (select d from w order by d limit 1 offset (select count(*) / 2 from w)),
|
|
1745
|
-
inp(d, started, ended) as (select d, started, ended from w where ended >= $s and ended < $e),
|
|
1746
|
-
slow(started, ended) as (select i.started, i.ended from inp i, med where i.d > 2 * med.m),
|
|
1747
|
-
span(secs) as (select coalesce(max(secs), 0) from readings),
|
|
1748
|
-
below(n) as (
|
|
1749
|
-
select count(*) from slow, span
|
|
1750
|
-
where exists (select 1 from readings r
|
|
1751
|
-
where r.at > slow.started and r.at < slow.ended + span.secs and r.at - r.secs < slow.ended)
|
|
1752
|
-
and not exists (select 1 from readings r
|
|
1753
|
-
where r.at > slow.started and r.at < slow.ended + span.secs and r.at - r.secs < slow.ended
|
|
1754
|
-
and (coalesce(r.cpu_busy >= 90, 0) or coalesce(r.mem_pressure >= 2, 0) or coalesce(r.disk_free_pct < 10, 0)))),
|
|
1755
|
-
net(n, total, median) as (select b.n, (select count(*) from inp), $median from below b, med),
|
|
1756
|
-
lines(k, line) as (
|
|
1757
|
-
select 0, ''
|
|
1758
|
-
union all
|
|
1759
|
-
select 1, 'The network may be the cause: ' || n || ' of ' || total || case when total = 1 then ' wait' else ' waits' end
|
|
1760
|
-
|| ' on the model ' || case when n = 1 then 'was' else 'were' end || ' slow (over twice the median of ' || median
|
|
1761
|
-
|| ') while CPU, memory and disk were below their limit.'
|
|
1762
|
-
from net where n > 0
|
|
1763
|
-
union all
|
|
1764
|
-
select 2, '' from net where n > 0
|
|
1765
|
-
union all
|
|
1766
|
-
select 3, 'Verdict: ' || case
|
|
1767
|
-
when t.steps < $HOST_VERDICT_STEPS or t.host < $HOST_VERDICT_SECS then
|
|
1768
|
-
'too little data yet: ' || t.steps || case when t.steps = 1 then ' step had its' else ' steps had their' end
|
|
1769
|
-
|| ' time split, with ' || $took || ' of the agents'' time on the host, and a verdict takes at least '
|
|
1770
|
-
|| '$HOST_VERDICT_STEPS steps and ' || $(sql_took $HOST_VERDICT_SECS) || '.'
|
|
1771
|
-
when f.o is not null then
|
|
1772
|
-
case when 2 * f.pow > f.lim then 'the power state was the limit, not ' || f.name else 'upgrade ' || f.name || ' first' end
|
|
1773
|
-
|| ': it was at its limit for ' || printf('%.1f%%', 100.0 * f.lim / t.host) || ' of the agents'' ' || $took || ' on the host'
|
|
1774
|
-
|| case when 2 * f.pow > f.lim then ', ' || printf('%.1f%%', 100.0 * f.pow / f.lim)
|
|
1775
|
-
|| ' of that on battery, in Low Power Mode or with the thermal state at serious or critical' else '' end
|
|
1776
|
-
|| ' (' || case f.o when 1 then 'memory ' || p.mem || ', disk ' || p.disk
|
|
1777
|
-
when 2 then 'CPU ' || p.cpu || ', disk ' || p.disk else 'CPU ' || p.cpu || ', memory ' || p.mem end || ').'
|
|
1778
|
-
when nt.n > 0 and 100 * nt.n >= $HOST_VERDICT_PCT * nt.total then
|
|
1779
|
-
'the network was the limit: ' || printf('%.1f%%', 100.0 * nt.n / nt.total) || ' of the ' || nt.total
|
|
1780
|
-
|| case when nt.total = 1 then ' wait on the model was' else ' waits on the model were' end
|
|
1781
|
-
|| ' slow (over twice the median of ' || nt.median || ') while CPU, memory and disk were below their limit,'
|
|
1782
|
-
|| ' and each was at its limit for under $HOST_VERDICT_PCT% of the agents'' ' || $took
|
|
1783
|
-
|| ' on the host (CPU ' || p.cpu || ', memory ' || p.mem || ', disk ' || p.disk || ').'
|
|
1784
|
-
else
|
|
1785
|
-
'no upgrade is needed: CPU, memory and disk were each at their limit for under $HOST_VERDICT_PCT% of the agents'' '
|
|
1786
|
-
|| $took || ' on the host (CPU ' || p.cpu || ', memory ' || p.mem || ', disk ' || p.disk || ').'
|
|
1787
|
-
end
|
|
1788
|
-
from total t left join named f on 1 left join pcts p on 1 left join net nt on 1)
|
|
1789
|
-
select line from lines order by k;
|
|
1790
|
-
EOF
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
1463
|
cmd_host() {
|
|
1794
1464
|
case ${1:-} in
|
|
1795
1465
|
'') [ "$#" -le 1 ] || die "$HOST_USAGE"; host_show ;;
|
package/cli/lib/tests.sh
CHANGED
|
@@ -107,9 +107,8 @@ tests_set() {
|
|
|
107
107
|
# readings is there too. The job's row goes in test_runs as it starts, with
|
|
108
108
|
# its card, repo, start and the job's pid, and the fingerprint of its
|
|
109
109
|
# command, cmd: the first 15 hex digits of the SHA-256 of its arguments, each
|
|
110
|
-
# ended by a NUL, as a number. It is the same for the same command,
|
|
111
|
-
#
|
|
112
|
-
# each other, and the command's text cannot be read back from it. It is all
|
|
110
|
+
# ended by a NUL, as a number. It is the same for the same command,
|
|
111
|
+
# and the command's text cannot be read back from it. It is all
|
|
113
112
|
# that is kept of the command line. While the job runs, the sampler adds up
|
|
114
113
|
# the memory of its processes every second, and writes the most it saw to
|
|
115
114
|
# the row. When the job ends, the row gets its end and the figures, and what
|
package/cli/ocnus
CHANGED
|
@@ -92,15 +92,11 @@ Usage:
|
|
|
92
92
|
ocnus host say whether how hard this machine works is recorded
|
|
93
93
|
ocnus host on record it every 10 seconds while an agent is open
|
|
94
94
|
ocnus host off stop recording, and delete every reading
|
|
95
|
-
ocnus host report [<period>] how often CPU, memory and disk were at their limit,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
time went, whether the network may be the cause of slow
|
|
101
|
-
waits on the model, and a verdict on what to upgrade first:
|
|
102
|
-
<n>d or <n>h back from now (7d when none is given), a day
|
|
103
|
-
YYYY-MM-DD, or <day>..<day>
|
|
95
|
+
ocnus host report [<period>] how often CPU, memory and disk were at their limit, the
|
|
96
|
+
steps, phases and test runs that used the most CPU and
|
|
97
|
+
memory, and where the steps' time went: <n>d or <n>h back
|
|
98
|
+
from now (7d when none is given), a day YYYY-MM-DD, or
|
|
99
|
+
<day>..<day>
|
|
104
100
|
ocnus help
|
|
105
101
|
|
|
106
102
|
A space groups repos that belong together, with a SPACE.md saying what
|
|
@@ -296,20 +292,9 @@ at their limit: CPU at least 90% busy across all cores, memory pressure at
|
|
|
296
292
|
warning or critical, and under 10% of the home folder's disk free. Time with
|
|
297
293
|
no reading, such as when no agent was open, is shown as missing, never as
|
|
298
294
|
idle. It also says how much of the CPU recording used, watching the test
|
|
299
|
-
runs included.
|
|
300
|
-
that
|
|
301
|
-
|
|
302
|
-
the time, as the number from which the host was the limit. For each number
|
|
303
|
-
from 2 up, it says how much slower test runs were than with one working,
|
|
304
|
-
setting only runs of the same command in the same repo against each other,
|
|
305
|
-
once a command has run at least 3 times with each; until then, it says it
|
|
306
|
-
cannot tell yet. It names the 5 longest stretches when CPU or memory was at
|
|
307
|
-
its limit, each with when it started, how long it lasted, which was at its
|
|
308
|
-
limit, and every card's step and every test run going then, with its share
|
|
309
|
-
of the CPU and the most memory it held, and for each card how much of the
|
|
310
|
-
stretch its agent was working. Then it lists the 10 steps and the 10
|
|
311
|
-
phases, each one card's own, that used the most CPU time, and that held the
|
|
312
|
-
most memory at once, then the 10 test runs that did.
|
|
295
|
+
runs included. Then it lists the 10 steps and the 10 phases, each one
|
|
296
|
+
card's own, that used the most CPU time, and that held the most memory at
|
|
297
|
+
once, then the 10 test runs that did.
|
|
313
298
|
|
|
314
299
|
While the host is recorded, `task new` and `task build` also start claude
|
|
315
300
|
with hooks that mark when its agent starts and stops, is given a prompt,
|
|
@@ -323,22 +308,7 @@ same for the 10 steps open longest, and how many steps had no split, as an
|
|
|
323
308
|
agent started in another harness or while recording was off has none.
|
|
324
309
|
|
|
325
310
|
Each wait on the model is kept too, as its start and end alone, for 90
|
|
326
|
-
days.
|
|
327
|
-
kept. When waits in the period were slow while CPU, memory and disk were
|
|
328
|
-
all below their limit, `host report` says the network may be the cause,
|
|
329
|
-
with how many were slow and the median.
|
|
330
|
-
|
|
331
|
-
Last, `host report` gives its verdict, one line with its numbers. With
|
|
332
|
-
fewer than 10 steps with their time split in the period, or under an hour
|
|
333
|
-
of the agents' time on the host, the time their tools ran, there is too
|
|
334
|
-
little data yet. Otherwise, of CPU, memory and disk, the one at its limit
|
|
335
|
-
for the most of the agents' time on the host, when that is at least 10% of
|
|
336
|
-
it, is the one to upgrade first, unless over half of its time at its limit
|
|
337
|
-
was on battery, in Low Power Mode or with the thermal state at serious or
|
|
338
|
-
critical: then the power state was the limit. With none at 10%, the network
|
|
339
|
-
was the limit when at least 10% of the period's waits on the model were
|
|
340
|
-
slow while CPU, memory and disk were below their limit, and otherwise no
|
|
341
|
-
upgrade is needed.
|
|
311
|
+
days.
|
|
342
312
|
|
|
343
313
|
`tests run <command> [<arg>...]` runs a repo's test command, whole suite or
|
|
344
314
|
part, as in `ocnus tests run npm test`: its output goes straight
|
package/herdr/README.md
CHANGED
|
@@ -1655,7 +1655,7 @@ turn it on, and works on macOS only.
|
|
|
1655
1655
|
ocnus host # whether recording is on, and what it has
|
|
1656
1656
|
ocnus host on # turn recording on
|
|
1657
1657
|
ocnus host off # turn it off, and delete every reading
|
|
1658
|
-
ocnus host report [<period>] # how often CPU, memory and disk were at their limit,
|
|
1658
|
+
ocnus host report [<period>] # how often CPU, memory and disk were at their limit, what used the most, and where the steps' time went
|
|
1659
1659
|
ocnus tests run <command> # run a test command, and record the test run
|
|
1660
1660
|
```
|
|
1661
1661
|
|
|
@@ -1884,8 +1884,7 @@ ocnus tests run <command> # run a test command, and record the test run
|
|
|
1884
1884
|
- **The fingerprint of its command.** Before the job starts,
|
|
1885
1885
|
`/usr/bin/shasum -a 256` hashes the command's arguments, each ended by a
|
|
1886
1886
|
NUL, and the first 15 hex digits of the hash, as a number, are the run's
|
|
1887
|
-
`cmd`. The same arguments give the same number,
|
|
1888
|
-
runs of the same command in the same repo against each other, and the
|
|
1887
|
+
`cmd`. The same arguments give the same number, and the
|
|
1889
1888
|
command's text cannot be read back from it. It is all that is kept of
|
|
1890
1889
|
the command line. `shasum` runs as part of watching the run, so its CPU
|
|
1891
1890
|
is in the run's `watch_secs`; without it, `cmd` is empty and the run is
|
|
@@ -1999,68 +1998,6 @@ figures.
|
|
|
1999
1998
|
time no agent was open, as well as when the machine slept or recording was
|
|
2000
1999
|
off. A period with no readings at all says so.
|
|
2001
2000
|
|
|
2002
|
-
Then come the agents working at once, under `Agents working at once:`, to
|
|
2003
|
-
tell how many agents to run at once:
|
|
2004
|
-
|
|
2005
|
-
- **A line for each number of agents working** in the period, from none
|
|
2006
|
-
up: how long that many were working, and how long and how much of that
|
|
2007
|
-
time the CPU or the memory was at its limit. Each reading counts for the
|
|
2008
|
-
part of it in the period, as above.
|
|
2009
|
-
- **Readings from before the agents working were counted** hold no count.
|
|
2010
|
-
They are left out of these lines, never counted as none working, and
|
|
2011
|
-
their time is on a line of its own, `not counted`.
|
|
2012
|
-
- **How much slower test runs were.** Under each number from 2 up comes
|
|
2013
|
-
how much slower test runs were than with one agent working, as
|
|
2014
|
-
`test runs 30% slower than with 1 working, from 3 runs of 1 command
|
|
2015
|
-
against 3 with 1 working`, or as `faster` when they were faster:
|
|
2016
|
-
- **A test run counts at one number of agents working**: the one that
|
|
2017
|
-
covers most of its time, from when it started for as long as it took,
|
|
2018
|
-
over the readings that counted them, and the larger number on a tie. A
|
|
2019
|
-
run under 10 seconds, shorter than a reading, counts at the number of
|
|
2020
|
-
the reading that holds most of it. Runs that started in the period
|
|
2021
|
-
count, but a run cut short, one still going, one with no `cmd`, from
|
|
2022
|
-
before the fingerprints were kept, and one that overlaps no reading
|
|
2023
|
-
with a count of the agents working are left out.
|
|
2024
|
-
- **A command is a repo and a `cmd`**, so only runs of the same command
|
|
2025
|
-
in the same repo are set against each other. A command counts at a
|
|
2026
|
-
number when it ran at least 3 times with that many working and 3 times
|
|
2027
|
-
with one. Its ratio is the median time of its runs at that number over
|
|
2028
|
-
the median of its runs at one, and the figure is the median of those
|
|
2029
|
-
commands' ratios, with the runs and the commands it rests on, and the
|
|
2030
|
-
runs with one working. Medians keep one odd run, such as one that
|
|
2031
|
-
failed early, from moving the figure.
|
|
2032
|
-
- **With no such command**, it says it cannot tell yet for that number.
|
|
2033
|
-
- **A store from before the fingerprints** has no `cmd`, and the report
|
|
2034
|
-
leaves these lines out. It never alters the store: the next test run or
|
|
2035
|
-
recorder start adds the column.
|
|
2036
|
-
- **The last line names the number from which the host was the limit**:
|
|
2037
|
-
the fewest working at which the CPU or memory was at its limit for at
|
|
2038
|
-
least a quarter of the time. With no such number, it says the host was
|
|
2039
|
-
not the limit at any number of working agents in the period, and with no
|
|
2040
|
-
reading that counted them, it says so.
|
|
2041
|
-
|
|
2042
|
-
Then come the longest stretches when the CPU or the memory was at its limit:
|
|
2043
|
-
|
|
2044
|
-
- **A stretch** is readings in a row, each starting where the one before
|
|
2045
|
-
ended, each with the CPU or memory at its limit. A reading under the
|
|
2046
|
-
limit, or time with no reading, ends it. Each reading counts for the part
|
|
2047
|
-
of it in the period.
|
|
2048
|
-
- **The 5 longest** in the period are listed, longest first, or fewer when
|
|
2049
|
-
there are fewer. Each says when it started, how long it lasted, and
|
|
2050
|
-
whether the CPU, the memory or both were at their limit in it.
|
|
2051
|
-
- **Under each, the work going then**: every card, with its step, or its
|
|
2052
|
-
phase when its card was in none of that phase's steps, then every test
|
|
2053
|
-
run, by its card, its repo and when it started. Each has its share of all
|
|
2054
|
-
cores over the stretch, each reading's share counted for that reading's
|
|
2055
|
-
seconds, and the most memory it held in one reading. Each card also says
|
|
2056
|
-
for how much of the stretch its agent was working, as `working 50% of
|
|
2057
|
-
it`, or `working not read` for shares from before that was read. A share
|
|
2058
|
-
that names no card is left out, and a stretch with no card or test run
|
|
2059
|
-
going says so.
|
|
2060
|
-
- **With none**, the report says the host was never at its limit for CPU or
|
|
2061
|
-
memory in the period. Disk is not among the stretches: under 10% free is
|
|
2062
|
-
not caused by a moment's work.
|
|
2063
|
-
|
|
2064
2001
|
Then come the steps, the phases and the test runs that used the most:
|
|
2065
2002
|
|
|
2066
2003
|
- **The 10 steps and the 10 phases that used the most CPU time** in the
|
|
@@ -2094,66 +2031,6 @@ Then comes where the steps' time went:
|
|
|
2094
2031
|
With no split in the period, or a store made before the splits, the
|
|
2095
2032
|
report says no step was split.
|
|
2096
2033
|
|
|
2097
|
-
Then, after a blank line, it says whether the network may be the cause, as
|
|
2098
|
-
a slow wait on the model can be the network rather than the host:
|
|
2099
|
-
|
|
2100
|
-
- **A slow wait** took over twice the median of every wait in
|
|
2101
|
-
`model_waits`, so 90 days at most. The median is the wait halfway in order
|
|
2102
|
-
of length, the later of the two for an even count. A wait of exactly twice
|
|
2103
|
-
it is not slow.
|
|
2104
|
-
- **It counts for the network** when there is a reading over it, in whole or
|
|
2105
|
-
in part, and every reading over it had the CPU, memory and disk below
|
|
2106
|
-
their limit, as above. A slow wait with no reading over it does not count.
|
|
2107
|
-
- **The period's waits** are those that ended in it, whenever they started.
|
|
2108
|
-
- **With any that count**, it says how many of the period's waits on the
|
|
2109
|
-
model were slow while the host was below its limit, and the median, to a
|
|
2110
|
-
tenth of a second under a minute: `The network may be the cause: 14 of 412
|
|
2111
|
-
waits on the model were slow (over twice the median of 6.2s) while CPU,
|
|
2112
|
-
memory and disk were below their limit.` With none, or a store made before
|
|
2113
|
-
the waits on the model, it says nothing.
|
|
2114
|
-
- **It cannot tell a slow network from a slow model**: the line says only
|
|
2115
|
-
that the network may be the cause.
|
|
2116
|
-
|
|
2117
|
-
Last comes the verdict on the host, one line after a blank one, with the
|
|
2118
|
-
numbers behind it, so that money goes on what slows the agents' work on the
|
|
2119
|
-
host. It is the first of these that holds:
|
|
2120
|
-
|
|
2121
|
-
- **Too little data yet**, with fewer than 10 steps with their time split in
|
|
2122
|
-
the period, each one card's own, or under 1 hour of the agents' time on
|
|
2123
|
-
the host. It says how many steps and how long, against the 10 and the
|
|
2124
|
-
hour. With no split in the period, or a store made before the splits,
|
|
2125
|
-
both are none.
|
|
2126
|
-
- **The one to upgrade first**: of CPU, memory and disk, the one at its
|
|
2127
|
-
limit, as above, for the most of the agents' time on the host, when that
|
|
2128
|
-
is at least 10% of it; the CPU before memory, and memory before the disk,
|
|
2129
|
-
when two were at their limit as long. The line gives its share of the
|
|
2130
|
-
agents' time on the host, that time, and the other two's shares:
|
|
2131
|
-
`upgrade memory first: it was at its limit for 23.0% of the agents' 6h
|
|
2132
|
-
10m on the host (CPU 8.0%, disk 0.0%)`.
|
|
2133
|
-
- **The power state was the limit**, in place of an upgrade, when over half
|
|
2134
|
-
of that one's time at its limit was on battery, in Low Power Mode, or with
|
|
2135
|
-
the thermal state at serious or critical: plugging in, turning Low Power
|
|
2136
|
-
Mode off or letting the machine cool costs nothing. The line gives how
|
|
2137
|
-
much of that time it was, too. At exactly half it is an upgrade. A
|
|
2138
|
-
reading from before the power state was read counts as on power.
|
|
2139
|
-
- **The network was the limit**, when none of the three was at its limit
|
|
2140
|
-
for 10% of the agents' time on the host, and the slow waits that count for
|
|
2141
|
-
the network, as above, are at least 10% of the period's waits on the
|
|
2142
|
-
model: `the network was the limit: 12.0% of the 100 waits on the model
|
|
2143
|
-
were slow (over twice the median of 6.2s) while CPU, memory and disk were
|
|
2144
|
-
below their limit, and each was at its limit for under 10% of the agents'
|
|
2145
|
-
2h 46m on the host (CPU 0.0%, memory 4.0%, disk 0.0%)`. Then no host
|
|
2146
|
-
upgrade is bought that would not have helped. A store made before the
|
|
2147
|
-
waits on the model never has it.
|
|
2148
|
-
- **No upgrade is needed**, otherwise, with the three shares.
|
|
2149
|
-
|
|
2150
|
-
The agents' time on the host is the seconds their tools ran, from the
|
|
2151
|
-
splits, an agent's second each: two agents on the host for a second are two
|
|
2152
|
-
seconds of it. A reading counts for the verdict by the agents' time on the
|
|
2153
|
-
host in it, each split counted for the part of its reading in the period,
|
|
2154
|
-
so time at the limit while the agents waited on the model or on you, or
|
|
2155
|
-
with no split, counts for none of it.
|
|
2156
|
-
|
|
2157
2034
|
```
|
|
2158
2035
|
The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
|
|
2159
2036
|
recorded 9h 41m of 7d 00h
|
|
@@ -2166,15 +2043,6 @@ The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
|
|
|
2166
2043
|
By day:
|
|
2167
2044
|
...
|
|
2168
2045
|
|
|
2169
|
-
Longest stretches with CPU or memory at its limit:
|
|
2170
|
-
2026-11-29 14:02:40 for 12m 30s, CPU at its limit
|
|
2171
|
-
LAB-150 build step CPU 61.4%, memory 3412 MB
|
|
2172
|
-
LAB-151 write-up phase CPU 4.2%, memory 1204 MB
|
|
2173
|
-
LAB-150 ocnus test run 2026-11-29 14:02 CPU 52.8%, memory 1830 MB
|
|
2174
|
-
2026-11-28 10:41:10 for 4m 20s, CPU and memory at their limit
|
|
2175
|
-
LAB-149 review step CPU 48.0%, memory 1890 MB
|
|
2176
|
-
LAB-149 ocnus test run 2026-11-28 10:41 CPU 41.5%, memory 1795 MB
|
|
2177
|
-
|
|
2178
2046
|
Steps that used the most CPU time:
|
|
2179
2047
|
LAB-150 build step CPU time 1h 12m, ran 2h 40m
|
|
2180
2048
|
LAB-149 review step CPU time 22m 05s, ran 51m 10s
|
|
@@ -2199,10 +2067,6 @@ Where the steps' time went:
|
|
|
2199
2067
|
LAB-150 build step open 2h 40m: on the host 51m 20s, waiting on the model 1h 22m, the rest 26m 40s
|
|
2200
2068
|
LAB-149 review step open 51m 10s: on the host 10m 40s, waiting on the model 27m 00s, the rest 13m 30s
|
|
2201
2069
|
1 step had no split, as an agent's time is split only when it starts in Claude Code while recording is on
|
|
2202
|
-
|
|
2203
|
-
The network may be the cause: 14 of 412 waits on the model were slow (over twice the median of 6.2s) while CPU, memory and disk were below their limit.
|
|
2204
|
-
|
|
2205
|
-
Verdict: too little data yet: 2 steps had their time split, with 1h 02m of the agents' time on the host, and a verdict takes at least 10 steps and 1h 00m.
|
|
2206
2070
|
```
|
|
2207
2071
|
|
|
2208
2072
|
- **In a worktree**, `./cli/ocnus host` and `./cli/ocnus host report`
|