@mark1russell7/harness 0.16.16 → 0.16.18
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 +60 -0
- package/build/{cell-CYOKWfwg.d.ts → cell-C8M2J7Ya.d.ts} +247 -1
- package/build/{image-BE9H5gIv.js → image-CjrmLPA7.js} +339 -4
- package/build/image-CjrmLPA7.js.map +1 -0
- package/build/index.d.ts +24 -4
- package/build/index.js +78 -7
- package/build/index.js.map +1 -1
- package/build/layers.d.ts +1 -1
- package/build/schema.d.ts +1 -1
- package/build/schema.js +1 -1
- package/image/Dockerfile +5 -4
- package/image/native/src/bin/resources.rs +187 -0
- package/package.json +2 -2
- package/build/image-BE9H5gIv.js.map +0 -1
package/README.md
CHANGED
|
@@ -204,6 +204,54 @@ A cell can put a qdisc at the root of the interface of its client, and judge the
|
|
|
204
204
|
- **The law of a datagram** (`EgressPacketLaw`) is `sent` or `dropped`. A sent datagram has a time band after the first arrival of its burst. A drop is at the `limit` of the queue, or at the `size` of the burst of tbf. The judge (`measureEgress`) compares each datagram with its law.
|
|
205
205
|
- **A void run.** A run is void when the client stops before its end or when the root qdisc is of another kind. A neighbour that is not permanent voids a run too. It is void too when a send fails with another error. A burst that spreads more than `spread`, or that starts more than `jitter` off its time, voids its run. The counts of the qdisc void a run when other traffic went through it. A step of the clock above 100 µs voids a run, and a read of less than the share `read` of the departures voids it too.
|
|
206
206
|
|
|
207
|
+
## The resources of a container
|
|
208
|
+
|
|
209
|
+
A lab reads the resources that a container used: its CPU time, its memory and the traffic of its devices. Each reading has its stamps on CLOCK_MONOTONIC, the clock of each line of a lab. Thus a load test puts the resources of its server next to the times of the `load` client.
|
|
210
|
+
|
|
211
|
+
```ts
|
|
212
|
+
import { quantity } from "@mark1russell7/quantity";
|
|
213
|
+
import { constant } from "@mark1russell7/rigor-chaos";
|
|
214
|
+
import { LOAD_PATH, loadPlanOf, openLab, resourceChange } from "@mark1russell7/harness";
|
|
215
|
+
|
|
216
|
+
// the server has 1 CPU and 512 MiB on CPU 0. The client and the reader have the CPUs 2 and 3.
|
|
217
|
+
const lab = await openLab({ ...target, limits: { cpus: 1, cpuset: "0", memory: quantity(512, "MiB") } }, "load");
|
|
218
|
+
const reader = await lab.resources({ period: quantity(1, "s"), cpuset: "2-3" });
|
|
219
|
+
const get = "GET / HTTP/1.1\r\nHost: target\r\n\r\n";
|
|
220
|
+
const load = loadPlanOf([{ key: "get", plan: { profile: constant(200, 30_000), options: { arrivals: "uniform" } }, requests: [get] }]);
|
|
221
|
+
const args = [lab.targetIp, String(lab.targetPort), "--plan", LOAD_PATH];
|
|
222
|
+
const probe = await lab.probe(args, [{ content: load.content, target: LOAD_PATH }], undefined, { cpuset: "2-3" });
|
|
223
|
+
await probe.until(["ready"], 15_000);
|
|
224
|
+
const before = await reader.read();
|
|
225
|
+
await probe.go();
|
|
226
|
+
await probe.until(["done", "deadline", "fail"], 60_000);
|
|
227
|
+
const used = resourceChange(before, await reader.read());
|
|
228
|
+
console.log(used.cpu?.total, used.network?.tx.bytes, used.memory.peak, reader.series.length);
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
- **The limits of a container** (`ContainerLimits`). `Target.limits` gives the limits of the target of `openLab`. The fourth argument of `lab.probe` gives the limits of a client.
|
|
232
|
+
- `cpus` is the CPU quota, `cpuset` is the list of CPUs, and `memory` is the memory limit. The container gets no swap.
|
|
233
|
+
- `hostLimitsOf` gives the limits as Docker takes them: `NanoCpus`, `CpusetCpus`, `Memory` and `MemorySwap`. Limits with a problem (`limitsProblems`) stop the lab before the container starts.
|
|
234
|
+
- **The reader** is `/opt/harness/resources` of the image `harness`, in a privileged sidecar (`resourceReader`). `lab.resources()` reads the target, and `probe.resources()` reads a client.
|
|
235
|
+
- The sidecar is in the network namespace of the container and in the cgroup namespace of the host. It is not in the cgroup of the container. Thus its own CPU time and memory are not in the readings.
|
|
236
|
+
- `ResourceOptions.cpuset` keeps the reader on the CPUs that it names, for example the CPUs of the client.
|
|
237
|
+
- **A reading** (`ResourceReading`) has the counters of one moment, between its two stamps (`t0`, `t1`):
|
|
238
|
+
- `cpu.stat`: the CPU time (`usage`, `user`, `system`), the periods of the CPU limit, and the count and the time of its stops.
|
|
239
|
+
- `memory.current`, `memory.peak`, and `anon`, `file`, `kernel` and `sock` of `memory.stat`. The counts of `memory.events` include `oom_kill`: the tasks that the kernel stopped at the memory limit.
|
|
240
|
+
- `pids.current`, and the bytes and the packets of each device of `/proc/net/dev` without `lo`, with their sums.
|
|
241
|
+
- The limits as the kernel prints them: `cpu.max`, `memory.max` and `cpuset.cpus.effective`.
|
|
242
|
+
- **The two uses of a reader.** `read()` gives one reading at a named moment, for example before and after a schedule. With `period`, the reader also writes a series (`series`), one reading each period, from its start to its stop.
|
|
243
|
+
- **The change between two readings** (`resourceChange`) gives the CPU time (total, user and system) and the time that the CPU limit stopped the container. It also gives the bytes and the packets of each direction, the last memory and the peak.
|
|
244
|
+
- A counter that went down, as after a restart of the container, is in `resets`, and its part is null. The function does not give a negative amount.
|
|
245
|
+
- **No read is not a zero.** A file that the reader cannot read gives null for its values. An example is `memory.peak` on a kernel before Linux 5.19.
|
|
246
|
+
- Docker removes the cgroup of a client when its program ends. After that, a `read()` throws, and each reading of a series has null for the values of the cgroup.
|
|
247
|
+
- The traffic of a client is the traffic of the namespace that the clients of the lab share.
|
|
248
|
+
- **The parse is in TypeScript.** The reader writes the text of each file in one JSON line. `resourceReadingOf` reads that line with `cpuStatOf`, `memoryStatOf`, `cpuMaxOf`, `networkOf`, `cgroupNumber`, `cgroupLimit` and `cgroupKeyed`.
|
|
249
|
+
- **The readings of a cell** (from 0.16.16). A cell can measure the cost of its target in each run, with `runCell`:
|
|
250
|
+
- `Cell.clientLimits` gives the limits of the client in each run, for example other CPUs than the target.
|
|
251
|
+
- `Cell.resources` starts a reader of the target in each run, with these options. The reader stops at the end of the run.
|
|
252
|
+
- Each run then keeps `Run.resources`. It has a reading when the client is ready and before it sends (`start`). It also has a reading after the run ended (`end`), and the series of the reader.
|
|
253
|
+
- `environmentProblems` names each problem of the limits of the target and of the client, before a lab opens.
|
|
254
|
+
|
|
207
255
|
## The subjects
|
|
208
256
|
|
|
209
257
|
A subject (`Subject`, `image.ts`) is the program under test, as data. The harness does not import the program. It starts the image of the program. Thus another repository can give its own subject, with its own release in it.
|
|
@@ -242,6 +290,7 @@ From 0.11.20, the harness builds each image with the CLI of Docker (`docker buil
|
|
|
242
290
|
- `client`, the TCP client of a cell. Rust's `std::net` sets no socket option by itself, thus the measurement gets the timers of the namespace. The client also samples `TCP_INFO` each 2 ms, a second vantage on its socket. It waits in `poll()`, which does not lock the socket. A keepalive timer that finds its socket held tries again HZ/20 later.
|
|
243
291
|
- In a stream, a reply of the `client` is whole at its CRLF, or after the length of a bulk string. The client then writes a `replied` line.
|
|
244
292
|
- `load`, the open-loop driver of an HTTP/1.1 server (SYS-93). Its plan (`systems-load/1`) is a list of streams, each with a key, a schedule (`rigor-schedule/1`) and its requests. Each stream has its own connection, thus a slow reply delays only its own stream. A send does not wait for a reply. A response is whole after its `Content-Length` or its last chunk. The `sent` and `replied` lines name the stream (`k`) and the arrival (`i`), and a `replied` line names the status.
|
|
293
|
+
- `resources`, the reader of the resources of a container. `read` prints one JSON line with the text of each file of a cgroup and of `/proc/net/dev`, between two monotonic stamps. `watch` prints one line each period. Each line of a series has its place on the clock from the start of the series. Thus a slow reading does not move the later ones.
|
|
245
294
|
- `inject`, which applies a fault in one `iptables-restore` commit, with monotonic stamps around the commit. Thus the start of a fault is known in the VM. A `docker exec` from Windows comes 190 ms late at the median. With `--via DEV`, the rules go in the FORWARD chain, on the device toward one side. `--protocol` and `--handshake pass` change the match of a rule, and `inject silence` drops each packet of its namespace.
|
|
246
295
|
- `inject` also sends a signal to a process by its name (`signal`), and one command to a server of the Redis protocol (`resp`). Stamps bracket each.
|
|
247
296
|
- **The Node client image** (`image/node`) is a driver client: ioredis 6.0.0 on Node 24.21.0. The digest of the image and an npm lockfile pin them. `client-ioredis.mjs` prints the lines of the TCP client on the same clock, and it adds the status changes of ioredis as `status` lines. The same image holds the client of a group in Sentinel mode (`client-sentinel.mjs`) and the observer of its Sentinels (`observer.mjs`).
|
|
@@ -580,4 +629,15 @@ In the lab tests, each HTTP client sends two requests on one connection to a Nod
|
|
|
580
629
|
|
|
581
630
|
The lab tests also step a replica set of three members of MongoDB 9.0.4 down, and they write the free memory of the machine. They also reset a write of the MongoDB driver in flight to a set of one member. They move the leadership of a quorum queue of a cluster of three nodes of RabbitMQ 4.3.6.
|
|
582
631
|
|
|
632
|
+
The tests of `resources.ts` read recorded texts of the files of a cgroup and of `/proc/net/dev`. They test the change between two readings, a counter that went down, a file with no read, and the limits of a container.
|
|
633
|
+
|
|
634
|
+
`HARNESS_RESOURCES=1` starts the proof of the readings on real containers, in the workflow `resources.yml`. A Node server has a quota of 0.5 CPUs on CPU 0 and a memory limit of 256 MiB. The client `load` and the readers have another CPU.
|
|
635
|
+
|
|
636
|
+
- The server burns 2 s of CPU time by its own count. The CPU time of the readings is from 3 % less to 25 % more than that count. With the quota of 0.5 CPUs, the burn takes 3.8 s or more, and the limit stops the server in 20 periods or more.
|
|
637
|
+
- The server holds 64 MiB, and the anonymous memory of the readings rises by that amount, from 10 % less to 100 % more.
|
|
638
|
+
- The server sends 24 bodies of 1 MiB, and its devices sent those bytes, with 8 % more at most.
|
|
639
|
+
- The series has a reading each second, within 25 %, and the server used 0.5 CPUs between two readings of the burn, within 0.1 CPUs.
|
|
640
|
+
- The readings of the client are the control. Its CPU time is less than half of the burn, and its namespace sent less than 10 % of the bytes. Thus a reader of the wrong container fails the test.
|
|
641
|
+
- After the end of the client, a reading of its series has null for each value of its cgroup, and a `read()` throws.
|
|
642
|
+
|
|
583
643
|
`pnpm --filter @mark1russell7/harness build` writes the package for npm into `build/`.
|
|
@@ -1,6 +1,209 @@
|
|
|
1
1
|
import { Quantity } from "@mark1russell7/quantity";
|
|
2
2
|
import { Profile, Schedule, ScheduleOptions } from "@mark1russell7/rigor-chaos";
|
|
3
3
|
import { KernelRecord } from "@mark1russell7/prober";
|
|
4
|
+
/**
|
|
5
|
+
* The resources that one container of a lab used. A reader in a sidecar reads the files of the
|
|
6
|
+
* cgroup of the container and the devices of its network namespace (`RESOURCES_PROGRAM`). It
|
|
7
|
+
* writes the text of each file in one JSON line, with a stamp on CLOCK_MONOTONIC. This module reads
|
|
8
|
+
* each file from that line, and it gives the change between two readings.
|
|
9
|
+
*
|
|
10
|
+
* A file that the reader cannot read gives null: no read. It does not give a zero.
|
|
11
|
+
*/
|
|
12
|
+
/** This name is the event of a line of the reader. */
|
|
13
|
+
declare const RESOURCES_EVENT = "resources";
|
|
14
|
+
/** This path is the reader of the resources, in the image of the harness. */
|
|
15
|
+
declare const RESOURCES_PROGRAM = "/opt/harness/resources";
|
|
16
|
+
/** These are the counters of `cpu.stat` of a cgroup. Each time is in microseconds, as the kernel gives it. */
|
|
17
|
+
interface ResourceCpu {
|
|
18
|
+
/** This time is `usage_usec`: the CPU time of the tasks of the cgroup. */
|
|
19
|
+
readonly usage: number;
|
|
20
|
+
/** This time is `user_usec`: the part of the usage in user mode. */
|
|
21
|
+
readonly user: number;
|
|
22
|
+
/** This time is `system_usec`: the part of the usage in the kernel. */
|
|
23
|
+
readonly system: number;
|
|
24
|
+
/** This count is `nr_periods`: the periods of the CPU limit. It is null in a cgroup with no `cpu` controller. */
|
|
25
|
+
readonly periods: number | null;
|
|
26
|
+
/** This count is `nr_throttled`: the periods in which the limit stopped the cgroup. */
|
|
27
|
+
readonly throttled: number | null;
|
|
28
|
+
/** This time is `throttled_usec`: how long the limit stopped the cgroup. */
|
|
29
|
+
readonly throttledTime: number | null;
|
|
30
|
+
}
|
|
31
|
+
/** These are the amounts of memory of a cgroup, in bytes. Each one is null when its file or its key gave no read. */
|
|
32
|
+
interface ResourceMemory {
|
|
33
|
+
/** This amount is `memory.current`: the memory that the cgroup holds at this time. */
|
|
34
|
+
readonly current: number | null;
|
|
35
|
+
/** This amount is `memory.peak`: the highest `memory.current` of the cgroup. A kernel before Linux 5.19 has no such file. */
|
|
36
|
+
readonly peak: number | null;
|
|
37
|
+
/** This amount is `anon` of `memory.stat`: the anonymous memory, for example the heap of a program. */
|
|
38
|
+
readonly anon: number | null;
|
|
39
|
+
/** This amount is `file` of `memory.stat`: the page cache. */
|
|
40
|
+
readonly file: number | null;
|
|
41
|
+
/** This amount is `kernel` of `memory.stat`. Where the kernel has no such key, it is `kernel_stack` and `slab`. */
|
|
42
|
+
readonly kernel: number | null;
|
|
43
|
+
/** This amount is `sock` of `memory.stat`: the buffers of the sockets. */
|
|
44
|
+
readonly sock: number | null;
|
|
45
|
+
/** These are the counts of `memory.events`, for example `max` and `oom_kill`. */
|
|
46
|
+
readonly events: Readonly<Record<string, number>> | null;
|
|
47
|
+
}
|
|
48
|
+
/** These are the bytes and the packets of one direction of a device. */
|
|
49
|
+
interface ResourceTraffic {
|
|
50
|
+
readonly bytes: number;
|
|
51
|
+
readonly packets: number;
|
|
52
|
+
}
|
|
53
|
+
/** These are the counters of one device of a network namespace: what it received (`rx`) and what it sent (`tx`). */
|
|
54
|
+
interface ResourceDevice {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly rx: ResourceTraffic;
|
|
57
|
+
readonly tx: ResourceTraffic;
|
|
58
|
+
}
|
|
59
|
+
/** These are the counters of the devices of a network namespace, without `lo`, and their sums. */
|
|
60
|
+
interface ResourceNetwork {
|
|
61
|
+
/** These are the devices, in the order of their names. */
|
|
62
|
+
readonly devices: readonly ResourceDevice[];
|
|
63
|
+
readonly rx: ResourceTraffic;
|
|
64
|
+
readonly tx: ResourceTraffic;
|
|
65
|
+
}
|
|
66
|
+
/** These are the limits of a cgroup, as the kernel prints them. Each one is null when its file gave no read. */
|
|
67
|
+
interface ResourceLimits {
|
|
68
|
+
/** This limit is `cpu.max`: the CPU time of each period in microseconds, or `max` for no limit. */
|
|
69
|
+
readonly cpu: {
|
|
70
|
+
readonly quota: number | "max";
|
|
71
|
+
readonly period: number;
|
|
72
|
+
} | null;
|
|
73
|
+
/** This limit is `memory.max` in bytes, or `max` for no limit. */
|
|
74
|
+
readonly memory: number | "max" | null;
|
|
75
|
+
/** This list is `cpuset.cpus.effective`: the CPUs of the cgroup, for example `0-3`. */
|
|
76
|
+
readonly cpuset: string | null;
|
|
77
|
+
}
|
|
78
|
+
/** A resource reading is the resources of one container at one moment. */
|
|
79
|
+
interface ResourceReading {
|
|
80
|
+
/** This stamp is the time on CLOCK_MONOTONIC before the first file, in nanoseconds. The reader reads `cpu.stat` first. */
|
|
81
|
+
readonly t0: number;
|
|
82
|
+
/** This stamp is the time on CLOCK_MONOTONIC after the last file, in nanoseconds. */
|
|
83
|
+
readonly t1: number;
|
|
84
|
+
/** This folder is the cgroup of the container, as the reader found it. */
|
|
85
|
+
readonly cgroup: string;
|
|
86
|
+
readonly cpu: ResourceCpu | null;
|
|
87
|
+
readonly memory: ResourceMemory;
|
|
88
|
+
/** This count is `pids.current`: the tasks of the cgroup. */
|
|
89
|
+
readonly pids: number | null;
|
|
90
|
+
readonly network: ResourceNetwork | null;
|
|
91
|
+
readonly limits: ResourceLimits;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* A resource change is what a container used between two readings. A part is null when a file of
|
|
95
|
+
* it gave no read in one of the readings, or when a counter of it went down. `resets` names each
|
|
96
|
+
* counter that went down, because a negative use has no meaning.
|
|
97
|
+
*/
|
|
98
|
+
interface ResourceChange {
|
|
99
|
+
/** This time is the time between the first stamps of the two readings. */
|
|
100
|
+
readonly elapsed: Quantity;
|
|
101
|
+
readonly cpu: {
|
|
102
|
+
readonly total: Quantity;
|
|
103
|
+
readonly user: Quantity;
|
|
104
|
+
readonly system: Quantity;
|
|
105
|
+
/** This time is how long the CPU limit stopped the cgroup. It is null in a cgroup with no `cpu` controller. */
|
|
106
|
+
readonly throttled: Quantity | null;
|
|
107
|
+
/** This count is the periods of the CPU limit. */
|
|
108
|
+
readonly periods: number | null;
|
|
109
|
+
/** This count is the periods in which the limit stopped the cgroup. */
|
|
110
|
+
readonly throttledPeriods: number | null;
|
|
111
|
+
} | null;
|
|
112
|
+
readonly memory: {
|
|
113
|
+
/** This amount is `memory.current` at the second reading, in bytes. */
|
|
114
|
+
readonly last: number | null;
|
|
115
|
+
/** This amount is `memory.peak` at the second reading, in bytes: the highest usage of the cgroup from its start. */
|
|
116
|
+
readonly peak: number | null;
|
|
117
|
+
/** This choice says that the peak rose between the two readings. The peak is then the peak of that time. */
|
|
118
|
+
readonly peakBetween: boolean | null;
|
|
119
|
+
};
|
|
120
|
+
/** This part is the traffic of each device and the sums. A device that came after the first reading counts from 0. */
|
|
121
|
+
readonly network: ResourceNetwork | null;
|
|
122
|
+
/** These are the counters that went down, for example `cpu.usage` after a restart of the container. */
|
|
123
|
+
readonly resets: readonly string[];
|
|
124
|
+
}
|
|
125
|
+
/** These are the options of a reader of the resources of a container. */
|
|
126
|
+
interface ResourceOptions {
|
|
127
|
+
/** This time is the period of a series, for example 1 s. Without it, the reader has no series. */
|
|
128
|
+
readonly period?: Quantity;
|
|
129
|
+
/** This list is the CPUs that the kernel puts the reader on, for example the CPUs of the client. Without it, the reader has no such limit. */
|
|
130
|
+
readonly cpuset?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* A resource reader reads the resources of one container from a sidecar. The sidecar is in the
|
|
134
|
+
* network namespace of the container and in the cgroup namespace of the host. It is not in the
|
|
135
|
+
* cgroup of the container, thus its own CPU time and memory are not in the readings.
|
|
136
|
+
*/
|
|
137
|
+
interface ResourceReader {
|
|
138
|
+
/** These are the readings of the series, as they arrive. A reader with no period has none. */
|
|
139
|
+
readonly series: readonly ResourceReading[];
|
|
140
|
+
/**
|
|
141
|
+
* This method gives one reading at this moment. The stamps of the reading are the times of the
|
|
142
|
+
* read in the VM, thus the latency of the call is not in them.
|
|
143
|
+
*/
|
|
144
|
+
read(): Promise<ResourceReading>;
|
|
145
|
+
/** This method stops the sidecar. The series keeps its readings. */
|
|
146
|
+
stop(): Promise<void>;
|
|
147
|
+
}
|
|
148
|
+
/** These are the fields of the `HostConfig` of the Docker API that hold the limits of a container. */
|
|
149
|
+
interface HostLimits {
|
|
150
|
+
/** This count is the CPU quota, in units of 1e-9 CPUs. */
|
|
151
|
+
NanoCpus?: number;
|
|
152
|
+
/** This list is the CPUs that the kernel puts the container on. */
|
|
153
|
+
CpusetCpus?: string;
|
|
154
|
+
/** This amount is the memory limit, in bytes. */
|
|
155
|
+
Memory?: number;
|
|
156
|
+
/** This amount is the limit of the memory and the swap together, in bytes. It is equal to `Memory`, thus the container has no swap. */
|
|
157
|
+
MemorySwap?: number;
|
|
158
|
+
}
|
|
159
|
+
/** This function gives the problems of the limits of a container, each as a sentence. Limits with no problem give an empty list. */
|
|
160
|
+
declare const limitsProblems: (limits: ContainerLimits) => string[];
|
|
161
|
+
/**
|
|
162
|
+
* This function gives the limits of a container as Docker takes them: the CPU quota, the CPUs and
|
|
163
|
+
* the memory, with no swap. It throws for limits that have a problem (`limitsProblems`).
|
|
164
|
+
*/
|
|
165
|
+
declare const hostLimitsOf: (limits: ContainerLimits) => HostLimits;
|
|
166
|
+
/**
|
|
167
|
+
* This function gives the argv of the reader: one reading, or a series with a period. Each folder
|
|
168
|
+
* is a place where the cgroup of the container can be. The reader takes the first one that is there.
|
|
169
|
+
*/
|
|
170
|
+
declare const resourceArgs: (dirs: readonly string[], period?: Quantity) => string[];
|
|
171
|
+
/** This function gives the count of a file of a cgroup that holds one count, as `memory.current` does. Another text gives null. */
|
|
172
|
+
declare const cgroupNumber: (text: string) => number | null;
|
|
173
|
+
/** This function gives a limit of a cgroup, as `memory.max` prints it: its count, or `max` for no limit. Another text gives null. */
|
|
174
|
+
declare const cgroupLimit: (text: string) => number | "max" | null;
|
|
175
|
+
/**
|
|
176
|
+
* This function gives the counts of a flat keyed file of a cgroup: one key and one count on each
|
|
177
|
+
* line. `cpu.stat` and `memory.stat` are such files. It skips each other line.
|
|
178
|
+
*/
|
|
179
|
+
declare const cgroupKeyed: (text: string) => Readonly<Record<string, number>>;
|
|
180
|
+
/** This function reads `cpu.stat`. It gives null for a text with no usage. */
|
|
181
|
+
declare const cpuStatOf: (text: string) => ResourceCpu | null;
|
|
182
|
+
/** This function reads `memory.stat`: the amounts of `anon`, `file`, `kernel` and `sock`, each null without its key. */
|
|
183
|
+
declare const memoryStatOf: (text: string) => Pick<ResourceMemory, "anon" | "file" | "kernel" | "sock">;
|
|
184
|
+
/** This function reads `cpu.max`: the quota and the period, as `50000 100000` or `max 100000`. Another text gives null. */
|
|
185
|
+
declare const cpuMaxOf: (text: string) => ResourceLimits["cpu"];
|
|
186
|
+
/**
|
|
187
|
+
* This function reads `/proc/net/dev`: the bytes and the packets of each device, without `lo`. It
|
|
188
|
+
* gives null for a text that is not that file, and for a line of a device that it cannot read.
|
|
189
|
+
*/
|
|
190
|
+
declare const networkOf: (text: string) => ResourceNetwork | null;
|
|
191
|
+
/**
|
|
192
|
+
* This function gives the reading of one line of the reader (`RESOURCES_EVENT`). It gives null for
|
|
193
|
+
* another line, and for a line with no stamps.
|
|
194
|
+
*/
|
|
195
|
+
declare const resourceReadingOf: (line: ProbeEvent) => ResourceReading | null;
|
|
196
|
+
/**
|
|
197
|
+
* This function gives the reading of the output of one read of the reader. It throws for a text
|
|
198
|
+
* that is not a line of a reading.
|
|
199
|
+
*/
|
|
200
|
+
declare const resourceReadingIn: (output: string) => ResourceReading;
|
|
201
|
+
/**
|
|
202
|
+
* This function gives what a container used between two readings. It gives its CPU time, the time
|
|
203
|
+
* that its CPU limit stopped it, the traffic of each device, and its last memory. A counter that
|
|
204
|
+
* went down is in `resets`, and its part is null. It throws when the second reading is the earlier one.
|
|
205
|
+
*/
|
|
206
|
+
declare const resourceChange: (before: ResourceReading, after: ResourceReading) => ResourceChange;
|
|
4
207
|
/**
|
|
5
208
|
* A fault is a failure that the harness injects, by the name of its manifestation. Each name is
|
|
6
209
|
* the last segment of the identifier of the manifestation in the corpus:
|
|
@@ -1224,6 +1427,24 @@ interface Target {
|
|
|
1224
1427
|
* and the script of its server.
|
|
1225
1428
|
*/
|
|
1226
1429
|
readonly subject?: ImageSource;
|
|
1430
|
+
/**
|
|
1431
|
+
* These are the limits of the container of the target: its CPU quota, its CPUs and its memory.
|
|
1432
|
+
* Without them, the target has no limit.
|
|
1433
|
+
*/
|
|
1434
|
+
readonly limits?: ContainerLimits;
|
|
1435
|
+
}
|
|
1436
|
+
/**
|
|
1437
|
+
* These are the limits of one container of a lab, as Docker writes them into the cgroup of the
|
|
1438
|
+
* container. A measurement of the cost of a server gives the server a CPU limit and a memory
|
|
1439
|
+
* limit. It keeps the client on other CPUs.
|
|
1440
|
+
*/
|
|
1441
|
+
interface ContainerLimits {
|
|
1442
|
+
/** This count is the CPUs that the container can use, for example 1 or 0.5. It becomes the quota of `cpu.max`. */
|
|
1443
|
+
readonly cpus?: number;
|
|
1444
|
+
/** This list is the CPUs that the kernel puts the container on, as `cpuset.cpus` takes it: `0`, `2-3` or `0,2`. */
|
|
1445
|
+
readonly cpuset?: string;
|
|
1446
|
+
/** This amount is the memory limit of the container (`memory.max`), for example 512 MiB. The container gets no swap. */
|
|
1447
|
+
readonly memory?: Quantity;
|
|
1227
1448
|
}
|
|
1228
1449
|
/**
|
|
1229
1450
|
* A shipped image is an image that the harness ships, by its name. Its build context is in the
|
|
@@ -1523,6 +1744,18 @@ interface Cell {
|
|
|
1523
1744
|
* the container starts, and then it makes the file `/tmp/cgroup` in it.
|
|
1524
1745
|
*/
|
|
1525
1746
|
readonly cgroup?: Readonly<Record<string, string>>;
|
|
1747
|
+
/**
|
|
1748
|
+
* These are the limits of the container of the client in each run: its CPU quota, its CPUs and its
|
|
1749
|
+
* memory. A measurement of the cost of a target puts the client on other CPUs than the target.
|
|
1750
|
+
* Without them, the client has no limit.
|
|
1751
|
+
*/
|
|
1752
|
+
readonly clientLimits?: ContainerLimits;
|
|
1753
|
+
/**
|
|
1754
|
+
* These options start a reader of the resources of the target in each run (`Lab.resources`). The
|
|
1755
|
+
* run then keeps a reading when its client is ready, a reading at its end, and the series of the
|
|
1756
|
+
* reader (`Run.resources`). Without them, a run reads no resources.
|
|
1757
|
+
*/
|
|
1758
|
+
readonly resources?: ResourceOptions;
|
|
1526
1759
|
readonly prediction: Prediction;
|
|
1527
1760
|
/** This side is the side whose detection the cell measures. Without it, the side is the client. */
|
|
1528
1761
|
readonly observer?: Observer;
|
|
@@ -1746,6 +1979,19 @@ interface Run {
|
|
|
1746
1979
|
readonly schedule?: Schedule;
|
|
1747
1980
|
/** These schedules are the ones that the streams of the client `load` had. */
|
|
1748
1981
|
readonly streams?: readonly RunStream[];
|
|
1982
|
+
/** These are the readings of the resources of the target in a run of a cell with `Cell.resources`. */
|
|
1983
|
+
readonly resources?: RunResources;
|
|
1984
|
+
}
|
|
1985
|
+
/**
|
|
1986
|
+
* These are the readings of the resources of the target in one run. The two readings bracket the
|
|
1987
|
+
* work of the run. The reading `start` comes after the client is ready and before it sends. The
|
|
1988
|
+
* reading `end` comes after the run ended. `resourceChange(start, end)` gives what the target used.
|
|
1989
|
+
*/
|
|
1990
|
+
interface RunResources {
|
|
1991
|
+
readonly start: ResourceReading;
|
|
1992
|
+
readonly end: ResourceReading;
|
|
1993
|
+
/** These are the readings of the series of the reader, from its start to its stop. A reader with no period has none. */
|
|
1994
|
+
readonly series: readonly ResourceReading[];
|
|
1749
1995
|
}
|
|
1750
1996
|
/** A run route is one change of a route at a leaf of a fabric, on the monotonic clock. */
|
|
1751
1997
|
interface RunRoute {
|
|
@@ -1877,4 +2123,4 @@ interface RunTopology {
|
|
|
1877
2123
|
};
|
|
1878
2124
|
}>>;
|
|
1879
2125
|
}
|
|
1880
|
-
export {
|
|
2126
|
+
export { MiddleboxEvent as $, RESOURCES_PROGRAM as $t, HopEvent as A, RunGroup as At, KernelRecord as B, ShippedImage as Bt, Fault as C, RequestPrediction as Ct, GroupPrediction as D, RunBackup as Dt, GroupPlace as E, Run as Et, HttpProbe as F, RunStream as Ft, LoadPrediction as G, Topology as Gt, LineMatch as H, StageBand as Ht, ImageSource as I, RunTopology as It, MemoryOomPrediction as J, environmentProblems as Jt, LoadStream as K, Toxic as Kt, Jitter as L, SentinelEvent as Lt, HopSignal as M, RunPause as Mt, HopWrite as N, RunResources as Nt, GroupRole as O, RunDrill as Ot, HostSysctl as P, RunRoute as Pt, MemoryThrottlePrediction as Q, RESOURCES_EVENT as Qt, Kafka as R, SentinelStage as Rt, FabricManifest as S, resourceReadingOf as Sn, Replies as St, Group as T, RttRange as Tt, LoadBand as U, Subject as Ut, LineCount as V, Stage as Vt, LoadPlan as W, Target as Wt, MemoryPrediction as X, latestEndOf as Xt, MemoryOomTask as Y, isHopPlace as Yt, MemoryStep as Z, HostLimits as Zt, DriverStep as _, memoryStatOf as _n, Reconnects as _t, ClientCapability as a, ResourceNetwork as an, PauseBand as at, EgressPrediction as b, resourceChange as bn, ReplicaSet as bt, ClusterClientAt as c, ResourceReading as cn, PortsPrediction as ct, ContainerLimits as d, cgroupLimit as dn, ProxyHop as dt, ResourceChange as en, MiddleboxExpectation as et, CountBand as f, cgroupNumber as fn, ProxyTime as ft, DriverBand as g, limitsProblems as gn, QueuePrediction as gt, DrillRoom as h, hostLimitsOf as hn, QueueEnd as ht, Client as i, ResourceMemory as in, Pair as it, HopPlace as j, RunPart as jt, Hop as k, RunFabric as kt, ClusterStage as l, ResourceTraffic as ln, Prediction as lt, Drill as m, cpuStatOf as mn, QueueConnection as mt, CLIENT_CAPABILITIES as n, ResourceDevice as nn, Observer as nt, ClientImage as o, ResourceOptions as on, PausePrediction as ot, DeliveryPrediction as p, cpuMaxOf as pn, QueueBand as pt, MemoryLimits as q, WsProbe as qt, Cell as r, ResourceLimits as rn, Outcomes as rt, Cluster as s, ResourceReader as sn, PinnedImage as st, BuildImage as t, ResourceCpu as tn, MiddleboxForm as tt, ConntrackPrediction as u, cgroupKeyed as un, ProbeEvent as ut, EgressBurst as v, networkOf as vn, Recovers as vt, FaultPlace as w, RouterHop as wt, Fabric as x, resourceReadingIn as xn, ReplicaSetStage as xt, EgressPacketLaw as y, resourceArgs as yn, Reference as yt, KafkaPause as z, Shipped as zt };
|