-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathinterfaces.ts
58 lines (50 loc) · 1.39 KB
/
interfaces.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Observable } from 'rxjs';
import { Command } from './command';
export interface AggregatedProcessStats {
/** Number of processes */
processes: number;
/** Percentage (from 0 to 100 * vcore) */
cpu: number;
/** Bytes */
memory: number;
/** Parent Process ID */
ppid: number;
/** Process ID */
pid: number;
/** Ms user + system time */
ctime: number;
/** Ms since the start of the process */
elapsed: number;
/** Ms since epoch */
timestamp: number;
}
export interface MonitoredProcess {
stats$: Observable<AggregatedProcessStats>;
stdout$: Observable<Buffer>;
stderr$: Observable<Buffer>;
run(): Observable<number>;
toString(): string;
}
export interface Metric {
name: string;
unit: string;
value: number;
componentValues?: number[];
}
export interface AggregatedMetric extends Metric {
componentValues: number[];
}
export interface MetricGroup {
name: string;
metrics: (Metric | AggregatedMetric)[];
}
export type Capture = (stats: Observable<AggregatedProcessStats>) => Observable<MetricGroup>;
// TODO: might need to allow reporters to say they are finished.
export type BenchmarkReporter = (command: Command, groups: MetricGroup[]) => void;