@mark1russell7/harness 0.16.20 → 0.16.22

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-CsI4nPck.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,25 @@ 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;
918
937
  /** A part of a record that can hold a substrate: a manifest of the harness, or the fields of a kind manifest. */
919
938
  interface SubstrateSource {
920
939
  readonly substrate?: Substrate;
@@ -3056,4 +3075,4 @@ export declare const environmentCounts: (cell: Cell, runs: number) => number[];
3056
3075
  * Each environment does a warm-up first, and the result keeps it apart from the counted runs.
3057
3076
  */
3058
3077
  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 };
3078
+ 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 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-38hbUAcd.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,59 @@ 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
+ };
4038
4091
  /**
4039
4092
  * This function reads the substrate of a record, the upgrade of a record from before this block.
4040
4093
  * Nothing rewrites such a record. It reads as the given layer. Its cloud is Azure if the record is
@@ -9408,15 +9461,36 @@ const environmentCounts = (cell, runs) => spread(runs, cell.pair !== void 0 ? ru
9408
9461
  const endsEnvironment = (cell) => cell.fresh === true || cell.fault === "fin" && (cell.observer === void 0 || cell.observer === "client");
9409
9462
  /** This function says one line for a run. */
9410
9463
  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) => {
9464
+ /** This function gives the CPU sets of the target and of the client of a cell, each with its list of CPUs. */
9465
+ const cpuSetsOf = (cell) => [["target", cell.target.limits?.cpuset], ["client", cell.clientLimits?.cpuset]].flatMap(([part, list]) => {
9466
+ const cpus = list === void 0 ? null : cpusOfList(list);
9467
+ return list === void 0 || cpus === null ? [] : [[
9468
+ part,
9469
+ list,
9470
+ cpus
9471
+ ]];
9472
+ });
9473
+ /**
9474
+ * This function adds to a run the share of the CPU that the host took while the run operated. It also
9475
+ * adds the CPU shares of the CPU sets of the target and of the client (`RunCpus`).
9476
+ */
9477
+ const withCpu = async (cell, work) => {
9478
+ const sets = cpuSetsOf(cell);
9413
9479
  const before = readCpu();
9480
+ const first = sets.length === 0 ? null : readCpus();
9414
9481
  const run = await work();
9415
9482
  const after = readCpu();
9483
+ const last = first === null ? null : readCpus();
9416
9484
  const steal = before === null || after === null ? null : stealShare(before, after);
9417
- return steal === null ? run : {
9485
+ const cpus = {};
9486
+ for (const [part, list, numbers] of sets) {
9487
+ const shares = first === null || last === null ? null : cpuShares(first, last, numbers, list);
9488
+ if (shares !== null) cpus[part] = shares;
9489
+ }
9490
+ return {
9418
9491
  ...run,
9419
- steal
9492
+ ...steal === null ? {} : { steal },
9493
+ ...Object.keys(cpus).length === 0 ? {} : { cpus }
9420
9494
  };
9421
9495
  };
9422
9496
  /**
@@ -9451,13 +9525,13 @@ const inEnvironment = async (cell, environment, count, say) => {
9451
9525
  ...missing === void 0 ? {} : { missing }
9452
9526
  });
9453
9527
  const warmup = {
9454
- ...timed(await withSteal(() => once(lab, cell, environment, -1, endsEnvironment(cell)))),
9528
+ ...timed(await withCpu(cell, () => once(lab, cell, environment, -1, endsEnvironment(cell)))),
9455
9529
  warmup: true
9456
9530
  };
9457
9531
  say(line(cell, warmup, measure(cell, warmup)));
9458
9532
  const runs = [];
9459
9533
  for (let index = 0; index < count; index += 1) {
9460
- const run = timed(await withSteal(() => once(lab, cell, environment, index)));
9534
+ const run = timed(await withCpu(cell, () => once(lab, cell, environment, index)));
9461
9535
  runs.push(run);
9462
9536
  say(line(cell, run, measure(cell, run)));
9463
9537
  }
@@ -9675,6 +9749,6 @@ const runCell = async (cell, say = () => {}) => {
9675
9749
  target = larger;
9676
9750
  }
9677
9751
  };
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 };
9752
+ 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, 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
9753
 
9680
9754
  //# sourceMappingURL=index.js.map