@mark1russell7/harness 0.16.21 → 0.16.23

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/build/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as MemoryThrottlePrediction, $t as RESOURCES_EVENT, A as HopEvent, At as RunFabric, B as KernelRecord, Bt as Shipped, C as Fault, Cn as resourceReadingOf, Ct as Replies, D as GroupPrediction, Dt as Run, E as GroupPlace, Et as RttRange, F as HttpProbe, Ft as RunRoute, G as LoadPlan, Gt as Target, H as LineMatch, Ht as Stage, I as ImageSource, It as RunStream, J as MemoryLimits, Jt as WsProbe, K as LoadPrediction, Kt as Topology, L as Jitter, Lt as RunTopology, M as HopSignal, Mt as RunPart, N as HopWrite, Nt as RunPause, O as GroupRole, Ot as RunBackup, P as HostSysctl, Pt as RunResources, Q as MemoryStep, Qt as HostLimits, R as Kafka, Rt as SentinelEvent, S as FabricManifest, Sn as resourceReadingIn, St as ReplicaSetStage, T as Group, Tt as RouterHop, U as LoadBand, Ut as StageBand, V as LineCount, Vt as ShippedImage, W as LoadConnections, Wt as Subject, X as MemoryOomTask, Xt as isHopPlace, Y as MemoryOomPrediction, Yt as environmentProblems, Z as MemoryPrediction, Zt as latestEndOf, _ as DriverStep, _n as limitsProblems, _t as QueuePrediction, a as ClientCapability, an as ResourceMemory, at as Pair, b as EgressPrediction, bn as resourceArgs, bt as Reference, c as ClusterClientAt, cn as ResourceReader, ct as PinnedImage, d as ContainerLimits, dn as cgroupKeyed, dt as ProbeEvent, en as RESOURCES_PROGRAM, et as MiddleboxEvent, f as CountBand, fn as cgroupLimit, ft as ProxyHop, g as DriverBand, gn as hostLimitsOf, gt as QueueEnd, h as DrillRoom, hn as cpuStatOf, ht as QueueConnection, i as Client, in as ResourceLimits, it as Outcomes, j as HopPlace, jt as RunGroup, k as Hop, kt as RunDrill, l as ClusterStage, ln as ResourceReading, lt as PortsPrediction, m as Drill, mn as cpuMaxOf, mt as QueueBand, n as CLIENT_CAPABILITIES, nn as ResourceCpu, nt as MiddleboxForm, o as ClientImage, on as ResourceNetwork, ot as PauseBand, p as DeliveryPrediction, pn as cgroupNumber, pt as ProxyTime, q as LoadStream, qt as Toxic, r as Cell, rn as ResourceDevice, rt as Observer, s as Cluster, sn as ResourceOptions, st as PausePrediction, t as BuildImage, tn as ResourceChange, tt as MiddleboxExpectation, u as ConntrackPrediction, un as ResourceTraffic, ut as Prediction, v as EgressBurst, vn as memoryStatOf, vt as Reconnects, w as FaultPlace, wt as RequestPrediction, x as Fabric, xn as resourceChange, xt as ReplicaSet, y as EgressPacketLaw, yn as networkOf, yt as Recovers, z as KafkaPause, zt as SentinelStage } from "./cell-CgjwfQQ-.js";
1
+ import { $ as MemoryStep, $t as latestEndOf, A as Hop, At as RunCpus, B as KafkaPause, Bt as SentinelEvent, C as FabricManifest, Cn as resourceArgs, Ct as ReplicaSetStage, D as GroupPlace, Dt as RttRange, E as Group, En as resourceReadingOf, Et as RouterHop, F as HostSysctl, Ft as RunPause, G as LoadConnections, Gt as StageBand, H as LineCount, Ht as Shipped, I as HttpProbe, It as RunResources, J as LoadStream, Jt as Topology, K as LoadPlan, Kt as Subject, L as ImageSource, Lt as RunRoute, M as HopPlace, Mt as RunFabric, N as HopSignal, Nt as RunGroup, O as GroupPrediction, Ot as Run, P as HopWrite, Pt as RunPart, Q as MemoryPrediction, Qt as isHopPlace, R as Jitter, Rt as RunStream, S as Fabric, Sn as networkOf, St as ReplicaSet, T as FaultPlace, Tn as resourceReadingIn, Tt as RequestPrediction, U as LineMatch, Ut as ShippedImage, V as KernelRecord, Vt as SentinelStage, W as LoadBand, Wt as Stage, X as MemoryOomPrediction, Xt as WsProbe, Y as MemoryLimits, Yt as Toxic, Z as MemoryOomTask, Zt as environmentProblems, _ as DriverBand, _n as cpuStatOf, _t as QueueEnd, a as ClientCapability, an as ResourceDevice, at as Outcomes, b as EgressPacketLaw, bn as limitsProblems, bt as Recovers, c as ClusterClientAt, cn as ResourceNetwork, ct as PausePrediction, d as ContainerLimits, dn as ResourceReading, dt as Prediction, en as HostLimits, et as MemoryThrottlePrediction, f as CountBand, fn as ResourceTraffic, ft as ProbeEvent, g as DrillRoom, gn as cpuMaxOf, gt as QueueConnection, h as Drill, hn as cgroupNumber, ht as QueueBand, i as Client, in as ResourceCpu, it as Observer, j as HopEvent, jt as RunDrill, k as GroupRole, kt as RunBackup, l as ClusterStage, ln as ResourceOptions, lt as PinnedImage, m as DeliveryPrediction, mn as cgroupLimit, mt as ProxyTime, n as CLIENT_CAPABILITIES, nn as RESOURCES_PROGRAM, nt as MiddleboxExpectation, o as ClientImage, on as ResourceLimits, ot as Pair, p as CpuShares, pn as cgroupKeyed, pt as ProxyHop, q as LoadPrediction, qt as Target, r as Cell, rn as ResourceChange, rt as MiddleboxForm, s as Cluster, sn as ResourceMemory, st as PauseBand, t as BuildImage, tn as RESOURCES_EVENT, tt as MiddleboxEvent, u as ConntrackPrediction, un as ResourceReader, ut as PortsPrediction, v as DriverStep, vn as cpusOfList, vt as QueuePrediction, w as Fault, wn as resourceChange, wt as Replies, x as EgressPrediction, xn as memoryStatOf, xt as Reference, y as EgressBurst, yn as hostLimitsOf, yt as Reconnects, z as Kafka, zt as RunTopology } from "./cell-DjDNdbuB.js";
2
2
  import { LAYERS, LAYER_FACTS, LIMITS, Layer, LayerFacts, LayerState, Limit, layerOf, limitsOf } from "./layers.js";
3
3
  import { Quantity } from "@mark1russell7/quantity";
4
4
  import { DiskFault, LoadMeasure, Schedule } from "@mark1russell7/rigor-chaos";
@@ -915,6 +915,35 @@ export declare const readCpu: (root?: string) => CpuTime | null;
915
915
  * runner that host is itself a guest, and this number does not show the contention of the layer below it.
916
916
  */
917
917
  export declare const stealShare: (before: CpuTime, after: CpuTime) => number | null;
918
+ /** The names of the eight states of a CPU in `/proc/stat`, in the order of the file. */
919
+ export declare const CPU_STATES: readonly ["user", "nice", "system", "idle", "iowait", "irq", "softirq", "steal"];
920
+ /** A CPU state is one of the eight states of a CPU in `/proc/stat`. */
921
+ type CpuState = (typeof CPU_STATES)[number];
922
+ /** The CPU states of one CPU are its eight counters of `/proc/stat`, in ticks of the clock. */
923
+ type CpuStates = Readonly<Record<CpuState, number>>;
924
+ /**
925
+ * This function reads the eight states of each CPU of this machine from `/proc/stat`, by the number of
926
+ * the CPU. It gives null without the file, or with no line of a CPU. `root` is for tests.
927
+ *
928
+ * - The guest counters that follow the eight states are also in `user` and `nice`. Thus the function does not read them.
929
+ * - A line with a counter that is not a number makes the reading null.
930
+ */
931
+ export declare const readCpus: (root?: string) => ReadonlyMap<number, CpuStates> | null;
932
+ /**
933
+ * This function gives the CPU shares of a set of CPUs between two readings of `readCpus`. It gives
934
+ * null if a CPU of the set is not in both readings, or if no tick passed.
935
+ */
936
+ export declare const cpuShares: (before: ReadonlyMap<number, CpuStates>, after: ReadonlyMap<number, CpuStates>, cpus: readonly number[], list: string) => CpuShares | null;
937
+ /** The CPU lists of a run are the `cpuset` lists of the target and of the client. Each one is there if its cell gives it. */
938
+ interface CpuLists {
939
+ readonly target?: string;
940
+ readonly client?: string;
941
+ }
942
+ /**
943
+ * This function gives the CPU shares of the CPU lists of a run between two readings of `readCpus`. A
944
+ * list that `cpusOfList` refuses gives no shares, and so does a missing reading. With no shares, it gives null.
945
+ */
946
+ export declare const runCpusOf: (lists: CpuLists, before: ReadonlyMap<number, CpuStates> | null, after: ReadonlyMap<number, CpuStates> | null) => RunCpus | null;
918
947
  /** A part of a record that can hold a substrate: a manifest of the harness, or the fields of a kind manifest. */
919
948
  interface SubstrateSource {
920
949
  readonly substrate?: Substrate;
@@ -3056,4 +3085,4 @@ export declare const environmentCounts: (cell: Cell, runs: number) => number[];
3056
3085
  * Each environment does a warm-up first, and the result keeps it apart from the counted runs.
3057
3086
  */
3058
3087
  export declare const runCell: (cell: Cell, say?: (line: string) => void) => Promise<CellResult>;
3059
- export { type Agent, type BuildImage, type BuildRecord, CLIENT_CAPABILITIES, type CallReading, type Cell, type CellResult, type Client, type ClientCapability, type ClientImage, type ClockPair, type Cloud, type Cluster, type ClusterClientAt, type ClusterLab, type ClusterStage, type ConntrackPrediction, type ConntrackReading, type ContainerLimits, type ContextFile, type CountBand, type Crossings, type Cut, type Decision, type DeliveryPrediction, type DeliveryReading, type DeliveryStream, type DiskImage, type DiskLab, type DiskLabOptions, type DiskPinnable, type DiskRecord, type DiskSubject, type DiskWriterRecord, type Drill, type DrillRoom, type DriverBand, type DriverSocket, type DriverStep, type DriverStepTime, type EgressBurst, type EgressPacketLaw, type EgressPacketReading, type EgressPrediction, type EgressReading, type ErrorOnTheWay, type EstimateVerdict, type Fabric, type FabricLab, type FabricManifest, type FabricParts, type Fault, type FaultOptions, type FaultPlace, type FaultSide, type Group, type GroupClient, type GroupLab, type GroupMeasured, type GroupNetworkFault, type GroupPlace, type GroupPrediction, type GroupReading, type GroupRole, type GroupVerdict, type GroupView, type Hop, type HopEvent, type HopPlace, type HopSignal, type HopWrite, type Host, type HostLimits, type HostSetting, type HostSysctl, type HttpProbe, type ImagePlan, type ImageSource, type Interval, type Jitter, type Kafka, type KafkaLab, type KafkaMember, type KafkaPause, type KernelRecord, LAYERS, LAYER_FACTS, LIMITS, type Lab, type Layer, type LayerFacts, type LayerState, type LeafViews, type Limit, type LineCount, type LineMatch, type LoadBand, type LoadConnections, type LoadJudgement, type LoadPlan, type LoadPrediction, type LoadSpread, type LoadStream, type LoadVerdict, type Manifest, type ManifestHop, type Measured, type MemberLine, type MemoryLimits, type MemoryOomPrediction, type MemoryOomTask, type MemoryPrediction, type MemoryReading, type MemoryStep, type MemoryStepReading, type MemoryTaskReading, type MemoryThrottlePrediction, type MiddleboxEvent, type MiddleboxExpectation, type MiddleboxForm, type NetworkFault, type NodeLine, type Observer, type OplogRead, type OplogTime, type Outcome, type Outcomes, type Pair, type PairSets, type Pairing, type PartitionView, type PauseBand, type PauseCommit, type PausePrediction, type PauseReading, type Pinnable, type PinnedImage, type PortsPrediction, type PortsReading, type Prediction, type Probe, type ProbeEvent, type ProgramEvent, type ProxyHop, type ProxyTime, type QueueBand, type QueueConnection, type QueueConnectionReading, type QueueEnd, type QueuePrediction, type QueueReading, RESOURCES_EVENT, RESOURCES_PROGRAM, type ReconnectReading, type ReconnectVerdict, type Reconnects, type RecordCode, type Recovers, type RecoveryMeasured, type Reference, type Reordering, type ReplicaSet, type ReplicaSetLab, type ReplicaSetStage, type Replies, type RequestPrediction, type RequestReading, type ResourceChange, type ResourceCpu, type ResourceDevice, type ResourceLimits, type ResourceMemory, type ResourceNetwork, type ResourceOptions, type ResourceReader, type ResourceReading, type ResourceTraffic, type RouteLine, type RouterHop, type RttRange, type Run, type RunBackup, type RunDrill, type RunEstimate, type RunFabric, type RunGroup, type RunLoad, type RunPart, type RunPause, type RunResources, type RunRoute, type RunStream, type RunTopology, type SentinelEvent, type SentinelStage, type Shipped, type ShippedImage, type Sibling, type SocketPlace, type Spread, type StackChange, type Stage, type StageBand, type StageVerdict, type StallReading, type Stamp, type Status, type StatusRow, type Subject, type Substrate, type SubstrateSource, type Target, type TimeFromFault, type Topology, type Toxic, type Verdict, type WallStamp, type Writes, type WsProbe, cgroupKeyed, cgroupLimit, cgroupNumber, cpuMaxOf, cpuStatOf, environmentProblems, hostLimitsOf, isHopPlace, latestEndOf, layerOf, limitsOf, limitsProblems, memoryStatOf, networkOf, resourceArgs, resourceChange, resourceReadingIn, resourceReadingOf };
3088
+ export { type Agent, type BuildImage, type BuildRecord, CLIENT_CAPABILITIES, type CallReading, type Cell, type CellResult, type Client, type ClientCapability, type ClientImage, type ClockPair, type Cloud, type Cluster, type ClusterClientAt, type ClusterLab, type ClusterStage, type ConntrackPrediction, type ConntrackReading, type ContainerLimits, type ContextFile, type CountBand, type CpuLists, type CpuShares, type CpuState, type CpuStates, type Crossings, type Cut, type Decision, type DeliveryPrediction, type DeliveryReading, type DeliveryStream, type DiskImage, type DiskLab, type DiskLabOptions, type DiskPinnable, type DiskRecord, type DiskSubject, type DiskWriterRecord, type Drill, type DrillRoom, type DriverBand, type DriverSocket, type DriverStep, type DriverStepTime, type EgressBurst, type EgressPacketLaw, type EgressPacketReading, type EgressPrediction, type EgressReading, type ErrorOnTheWay, type EstimateVerdict, type Fabric, type FabricLab, type FabricManifest, type FabricParts, type Fault, type FaultOptions, type FaultPlace, type FaultSide, type Group, type GroupClient, type GroupLab, type GroupMeasured, type GroupNetworkFault, type GroupPlace, type GroupPrediction, type GroupReading, type GroupRole, type GroupVerdict, type GroupView, type Hop, type HopEvent, type HopPlace, type HopSignal, type HopWrite, type Host, type HostLimits, type HostSetting, type HostSysctl, type HttpProbe, type ImagePlan, type ImageSource, type Interval, type Jitter, type Kafka, type KafkaLab, type KafkaMember, type KafkaPause, type KernelRecord, LAYERS, LAYER_FACTS, LIMITS, type Lab, type Layer, type LayerFacts, type LayerState, type LeafViews, type Limit, type LineCount, type LineMatch, type LoadBand, type LoadConnections, type LoadJudgement, type LoadPlan, type LoadPrediction, type LoadSpread, type LoadStream, type LoadVerdict, type Manifest, type ManifestHop, type Measured, type MemberLine, type MemoryLimits, type MemoryOomPrediction, type MemoryOomTask, type MemoryPrediction, type MemoryReading, type MemoryStep, type MemoryStepReading, type MemoryTaskReading, type MemoryThrottlePrediction, type MiddleboxEvent, type MiddleboxExpectation, type MiddleboxForm, type NetworkFault, type NodeLine, type Observer, type OplogRead, type OplogTime, type Outcome, type Outcomes, type Pair, type PairSets, type Pairing, type PartitionView, type PauseBand, type PauseCommit, type PausePrediction, type PauseReading, type Pinnable, type PinnedImage, type PortsPrediction, type PortsReading, type Prediction, type Probe, type ProbeEvent, type ProgramEvent, type ProxyHop, type ProxyTime, type QueueBand, type QueueConnection, type QueueConnectionReading, type QueueEnd, type QueuePrediction, type QueueReading, RESOURCES_EVENT, RESOURCES_PROGRAM, type ReconnectReading, type ReconnectVerdict, type Reconnects, type RecordCode, type Recovers, type RecoveryMeasured, type Reference, type Reordering, type ReplicaSet, type ReplicaSetLab, type ReplicaSetStage, type Replies, type RequestPrediction, type RequestReading, type ResourceChange, type ResourceCpu, type ResourceDevice, type ResourceLimits, type ResourceMemory, type ResourceNetwork, type ResourceOptions, type ResourceReader, type ResourceReading, type ResourceTraffic, type RouteLine, type RouterHop, type RttRange, type Run, type RunBackup, type RunCpus, type RunDrill, type RunEstimate, type RunFabric, type RunGroup, type RunLoad, type RunPart, type RunPause, type RunResources, type RunRoute, type RunStream, type RunTopology, type SentinelEvent, type SentinelStage, type Shipped, type ShippedImage, type Sibling, type SocketPlace, type Spread, type StackChange, type Stage, type StageBand, type StageVerdict, type StallReading, type Stamp, type Status, type StatusRow, type Subject, type Substrate, type SubstrateSource, type Target, type TimeFromFault, type Topology, type Toxic, type Verdict, type WallStamp, type Writes, type WsProbe, cgroupKeyed, cgroupLimit, cgroupNumber, cpuMaxOf, cpuStatOf, cpusOfList, environmentProblems, hostLimitsOf, isHopPlace, latestEndOf, layerOf, limitsOf, limitsProblems, memoryStatOf, networkOf, resourceArgs, resourceChange, resourceReadingIn, resourceReadingOf };
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { $ as hostLimitsOf, A as targetSourceOf, B as versionsOf, C as programOf, D as subjectClient, E as sources, F as goVersions, G as requestFirst, H as environmentProblems, I as jarVersions, J as cgroupKeyed, K as RESOURCES_EVENT, L as locksOf, M as unpinnedBases, N as LOCK_NAMES, O as subjectProblems, P as cargoVersions, Q as cpuStatOf, R as npmDrift, S as planOf, T as shippedSource, U as isHopPlace, V as CLIENT_CAPABILITIES, W as latestEndOf, X as cgroupNumber, Y as cgroupLimit, Z as cpuMaxOf, _ as kafkaClientImage, _t as loadPlanOf, a as SHIPPED_NAMES, at as resourceReadingIn, b as nodeHttpImage, bt as streamsLoadOf, c as buildRecordOf, ct as LOAD_FORMAT, d as harnessImage, dt as SCHEDULE_PATH, et as limitsProblems, f as harnessVersion, ft as connectionsProblems, g as inContext, gt as loadOf, h as imageProblems, ht as loadEnds, i as SHIPPED_CLIENTS, it as resourceChange, j as unlockedManifests, k as targetImageOf, l as goHttpImage, lt as LOAD_PATH, m as imageOf, mt as estimateVerdict, n as PINNED, nt as networkOf, o as amqpClientImage, ot as resourceReadingOf, p as hikariClientImage, pt as estimateOf, q as RESOURCES_PROGRAM, r as REPOSITORY, rt as resourceArgs, s as basesOf, st as CLOSED_TOLERANCE, t as CLIENT_NAMES, tt as memoryStatOf, u as grpcClientImage, ut as LOAD_POOL_LIMIT, v as mongoClientImage, vt as loadVerdict, w as routerImage, x as pgClientImage, y as nodeClientImage, yt as poolOf, z as npmVersions } from "./image-Dzofp1ab.js";
1
+ import { $ as cpusOfList, A as targetSourceOf, B as versionsOf, C as programOf, D as subjectClient, E as sources, F as goVersions, G as requestFirst, H as environmentProblems, I as jarVersions, J as cgroupKeyed, K as RESOURCES_EVENT, L as locksOf, M as unpinnedBases, N as LOCK_NAMES, O as subjectProblems, P as cargoVersions, Q as cpuStatOf, R as npmDrift, S as planOf, T as shippedSource, U as isHopPlace, V as CLIENT_CAPABILITIES, W as latestEndOf, X as cgroupNumber, Y as cgroupLimit, Z as cpuMaxOf, _ as kafkaClientImage, _t as loadOf, a as SHIPPED_NAMES, at as resourceChange, b as nodeHttpImage, bt as poolOf, c as buildRecordOf, ct as CLOSED_TOLERANCE, d as harnessImage, dt as LOAD_POOL_LIMIT, et as hostLimitsOf, f as harnessVersion, ft as SCHEDULE_PATH, g as inContext, gt as loadEnds, h as imageProblems, ht as estimateVerdict, i as SHIPPED_CLIENTS, it as resourceArgs, j as unlockedManifests, k as targetImageOf, l as goHttpImage, lt as LOAD_FORMAT, m as imageOf, mt as estimateOf, n as PINNED, nt as memoryStatOf, o as amqpClientImage, ot as resourceReadingIn, p as hikariClientImage, pt as connectionsProblems, q as RESOURCES_PROGRAM, r as REPOSITORY, rt as networkOf, s as basesOf, st as resourceReadingOf, t as CLIENT_NAMES, tt as limitsProblems, u as grpcClientImage, ut as LOAD_PATH, v as mongoClientImage, vt as loadPlanOf, w as routerImage, x as pgClientImage, xt as streamsLoadOf, y as nodeClientImage, yt as loadVerdict, z as npmVersions } from "./image-B1jai9Lq.js";
2
2
  import { LAYERS, LAYER_FACTS, LIMITS, layerOf, limitsOf } from "./layers.js";
3
3
  import { quantity, valueIn } from "@mark1russell7/quantity";
4
4
  import { checkDiskFault, schedule, stopTriggerOf } from "@mark1russell7/rigor-chaos";
@@ -4035,6 +4035,74 @@ const stealShare = (before, after) => {
4035
4035
  const total = after.total - before.total;
4036
4036
  return total <= 0 ? null : (after.steal - before.steal) / total;
4037
4037
  };
4038
+ /** The names of the eight states of a CPU in `/proc/stat`, in the order of the file. */
4039
+ const CPU_STATES = [
4040
+ "user",
4041
+ "nice",
4042
+ "system",
4043
+ "idle",
4044
+ "iowait",
4045
+ "irq",
4046
+ "softirq",
4047
+ "steal"
4048
+ ];
4049
+ /**
4050
+ * This function reads the eight states of each CPU of this machine from `/proc/stat`, by the number of
4051
+ * the CPU. It gives null without the file, or with no line of a CPU. `root` is for tests.
4052
+ *
4053
+ * - The guest counters that follow the eight states are also in `user` and `nice`. Thus the function does not read them.
4054
+ * - A line with a counter that is not a number makes the reading null.
4055
+ */
4056
+ const readCpus = (root = "/") => {
4057
+ const text = textOf(join(root, "proc", "stat"));
4058
+ if (text === null) return null;
4059
+ const cpus = /* @__PURE__ */ new Map();
4060
+ for (const line of text.split("\n")) {
4061
+ const match = /^cpu(\d+)\s+(.*)$/.exec(line);
4062
+ if (match === null) continue;
4063
+ const ticks = match[2].trim().split(/\s+/).slice(0, CPU_STATES.length).map(Number);
4064
+ if (ticks.length < CPU_STATES.length || ticks.some(Number.isNaN)) return null;
4065
+ cpus.set(Number(match[1]), Object.fromEntries(CPU_STATES.map((state, index) => [state, ticks[index]])));
4066
+ }
4067
+ return cpus.size === 0 ? null : cpus;
4068
+ };
4069
+ /**
4070
+ * This function gives the CPU shares of a set of CPUs between two readings of `readCpus`. It gives
4071
+ * null if a CPU of the set is not in both readings, or if no tick passed.
4072
+ */
4073
+ const cpuShares = (before, after, cpus, list) => {
4074
+ const sums = Object.fromEntries(CPU_STATES.map((state) => [state, 0]));
4075
+ for (const cpu of cpus) {
4076
+ const first = before.get(cpu);
4077
+ const last = after.get(cpu);
4078
+ if (first === void 0 || last === void 0) return null;
4079
+ for (const state of CPU_STATES) sums[state] += last[state] - first[state];
4080
+ }
4081
+ const total = CPU_STATES.reduce((sum, state) => sum + sums[state], 0);
4082
+ if (cpus.length === 0 || total <= 0) return null;
4083
+ const shares = Object.fromEntries(CPU_STATES.map((state) => [state, sums[state] / total]));
4084
+ return {
4085
+ cpus: list,
4086
+ count: cpus.length,
4087
+ ...shares,
4088
+ busy: cpus.length * (1 - shares.idle - shares.iowait)
4089
+ };
4090
+ };
4091
+ /**
4092
+ * This function gives the CPU shares of the CPU lists of a run between two readings of `readCpus`. A
4093
+ * list that `cpusOfList` refuses gives no shares, and so does a missing reading. With no shares, it gives null.
4094
+ */
4095
+ const runCpusOf = (lists, before, after) => {
4096
+ if (before === null || after === null) return null;
4097
+ const cpus = {};
4098
+ for (const part of ["target", "client"]) {
4099
+ const list = lists[part];
4100
+ const numbers = list === void 0 ? null : cpusOfList(list);
4101
+ const shares = list === void 0 || numbers === null ? null : cpuShares(before, after, numbers, list);
4102
+ if (shares !== null) cpus[part] = shares;
4103
+ }
4104
+ return cpus.target === void 0 && cpus.client === void 0 ? null : cpus;
4105
+ };
4038
4106
  /**
4039
4107
  * This function reads the substrate of a record, the upgrade of a record from before this block.
4040
4108
  * Nothing rewrites such a record. It reads as the given layer. Its cloud is Azure if the record is
@@ -9150,11 +9218,15 @@ const once = async (lab, cell, environment, index, dry = false) => {
9150
9218
  let reader;
9151
9219
  let start;
9152
9220
  let end;
9221
+ const lists = cpuListsOf(cell);
9222
+ let cpusAtStart = null;
9223
+ let cpusAtEnd = null;
9153
9224
  try {
9154
9225
  await probe.until(["ready"], 15e3);
9155
9226
  if (cell.resources !== void 0) {
9156
9227
  reader = await lab.resources(cell.resources);
9157
9228
  start = await reader.read();
9229
+ cpusAtStart = readCpusFor(lists);
9158
9230
  }
9159
9231
  if (dry) {
9160
9232
  if (cell.probe.mode !== "idle") await go();
@@ -9359,13 +9431,17 @@ const once = async (lab, cell, environment, index, dry = false) => {
9359
9431
  await setTimeout$1(TAIL_MS);
9360
9432
  }
9361
9433
  }
9362
- if (reader !== void 0) end = await reader.read();
9434
+ if (reader !== void 0) {
9435
+ end = await reader.read();
9436
+ cpusAtEnd = readCpusFor(lists);
9437
+ }
9363
9438
  } finally {
9364
9439
  await probe.stop();
9365
9440
  await reader?.stop();
9366
9441
  }
9367
9442
  const settled = await lab.settle();
9368
9443
  const lost = settled === null ? null : settled - lostBefore;
9444
+ const cpus = runCpusOf(lists, cpusAtStart, cpusAtEnd);
9369
9445
  return {
9370
9446
  environment,
9371
9447
  index,
@@ -9389,7 +9465,8 @@ const once = async (lab, cell, environment, index, dry = false) => {
9389
9465
  ...reader === void 0 || start === void 0 || end === void 0 ? {} : { resources: {
9390
9466
  start,
9391
9467
  end,
9392
- series: [...reader.series]
9468
+ series: [...reader.series],
9469
+ ...cpus === null ? {} : { cpus }
9393
9470
  } }
9394
9471
  };
9395
9472
  };
@@ -9408,15 +9485,30 @@ const environmentCounts = (cell, runs) => spread(runs, cell.pair !== void 0 ? ru
9408
9485
  const endsEnvironment = (cell) => cell.fresh === true || cell.fault === "fin" && (cell.observer === void 0 || cell.observer === "client");
9409
9486
  /** This function says one line for a run. */
9410
9487
  const line = (cell, run, read) => `${cell.name}: env ${run.environment} ${run.warmup === true ? "warm-up" : `run ${run.index}`} ${read.outcome.kind}${read.elapsed === null ? "" : ` ${read.elapsed.value} s`}${read.void === null ? "" : ` (void: ${read.void})`}`;
9411
- /** This function adds to a run the share of the CPU that the host took while the run operated. */
9412
- const withSteal = async (work) => {
9488
+ /** This function gives the `cpuset` lists of the target and of the client of a cell. */
9489
+ const cpuListsOf = (cell) => ({
9490
+ ...cell.target.limits?.cpuset === void 0 ? {} : { target: cell.target.limits.cpuset },
9491
+ ...cell.clientLimits?.cpuset === void 0 ? {} : { client: cell.clientLimits.cpuset }
9492
+ });
9493
+ /** This function reads the states of each CPU, only for a cell with a `cpuset` list. */
9494
+ const readCpusFor = (lists) => lists.target === void 0 && lists.client === void 0 ? null : readCpus();
9495
+ /**
9496
+ * This function adds to a run the share of the CPU that the host took while the run operated. It also
9497
+ * adds the CPU shares of the CPU sets of the target and of the client (`RunCpus`).
9498
+ */
9499
+ const withCpu = async (cell, work) => {
9500
+ const lists = cpuListsOf(cell);
9413
9501
  const before = readCpu();
9502
+ const first = readCpusFor(lists);
9414
9503
  const run = await work();
9415
9504
  const after = readCpu();
9505
+ const last = readCpusFor(lists);
9416
9506
  const steal = before === null || after === null ? null : stealShare(before, after);
9417
- return steal === null ? run : {
9507
+ const cpus = runCpusOf(lists, first, last);
9508
+ return {
9418
9509
  ...run,
9419
- steal
9510
+ ...steal === null ? {} : { steal },
9511
+ ...cpus === null ? {} : { cpus }
9420
9512
  };
9421
9513
  };
9422
9514
  /**
@@ -9451,13 +9543,13 @@ const inEnvironment = async (cell, environment, count, say) => {
9451
9543
  ...missing === void 0 ? {} : { missing }
9452
9544
  });
9453
9545
  const warmup = {
9454
- ...timed(await withSteal(() => once(lab, cell, environment, -1, endsEnvironment(cell)))),
9546
+ ...timed(await withCpu(cell, () => once(lab, cell, environment, -1, endsEnvironment(cell)))),
9455
9547
  warmup: true
9456
9548
  };
9457
9549
  say(line(cell, warmup, measure(cell, warmup)));
9458
9550
  const runs = [];
9459
9551
  for (let index = 0; index < count; index += 1) {
9460
- const run = timed(await withSteal(() => once(lab, cell, environment, index)));
9552
+ const run = timed(await withCpu(cell, () => once(lab, cell, environment, index)));
9461
9553
  runs.push(run);
9462
9554
  say(line(cell, run, measure(cell, run)));
9463
9555
  }
@@ -9675,6 +9767,6 @@ const runCell = async (cell, say = () => {}) => {
9675
9767
  target = larger;
9676
9768
  }
9677
9769
  };
9678
- export { AWS_FROM, CLIENT_CAPABILITIES, CLIENT_NAMES, CLOSED_TOLERANCE, CLOUDS, CLUSTER_STAGES, CONVERGE_MS, DAEMONS, DEBUG, DIRTY, DISK_MOUNT, DISK_RECORD_FORMAT, DISK_ROOT, DISK_SUBJECT, DROP_HANDLING, FABRIC_CLIENT, FABRIC_DEVICE, FABRIC_TARGET, FRR_IMAGE, GIVES_AWAY, HASH_SCRIPT, INJECT, INSERT, KAFKA_TAIL_MS, KEPT, LAYERS, LAYER_FACTS, LIMITS, LINGER_MS, LISTING, LOAD_FORMAT, LOAD_PATH, LOAD_POOL_LIMIT, LOCK_NAMES, LOSS_MARGIN, MEMBER_MARKS, MONITOR_DOWN, NODE_MARKS, NOISE, PINNED, PUMP, PUMP_SLACK, QUIET_MS, RELATIVE, REPLICA_SET_STAGES, REPOSITORY, RESOURCES_EVENT, RESOURCES_PROGRAM, RESTART, ROUTERS, SCHEDULE_PATH, SEED_DOCUMENT, SHIPPED_CLIENTS, SHIPPED_NAMES, STAGES, STANDBY_READY, STATUS_SCRIPT, STEPS, STEP_DOWN, amqpClientImage, basesOf, bootstrapOf, brokerEnv, buildOf, buildRecordOf, callOf, cancelsOf, cargoVersions, cgroupKeyed, cgroupLimit, cgroupNumber, clockOffsetOf, closeOrExit, cloudOf, clusterArgs, clusterConf, clusterCutOf, clusterHostsOf, clusterOnce, clusterStagesOf, clusterViewOf, commitProblems, commitVoid, comparable, connectionsProblems, controllerEnv, cpuMaxOf, cpuStatOf, crossingsOf, cutOf, deadlineOf, delayVoids, deliveryFinding, deliveryOf, deviceOf, diskRecordProblems, diskSubjectProblems, drillOnce, drillSpan, dropFinding, dropOf, endpointAfter, envOf, environmentCounts, environmentProblems, errorsOf, estimateOf, estimateVerdict, exitOf, fieldOf, fieldsOf, firstUnanswered, folderDigest, frrConf, goHttpImage, goVersions, groupOnce, groupVerdictOf, grpcClientImage, harnessImage, harnessRecord, harnessVersion, hashOf, highestHeld, hikariClientImage, hostLimitsOf, hzOf, imageOf, imagePinProblems, imageProblems, inContext, infoOf, initiateScript, isFenceLine, isHopPlace, jarVersions, jitterOf, jitterOfLines, judge, kafkaArgs, kafkaClientImage, kafkaCutOf, kafkaOnce, kafkaPauseOnce, kafkaViewOf, lagsOf, laterMove, latestEndOf, layerOf, leafLacks, leftAfter, limitsOf, limitsProblems, loadOf, loadPlanOf, loadVerdict, locksOf, logNameOf, logTimeOf, manifestProblems, matches, measure, measureConntrack, measureDriver, measureEgress, measureGroup, measureMemory, measurePause, measurePorts, measureQueue, medianInterval, memAvailableOf, memberCommand, memberConfig, memberLineOf, memoryStatOf, mongoClientImage, monotonicAt, monotonicOf, namesGroup, networkOf, nodeClientImage, nodeCommand, nodeHttpImage, nodeIdOf, nodeLineOf, nodeNameOf, nodesOnMonotonic, noiseOf, npmDrift, npmVersions, numbersOf, onMonotonic, openClusterLab, openDiskLab, openFabric, openGroupLab, openKafkaLab, openLab, openReplicaSetLab, openStandby, pairArgs, pairOnce, pairingOf, pairingsOf, pauseReady, peersOf, pgClientImage, pingsOf, plainOf, planOf, pongsOf, poolOf, programLines, programOf, quantileOf, readCpu, readHost, readOplog, reconnectFinding, reconnectOf, recordProblems, recoveryFindings, recoveryOf, referenceOf, reorderingOf, replicaSetArgs, replicaSetOnce, replicaSetStagesOf, requestOf, requestWords, resourceArgs, resourceChange, resourceReader, resourceReadingIn, resourceReadingOf, restamped, roomNeeded, roomVoidOf, routeLine, routerImage, routesOf, runCell, runDiskFault, seedScript, sentinelConfig, sessionsOf, shippedClientRecord, shippedSource, sliceQuery, socketAt, socketOf, socketsOf, spread, spreadOf, stagesOf, standaloneCommand, standbyCommand, statusViewOf, stealShare, stepBand, stopScript, streamEnded, streamOf, streamsLoadOf, subjectClient, subjectProblems, subscriptionsOf, substrateHere, substrateKey, substrateOf, substrateOn, targetImageOf, targetSourceOf, templated, toolJsonOf, topicOf, topologyOf, toxicBody, unlockedManifests, unpinnedBases, unpoolable, verdictOf, versionsOf, viewOf, writesOf };
9770
+ export { AWS_FROM, CLIENT_CAPABILITIES, CLIENT_NAMES, CLOSED_TOLERANCE, CLOUDS, CLUSTER_STAGES, CONVERGE_MS, CPU_STATES, DAEMONS, DEBUG, DIRTY, DISK_MOUNT, DISK_RECORD_FORMAT, DISK_ROOT, DISK_SUBJECT, DROP_HANDLING, FABRIC_CLIENT, FABRIC_DEVICE, FABRIC_TARGET, FRR_IMAGE, GIVES_AWAY, HASH_SCRIPT, INJECT, INSERT, KAFKA_TAIL_MS, KEPT, LAYERS, LAYER_FACTS, LIMITS, LINGER_MS, LISTING, LOAD_FORMAT, LOAD_PATH, LOAD_POOL_LIMIT, LOCK_NAMES, LOSS_MARGIN, MEMBER_MARKS, MONITOR_DOWN, NODE_MARKS, NOISE, PINNED, PUMP, PUMP_SLACK, QUIET_MS, RELATIVE, REPLICA_SET_STAGES, REPOSITORY, RESOURCES_EVENT, RESOURCES_PROGRAM, RESTART, ROUTERS, SCHEDULE_PATH, SEED_DOCUMENT, SHIPPED_CLIENTS, SHIPPED_NAMES, STAGES, STANDBY_READY, STATUS_SCRIPT, STEPS, STEP_DOWN, amqpClientImage, basesOf, bootstrapOf, brokerEnv, buildOf, buildRecordOf, callOf, cancelsOf, cargoVersions, cgroupKeyed, cgroupLimit, cgroupNumber, clockOffsetOf, closeOrExit, cloudOf, clusterArgs, clusterConf, clusterCutOf, clusterHostsOf, clusterOnce, clusterStagesOf, clusterViewOf, commitProblems, commitVoid, comparable, connectionsProblems, controllerEnv, cpuMaxOf, cpuShares, cpuStatOf, cpusOfList, crossingsOf, cutOf, deadlineOf, delayVoids, deliveryFinding, deliveryOf, deviceOf, diskRecordProblems, diskSubjectProblems, drillOnce, drillSpan, dropFinding, dropOf, endpointAfter, envOf, environmentCounts, environmentProblems, errorsOf, estimateOf, estimateVerdict, exitOf, fieldOf, fieldsOf, firstUnanswered, folderDigest, frrConf, goHttpImage, goVersions, groupOnce, groupVerdictOf, grpcClientImage, harnessImage, harnessRecord, harnessVersion, hashOf, highestHeld, hikariClientImage, hostLimitsOf, hzOf, imageOf, imagePinProblems, imageProblems, inContext, infoOf, initiateScript, isFenceLine, isHopPlace, jarVersions, jitterOf, jitterOfLines, judge, kafkaArgs, kafkaClientImage, kafkaCutOf, kafkaOnce, kafkaPauseOnce, kafkaViewOf, lagsOf, laterMove, latestEndOf, layerOf, leafLacks, leftAfter, limitsOf, limitsProblems, loadOf, loadPlanOf, loadVerdict, locksOf, logNameOf, logTimeOf, manifestProblems, matches, measure, measureConntrack, measureDriver, measureEgress, measureGroup, measureMemory, measurePause, measurePorts, measureQueue, medianInterval, memAvailableOf, memberCommand, memberConfig, memberLineOf, memoryStatOf, mongoClientImage, monotonicAt, monotonicOf, namesGroup, networkOf, nodeClientImage, nodeCommand, nodeHttpImage, nodeIdOf, nodeLineOf, nodeNameOf, nodesOnMonotonic, noiseOf, npmDrift, npmVersions, numbersOf, onMonotonic, openClusterLab, openDiskLab, openFabric, openGroupLab, openKafkaLab, openLab, openReplicaSetLab, openStandby, pairArgs, pairOnce, pairingOf, pairingsOf, pauseReady, peersOf, pgClientImage, pingsOf, plainOf, planOf, pongsOf, poolOf, programLines, programOf, quantileOf, readCpu, readCpus, readHost, readOplog, reconnectFinding, reconnectOf, recordProblems, recoveryFindings, recoveryOf, referenceOf, reorderingOf, replicaSetArgs, replicaSetOnce, replicaSetStagesOf, requestOf, requestWords, resourceArgs, resourceChange, resourceReader, resourceReadingIn, resourceReadingOf, restamped, roomNeeded, roomVoidOf, routeLine, routerImage, routesOf, runCell, runCpusOf, runDiskFault, seedScript, sentinelConfig, sessionsOf, shippedClientRecord, shippedSource, sliceQuery, socketAt, socketOf, socketsOf, spread, spreadOf, stagesOf, standaloneCommand, standbyCommand, statusViewOf, stealShare, stepBand, stopScript, streamEnded, streamOf, streamsLoadOf, subjectClient, subjectProblems, subscriptionsOf, substrateHere, substrateKey, substrateOf, substrateOn, targetImageOf, targetSourceOf, templated, toolJsonOf, topicOf, topologyOf, toxicBody, unlockedManifests, unpinnedBases, unpoolable, verdictOf, versionsOf, viewOf, writesOf };
9679
9771
 
9680
9772
  //# sourceMappingURL=index.js.map