@untestutils/perf 0.5.0 → 0.5.1
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/dist/process-sample.d.mts +24 -0
- package/dist/process-sample.d.ts +2 -8
- package/dist/process-sample.d.ts.map +1 -1
- package/dist/start.d.mts +11 -0
- package/dist/start.d.ts.map +1 -1
- package/package.json +16 -16
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ProcessMetrics } from "./types.mjs";
|
|
2
|
+
export type ProcessSample = {
|
|
3
|
+
cpu: number;
|
|
4
|
+
memoryMb: number;
|
|
5
|
+
};
|
|
6
|
+
/** Sample CPU% and RSS (MB) for a PID via `ps` (Unix). Returns null if gone. */
|
|
7
|
+
export declare function sampleProcess(pid: number): ProcessSample | null;
|
|
8
|
+
export type SampleAccumulator = {
|
|
9
|
+
maxMemoryMb: number;
|
|
10
|
+
minMemoryMb: number;
|
|
11
|
+
maxCpuPct: number;
|
|
12
|
+
minCpuPct: number;
|
|
13
|
+
totalMemoryMb: number;
|
|
14
|
+
totalCpuPct: number;
|
|
15
|
+
samples: number;
|
|
16
|
+
};
|
|
17
|
+
export declare function createSampleAccumulator(): SampleAccumulator;
|
|
18
|
+
export declare function pushSample(acc: SampleAccumulator, sample: ProcessSample): void;
|
|
19
|
+
export declare function finalizeSamples(acc: SampleAccumulator): ProcessMetrics;
|
|
20
|
+
/** Poll `sampleProcess` until stopped. */
|
|
21
|
+
export declare function startProcessMonitor(pid: number, intervalMs?: number, onSample?: (s: ProcessSample) => void): {
|
|
22
|
+
acc: SampleAccumulator;
|
|
23
|
+
stop: () => void;
|
|
24
|
+
};
|
package/dist/process-sample.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProcessMetrics } from './types';
|
|
1
2
|
export type ProcessSample = {
|
|
2
3
|
cpu: number;
|
|
3
4
|
memoryMb: number;
|
|
@@ -15,14 +16,7 @@ export type SampleAccumulator = {
|
|
|
15
16
|
};
|
|
16
17
|
export declare function createSampleAccumulator(): SampleAccumulator;
|
|
17
18
|
export declare function pushSample(acc: SampleAccumulator, sample: ProcessSample): void;
|
|
18
|
-
export declare function finalizeSamples(acc: SampleAccumulator):
|
|
19
|
-
maxMemoryMb: number;
|
|
20
|
-
minMemoryMb: number;
|
|
21
|
-
avgMemoryMb: number;
|
|
22
|
-
maxCpuPct: number;
|
|
23
|
-
minCpuPct: number;
|
|
24
|
-
avgCpuPct: number;
|
|
25
|
-
};
|
|
19
|
+
export declare function finalizeSamples(acc: SampleAccumulator): ProcessMetrics;
|
|
26
20
|
/** Poll `sampleProcess` until stopped. */
|
|
27
21
|
export declare function startProcessMonitor(pid: number, intervalMs?: number, onSample?: (s: ProcessSample) => void): {
|
|
28
22
|
acc: SampleAccumulator;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-sample.d.ts","sourceRoot":"","sources":["../src/process-sample.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-sample.d.ts","sourceRoot":"","sources":["../src/process-sample.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,MAAM,aAAa,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,gFAAgF;AAChF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,IAAI,CAiB/D;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,wBAAgB,uBAAuB,IAAI,iBAAiB,CAU3D;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,iBAAiB,EAAE,MAAM,EAAE,aAAa,GAAG,IAAI,CAQ9E;AAED,wBAAgB,eAAe,CAAC,GAAG,EAAE,iBAAiB,GAAG,cAAc,CAStE;AAED,0CAA0C;AAC1C,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,MAAM,EACX,UAAU,SAAO,EACjB,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,GACpC;IAAE,GAAG,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,IAAI,CAAA;CAAE,CAY9C"}
|
package/dist/start.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PerfTarget, ProcessMetrics } from "./types.mjs";
|
|
2
|
+
export type StartedTarget = {
|
|
3
|
+
url: string;
|
|
4
|
+
port: number;
|
|
5
|
+
pid?: number;
|
|
6
|
+
stop: () => Promise<void>;
|
|
7
|
+
takeProcessMetrics: () => ProcessMetrics;
|
|
8
|
+
};
|
|
9
|
+
/** True when nothing is listening / bound on host:port. */
|
|
10
|
+
export declare function isPortFree(port: number, host?: string): Promise<boolean>;
|
|
11
|
+
export declare function startTarget(target: PerfTarget): Promise<StartedTarget>;
|
package/dist/start.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,kBAAkB,EAAE,MAAM,cAAc,CAAC;CAC1C,CAAC;AAEF,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../src/start.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,kBAAkB,EAAE,MAAM,cAAc,CAAC;CAC1C,CAAC;AAEF,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,GAAE,MAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAQvF;AAED,wBAAsB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAyF5E"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@untestutils/perf",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Build + load performance harness for recipe/fixture targets",
|
|
5
|
+
"homepage": "https://s00d.github.io/untestutils/",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/s00d/untestutils.git",
|
|
10
|
+
"directory": "packages/perf"
|
|
11
|
+
},
|
|
5
12
|
"files": [
|
|
6
13
|
"dist"
|
|
7
14
|
],
|
|
8
15
|
"type": "module",
|
|
9
16
|
"sideEffects": false,
|
|
17
|
+
"main": "./dist/index.mjs",
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
10
19
|
"exports": {
|
|
11
20
|
".": {
|
|
12
21
|
"types": "./dist/index.d.ts",
|
|
@@ -15,15 +24,18 @@
|
|
|
15
24
|
},
|
|
16
25
|
"./package.json": "./package.json"
|
|
17
26
|
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
18
30
|
"dependencies": {
|
|
19
31
|
"pathe": "^2.0.3",
|
|
20
|
-
"@untestutils/core": "0.5.
|
|
32
|
+
"@untestutils/core": "0.5.1"
|
|
21
33
|
},
|
|
22
34
|
"devDependencies": {
|
|
23
35
|
"@types/node": "^26.6.1",
|
|
36
|
+
"obuild": "^0.4.40",
|
|
24
37
|
"publint": "^0.3.24",
|
|
25
|
-
"typescript": "^6.0.3"
|
|
26
|
-
"obuild": "^0.4.40"
|
|
38
|
+
"typescript": "^6.0.3"
|
|
27
39
|
},
|
|
28
40
|
"peerDependencies": {
|
|
29
41
|
"artillery": "*",
|
|
@@ -40,18 +52,6 @@
|
|
|
40
52
|
"engines": {
|
|
41
53
|
"node": ">=20"
|
|
42
54
|
},
|
|
43
|
-
"license": "MIT",
|
|
44
|
-
"homepage": "https://s00d.github.io/untestutils/",
|
|
45
|
-
"repository": {
|
|
46
|
-
"type": "git",
|
|
47
|
-
"url": "git+https://github.com/s00d/untestutils.git",
|
|
48
|
-
"directory": "packages/perf"
|
|
49
|
-
},
|
|
50
|
-
"main": "./dist/index.mjs",
|
|
51
|
-
"types": "./dist/index.d.ts",
|
|
52
|
-
"publishConfig": {
|
|
53
|
-
"access": "public"
|
|
54
|
-
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
57
57
|
"build": "obuild && tsc -p tsconfig.build.json",
|