@vpalmisano/webrtcperf 4.4.12 → 4.4.14
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/src/plot.d.ts +75 -8
- package/build/src/plot.js +106 -32
- package/build/src/plot.js.map +1 -1
- package/build/src/scenarios.d.ts +5 -4
- package/build/src/scenarios.js +51 -8
- package/build/src/scenarios.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/plot.ts +125 -47
- package/src/scenarios.ts +57 -8
package/build/src/plot.d.ts
CHANGED
|
@@ -1,13 +1,80 @@
|
|
|
1
|
-
export type PlotData = {
|
|
2
|
-
x: (string | number)[];
|
|
3
|
-
y: number[];
|
|
4
|
-
label: string;
|
|
5
|
-
};
|
|
6
1
|
export type PlotOptions = {
|
|
7
2
|
type?: string;
|
|
8
3
|
title?: string;
|
|
4
|
+
xLabel?: string;
|
|
5
|
+
yLabel?: string;
|
|
6
|
+
yMin?: number;
|
|
7
|
+
yMax?: number;
|
|
8
|
+
labels?: (string | number)[];
|
|
9
9
|
filePath?: string;
|
|
10
|
-
min?: number;
|
|
11
|
-
max?: number;
|
|
12
10
|
};
|
|
13
|
-
export
|
|
11
|
+
export type PlotData = {
|
|
12
|
+
label: string;
|
|
13
|
+
data: {
|
|
14
|
+
x: number | string;
|
|
15
|
+
y: number;
|
|
16
|
+
yMin?: number;
|
|
17
|
+
yMax?: number;
|
|
18
|
+
}[];
|
|
19
|
+
};
|
|
20
|
+
export declare function plotConfig(options: PlotOptions, series: PlotData[]): {
|
|
21
|
+
type: any;
|
|
22
|
+
options: {
|
|
23
|
+
plugins: {
|
|
24
|
+
title: {
|
|
25
|
+
display: boolean;
|
|
26
|
+
text: string;
|
|
27
|
+
} | undefined;
|
|
28
|
+
zoom: {
|
|
29
|
+
pan: {
|
|
30
|
+
enabled: boolean;
|
|
31
|
+
mode: string;
|
|
32
|
+
modifierKey: string;
|
|
33
|
+
};
|
|
34
|
+
zoom: {
|
|
35
|
+
drag: {
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
};
|
|
38
|
+
mode: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
scales: {
|
|
43
|
+
x: {
|
|
44
|
+
type: string;
|
|
45
|
+
title: {
|
|
46
|
+
display: boolean;
|
|
47
|
+
text: string;
|
|
48
|
+
} | undefined;
|
|
49
|
+
};
|
|
50
|
+
y: {
|
|
51
|
+
type: string;
|
|
52
|
+
title: {
|
|
53
|
+
display: boolean;
|
|
54
|
+
text: string;
|
|
55
|
+
} | undefined;
|
|
56
|
+
min: number | undefined;
|
|
57
|
+
max: number | undefined;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
data: {
|
|
62
|
+
labels: (string | number)[] | undefined;
|
|
63
|
+
datasets: {
|
|
64
|
+
label: string;
|
|
65
|
+
data: {
|
|
66
|
+
x: number | string;
|
|
67
|
+
y: number;
|
|
68
|
+
yMin?: number;
|
|
69
|
+
yMax?: number;
|
|
70
|
+
}[];
|
|
71
|
+
fill: boolean;
|
|
72
|
+
backgroundColor: string;
|
|
73
|
+
borderColor: string;
|
|
74
|
+
borderWidth: number;
|
|
75
|
+
pointRadius: number;
|
|
76
|
+
}[];
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
export declare function plot(options: PlotOptions, series: PlotData[]): Promise<void>;
|
|
80
|
+
export declare function plotHtml(options: PlotOptions, series: PlotData[]): Promise<void>;
|
package/build/src/plot.js
CHANGED
|
@@ -1,50 +1,124 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.plotConfig = plotConfig;
|
|
3
7
|
exports.plot = plot;
|
|
8
|
+
exports.plotHtml = plotHtml;
|
|
9
|
+
const fs_1 = __importDefault(require("fs"));
|
|
4
10
|
const utils_1 = require("./utils");
|
|
11
|
+
const json5_1 = __importDefault(require("json5"));
|
|
5
12
|
const log = (0, utils_1.logger)('webrtcperf:plot');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
type: options.type || 'line',
|
|
19
|
-
data: {
|
|
20
|
-
labels: data.x,
|
|
21
|
-
datasets: [
|
|
22
|
-
{
|
|
23
|
-
label: data.label,
|
|
24
|
-
data: data.y,
|
|
25
|
-
fill: false,
|
|
26
|
-
borderColor: 'rgb(0, 0, 0)',
|
|
27
|
-
borderWidth: 1,
|
|
28
|
-
pointRadius: 0,
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
13
|
+
const SERIES_COLORS = [
|
|
14
|
+
'rgba(33, 150, 243, 1)',
|
|
15
|
+
'rgba(244, 67, 54, 1)',
|
|
16
|
+
'rgba(76, 175, 80, 1)',
|
|
17
|
+
'rgba(255, 193, 7, 1)',
|
|
18
|
+
'rgba(156, 39, 176, 1)',
|
|
19
|
+
];
|
|
20
|
+
function plotConfig(options, series) {
|
|
21
|
+
log.debug('plotConfig');
|
|
22
|
+
return {
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
24
|
+
type: (options.type || 'line'),
|
|
32
25
|
options: {
|
|
33
26
|
plugins: {
|
|
34
|
-
title:
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
title: options.title
|
|
28
|
+
? {
|
|
29
|
+
display: true,
|
|
30
|
+
text: options.title,
|
|
31
|
+
}
|
|
32
|
+
: undefined,
|
|
33
|
+
zoom: {
|
|
34
|
+
pan: {
|
|
35
|
+
enabled: true,
|
|
36
|
+
mode: 'x',
|
|
37
|
+
modifierKey: 'ctrl',
|
|
38
|
+
},
|
|
39
|
+
zoom: {
|
|
40
|
+
drag: {
|
|
41
|
+
enabled: true,
|
|
42
|
+
},
|
|
43
|
+
mode: 'x',
|
|
44
|
+
},
|
|
37
45
|
},
|
|
38
46
|
},
|
|
39
47
|
scales: {
|
|
48
|
+
x: {
|
|
49
|
+
type: 'category',
|
|
50
|
+
title: options.xLabel
|
|
51
|
+
? {
|
|
52
|
+
display: true,
|
|
53
|
+
text: options.xLabel,
|
|
54
|
+
}
|
|
55
|
+
: undefined,
|
|
56
|
+
},
|
|
40
57
|
y: {
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
type: 'linear',
|
|
59
|
+
title: options.yLabel
|
|
60
|
+
? {
|
|
61
|
+
display: true,
|
|
62
|
+
text: options.yLabel,
|
|
63
|
+
}
|
|
64
|
+
: undefined,
|
|
65
|
+
min: options.yMin,
|
|
66
|
+
max: options.yMax,
|
|
43
67
|
},
|
|
44
68
|
},
|
|
45
69
|
},
|
|
46
|
-
|
|
70
|
+
data: {
|
|
71
|
+
labels: options.labels,
|
|
72
|
+
datasets: series.map((s, i) => ({
|
|
73
|
+
fill: false,
|
|
74
|
+
backgroundColor: SERIES_COLORS[i % SERIES_COLORS.length],
|
|
75
|
+
borderColor: SERIES_COLORS[i % SERIES_COLORS.length],
|
|
76
|
+
borderWidth: 1,
|
|
77
|
+
pointRadius: 0,
|
|
78
|
+
...s,
|
|
79
|
+
})),
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
async function plot(options, series) {
|
|
84
|
+
const { CategoryScale, Chart, LinearScale, LineController, BarController, LineElement, BarElement, PointElement, Legend, Title, } = await import('chart.js');
|
|
85
|
+
const { BarWithErrorBar, BarWithErrorBarsController } = await import('chartjs-chart-error-bars');
|
|
86
|
+
Chart.register(CategoryScale, LineController, LineElement, BarController, LinearScale, BarElement, PointElement, Legend, Title, BarWithErrorBar, BarWithErrorBarsController);
|
|
87
|
+
const { Canvas } = await import('skia-canvas');
|
|
88
|
+
log.debug('plot');
|
|
89
|
+
const config = plotConfig(options, series);
|
|
90
|
+
const canvas = new Canvas(1280, 720);
|
|
91
|
+
const chart = new Chart(canvas, config);
|
|
47
92
|
await canvas.toFile(options.filePath || 'plot.png', { format: 'png', matte: 'white' });
|
|
48
93
|
chart.destroy();
|
|
49
94
|
}
|
|
95
|
+
async function plotHtml(options, series) {
|
|
96
|
+
log.debug('plotHtml');
|
|
97
|
+
const config = plotConfig(options, series);
|
|
98
|
+
const data = `
|
|
99
|
+
<!DOCTYPE html>
|
|
100
|
+
<html lang="en">
|
|
101
|
+
<head>
|
|
102
|
+
<meta charset="UTF-8">
|
|
103
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
104
|
+
<title>${options.title || 'Plot'}</title>
|
|
105
|
+
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
106
|
+
<script src="https://cdn.jsdelivr.net/npm/chartjs-chart-error-bars"></script>
|
|
107
|
+
<script src="https://cdn.jsdelivr.net/npm/hammerjs"></script>
|
|
108
|
+
<script src="https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom"></script>
|
|
109
|
+
</head>
|
|
110
|
+
<body>
|
|
111
|
+
<div>
|
|
112
|
+
<canvas id="chart"></canvas>
|
|
113
|
+
</div>
|
|
114
|
+
<script>
|
|
115
|
+
const ctx = document.getElementById('chart');
|
|
116
|
+
const chart = new Chart(ctx, ${json5_1.default.stringify(config)});
|
|
117
|
+
chart.options.onClick = e => e.chart.resetZoom();
|
|
118
|
+
addEventListener('resize', () => chart.resize());
|
|
119
|
+
</script>
|
|
120
|
+
</body>
|
|
121
|
+
</html>`;
|
|
122
|
+
await fs_1.default.promises.writeFile(options.filePath || 'plot.html', data);
|
|
123
|
+
}
|
|
50
124
|
//# sourceMappingURL=plot.js.map
|
package/build/src/plot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plot.js","sourceRoot":"","sources":["../../src/plot.ts"],"names":[],"mappings":"
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AC,OAAO,EAAE,MAAM,CAAC,CAAA;IAC1C,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IACpC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,MAAsC,EAAE,MAAM,CAAC,CAAA;IACvE,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,IAAI,UAAU,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAA;IACtF,KAAK,CAAC,OAAO,EAAE,CAAA;AACjB,CAAC;AAEM,KAAK,UAAU,QAAQ,CAAC,OAAoB,EAAE,MAAkB;IACrE,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,CAAA;IACrB,MAAM,MAAM,GAAG,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;IAE1C,MAAM,IAAI,GAAG;;;;;;WAMJ,OAAO,CAAC,KAAK,IAAI,MAAM;;;;;;;;;;;;mCAYC,eAAK,CAAC,SAAS,CAAC,MAAM,CAAC;;;;;QAKlD,CAAA;IACN,MAAM,YAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,IAAI,WAAW,EAAE,IAAI,CAAC,CAAA;AACpE,CAAC","sourcesContent":["import fs from 'fs'\n\nimport { logger } from './utils'\nimport json5 from 'json5'\n\nconst log = logger('webrtcperf:plot')\n\nexport type PlotOptions = {\n type?: string\n title?: string\n xLabel?: string\n yLabel?: string\n yMin?: number\n yMax?: number\n labels?: (string | number)[]\n filePath?: string\n}\n\nexport type PlotData = {\n label: string\n data: { x: number | string; y: number; yMin?: number; yMax?: number }[]\n}\n\nconst SERIES_COLORS = [\n 'rgba(33, 150, 243, 1)',\n 'rgba(244, 67, 54, 1)',\n 'rgba(76, 175, 80, 1)',\n 'rgba(255, 193, 7, 1)',\n 'rgba(156, 39, 176, 1)',\n]\n\nexport function plotConfig(options: PlotOptions, series: PlotData[]) {\n log.debug('plotConfig')\n\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n type: (options.type || 'line') as any,\n options: {\n plugins: {\n title: options.title\n ? {\n display: true,\n text: options.title,\n }\n : undefined,\n zoom: {\n pan: {\n enabled: true,\n mode: 'x',\n modifierKey: 'ctrl',\n },\n zoom: {\n drag: {\n enabled: true,\n },\n mode: 'x',\n },\n },\n },\n scales: {\n x: {\n type: 'category',\n title: options.xLabel\n ? {\n display: true,\n text: options.xLabel,\n }\n : undefined,\n },\n y: {\n type: 'linear',\n title: options.yLabel\n ? {\n display: true,\n text: options.yLabel,\n }\n : undefined,\n min: options.yMin,\n max: options.yMax,\n },\n },\n },\n data: {\n labels: options.labels,\n datasets: series.map((s, i) => ({\n fill: false,\n backgroundColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderColor: SERIES_COLORS[i % SERIES_COLORS.length],\n borderWidth: 1,\n pointRadius: 0,\n ...s,\n })),\n },\n }\n}\n\nexport async function plot(options: PlotOptions, series: PlotData[]) {\n const {\n CategoryScale,\n Chart,\n LinearScale,\n LineController,\n BarController,\n LineElement,\n BarElement,\n PointElement,\n Legend,\n Title,\n } = await import('chart.js')\n const { BarWithErrorBar, BarWithErrorBarsController } = await import('chartjs-chart-error-bars')\n Chart.register(\n CategoryScale,\n LineController,\n LineElement,\n BarController,\n LinearScale,\n BarElement,\n PointElement,\n Legend,\n Title,\n BarWithErrorBar,\n BarWithErrorBarsController,\n )\n const { Canvas } = await import('skia-canvas')\n\n log.debug('plot')\n const config = plotConfig(options, series)\n const canvas = new Canvas(1280, 720)\n const chart = new Chart(canvas as unknown as HTMLCanvasElement, config)\n await canvas.toFile(options.filePath || 'plot.png', { format: 'png', matte: 'white' })\n chart.destroy()\n}\n\nexport async function plotHtml(options: PlotOptions, series: PlotData[]) {\n log.debug('plotHtml')\n const config = plotConfig(options, series)\n\n const data = `\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>${options.title || 'Plot'}</title>\n <script src=\"https://cdn.jsdelivr.net/npm/chart.js\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-chart-error-bars\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/hammerjs\"></script>\n <script src=\"https://cdn.jsdelivr.net/npm/chartjs-plugin-zoom\"></script>\n</head>\n<body>\n <div>\n <canvas id=\"chart\"></canvas>\n </div>\n <script>\n const ctx = document.getElementById('chart');\n const chart = new Chart(ctx, ${json5.stringify(config)});\n chart.options.onClick = e => e.chart.resetZoom();\n addEventListener('resize', () => chart.resize());\n </script>\n</body>\n</html>`\n await fs.promises.writeFile(options.filePath || 'plot.html', data)\n}\n"]}
|
package/build/src/scenarios.d.ts
CHANGED
|
@@ -41,18 +41,19 @@ export declare function aggregateStatsSummary({ dirPath, senderParticipantName,
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function uploadStatsToGoogleSheet(stats: StatsSummary[], spreadsheetId: string, table?: string): Promise<void>;
|
|
43
43
|
export type ThrottleDirection = 'up' | 'down' | 'bidi';
|
|
44
|
-
export declare function formatBitrate(bitrate: number | undefined, prefix?: string): string;
|
|
45
|
-
export declare function formatLoss(loss: number | undefined, prefix?: string): string;
|
|
46
|
-
export declare function formatDelay(delay: number | undefined, prefix?: string): string;
|
|
44
|
+
export declare function formatBitrate(bitrate: number | undefined, prefix?: string, pad?: boolean): string;
|
|
45
|
+
export declare function formatLoss(loss: number | undefined, prefix?: string, pad?: boolean): string;
|
|
46
|
+
export declare function formatDelay(delay: number | undefined, prefix?: string, pad?: boolean): string;
|
|
47
47
|
export declare function formatThrottleRule(throttleRule: ThrottleRule & {
|
|
48
48
|
direction: ThrottleDirection;
|
|
49
|
-
}, human?: boolean): string;
|
|
49
|
+
}, human?: boolean, pad?: boolean): string;
|
|
50
50
|
export declare function parseThrottleRule(throttleDesc: string): {
|
|
51
51
|
direction: ThrottleDirection;
|
|
52
52
|
rate: number;
|
|
53
53
|
loss: number;
|
|
54
54
|
delay: number;
|
|
55
55
|
};
|
|
56
|
+
export declare function plotStatsSummary(stats: StatsSummary[]): Promise<void>;
|
|
56
57
|
/**
|
|
57
58
|
* It generates a test configuration with a scenario including 2 participants.
|
|
58
59
|
* The first participant sends video and the second receives it.
|
package/build/src/scenarios.js
CHANGED
|
@@ -11,6 +11,7 @@ exports.formatLoss = formatLoss;
|
|
|
11
11
|
exports.formatDelay = formatDelay;
|
|
12
12
|
exports.formatThrottleRule = formatThrottleRule;
|
|
13
13
|
exports.parseThrottleRule = parseThrottleRule;
|
|
14
|
+
exports.plotStatsSummary = plotStatsSummary;
|
|
14
15
|
exports.twoParticipantsWithRateLossDelay = twoParticipantsWithRateLossDelay;
|
|
15
16
|
const fs_1 = __importDefault(require("fs"));
|
|
16
17
|
const path_1 = __importDefault(require("path"));
|
|
@@ -18,6 +19,7 @@ const stats_1 = require("./stats");
|
|
|
18
19
|
const googleapis_1 = require("googleapis");
|
|
19
20
|
const utils_1 = require("./utils");
|
|
20
21
|
const sprintf_js_1 = require("sprintf-js");
|
|
22
|
+
const plot_1 = require("./plot");
|
|
21
23
|
const log = (0, utils_1.logger)('webrtcperf:scenarios');
|
|
22
24
|
/**
|
|
23
25
|
* It parses a CSV stats file and returns an array of objects representing each row.
|
|
@@ -147,7 +149,7 @@ async function uploadStatsToGoogleSheet(stats, spreadsheetId, table = 'data') {
|
|
|
147
149
|
});
|
|
148
150
|
}
|
|
149
151
|
}
|
|
150
|
-
function formatBitrate(bitrate, prefix = ' ') {
|
|
152
|
+
function formatBitrate(bitrate, prefix = ' ', pad = true) {
|
|
151
153
|
if (bitrate === undefined)
|
|
152
154
|
return '';
|
|
153
155
|
let suffix = 'Kbps';
|
|
@@ -155,18 +157,18 @@ function formatBitrate(bitrate, prefix = ' ') {
|
|
|
155
157
|
bitrate /= 1000;
|
|
156
158
|
suffix = 'Mbps';
|
|
157
159
|
}
|
|
158
|
-
return `${prefix}${(0, sprintf_js_1.sprintf)('
|
|
160
|
+
return `${prefix}${(0, sprintf_js_1.sprintf)(`%${pad ? '5' : ''}.4g`, bitrate)}${suffix}`;
|
|
159
161
|
}
|
|
160
|
-
function formatLoss(loss, prefix = ' ') {
|
|
161
|
-
return loss !== undefined ? `${prefix}${loss.toFixed(0).padStart(2, ' ')}%` : '';
|
|
162
|
+
function formatLoss(loss, prefix = ' ', pad = true) {
|
|
163
|
+
return loss !== undefined ? `${prefix}${loss.toFixed(0).padStart(pad ? 2 : 0, ' ')}%` : '';
|
|
162
164
|
}
|
|
163
|
-
function formatDelay(delay, prefix = ' ') {
|
|
164
|
-
return delay !== undefined ? `${prefix}${delay.toFixed(0).padStart(3, ' ')}ms` : '';
|
|
165
|
+
function formatDelay(delay, prefix = ' ', pad = true) {
|
|
166
|
+
return delay !== undefined ? `${prefix}${delay.toFixed(0).padStart(pad ? 3 : 0, ' ')}ms` : '';
|
|
165
167
|
}
|
|
166
|
-
function formatThrottleRule(throttleRule, human = false) {
|
|
168
|
+
function formatThrottleRule(throttleRule, human = false, pad = true) {
|
|
167
169
|
const { rate, loss, delay, direction } = throttleRule;
|
|
168
170
|
return human
|
|
169
|
-
? `${direction.padEnd(4, ' ')}${formatBitrate(rate)}${formatLoss(loss)}${formatDelay(delay)}`
|
|
171
|
+
? `${direction.padEnd(pad ? 4 : 0, ' ')}${formatBitrate(rate, ' ', pad)}${formatLoss(loss, ' ', pad)}${formatDelay(delay, ' ', pad)}`
|
|
170
172
|
: `${direction}-r${rate}-l${loss}-d${delay}`;
|
|
171
173
|
}
|
|
172
174
|
function parseThrottleRule(throttleDesc) {
|
|
@@ -179,6 +181,47 @@ function parseThrottleRule(throttleDesc) {
|
|
|
179
181
|
const delay = parseInt(match[4]);
|
|
180
182
|
return { direction, rate, loss, delay };
|
|
181
183
|
}
|
|
184
|
+
async function plotStatsSummary(stats) {
|
|
185
|
+
const labels = new Set();
|
|
186
|
+
const data = {};
|
|
187
|
+
stats.forEach(s => {
|
|
188
|
+
const { id, scenario, videoRecvBitratePerPixel } = s;
|
|
189
|
+
if (!videoRecvBitratePerPixel.length)
|
|
190
|
+
return null;
|
|
191
|
+
if (!data[id]) {
|
|
192
|
+
data[id] = {};
|
|
193
|
+
}
|
|
194
|
+
const scenarioFormatted = formatThrottleRule(parseThrottleRule(scenario), true, true);
|
|
195
|
+
if (!data[id][scenarioFormatted]) {
|
|
196
|
+
data[id][scenarioFormatted] = new stats_1.FastStats();
|
|
197
|
+
}
|
|
198
|
+
labels.add(scenarioFormatted);
|
|
199
|
+
data[id][scenarioFormatted].push(videoRecvBitratePerPixel.percentile(95));
|
|
200
|
+
});
|
|
201
|
+
const series = [];
|
|
202
|
+
Object.entries(data)
|
|
203
|
+
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
204
|
+
.forEach(([id, data]) => {
|
|
205
|
+
const plotData = { label: id, data: [] };
|
|
206
|
+
Object.entries(data)
|
|
207
|
+
.sort((a, b) => a[0].localeCompare(b[0]))
|
|
208
|
+
.forEach(([scenario, stats]) => {
|
|
209
|
+
plotData.data.push({
|
|
210
|
+
x: scenario,
|
|
211
|
+
y: stats.percentile(50),
|
|
212
|
+
yMin: stats.percentile(5),
|
|
213
|
+
yMax: stats.percentile(95),
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
series.push(plotData);
|
|
217
|
+
});
|
|
218
|
+
await (0, plot_1.plotHtml)({
|
|
219
|
+
type: 'barWithErrorBars',
|
|
220
|
+
xLabel: 'Scenario',
|
|
221
|
+
yLabel: 'Video Receive Bitrate per Pixel',
|
|
222
|
+
labels: Array.from(labels).sort((a, b) => a.localeCompare(b)),
|
|
223
|
+
}, series);
|
|
224
|
+
}
|
|
182
225
|
/**
|
|
183
226
|
* It generates a test configuration with a scenario including 2 participants.
|
|
184
227
|
* The first participant sends video and the second receives it.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scenarios.js","sourceRoot":"","sources":["../../src/scenarios.ts"],"names":[],"mappings":";;;;;AAgBA,wCAi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MAAM,QAAQ,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,YAAY,EAAE,CAAA;QAC7D,MAAM,QAAQ,GAAG,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,KAAK,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAA;QAChF,GAAG,CAAC,IAAI,CAAC;YACP,QAAQ,EAAE,CAAC;YACX,WAAW,EAAE,EAAE,GAAG,CAAC;YACnB,aAAa,EAAE,IAAI;YACnB,qBAAqB,EAAE,uBAAuB;YAC9C,4BAA4B,EAAE,EAAE;YAChC,SAAS,EAAE,GAAG,QAAQ,YAAY;YAClC,iBAAiB,EAAE,GAAG,QAAQ,qBAAqB;YACnD,WAAW,EAAE,KAAK;YAClB,SAAS,EAAE,KAAK;YAChB,aAAa,EAAE,CAAC;YAChB,YAAY,EAAE,IAAI,CAAC,SAAS,CAAC;gBAC3B,SAAS,EAAE,KAAK;gBAChB,SAAS,EAAE,GAAG;aACf,CAAC;YACF,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC;gBAC7B;oBACE,QAAQ;oBACR,QAAQ,EAAE,KAAK;oBACf,eAAe,EAAE,WAAW;oBAC5B,oBAAoB,EAAE,WAAW;oBACjC,GAAG,QAAQ;iBACZ;aACF,CAAC;SACH,CAAC,CAAA;IACJ,CAAC;IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { FastStats } from './stats'\nimport { ThrottleConfig, ThrottleRule } from '@vpalmisano/throttler'\nimport { Config } from './config'\nimport { Auth, google } from 'googleapis'\nimport { logger } from './utils'\nimport { sprintf } from 'sprintf-js'\n\nconst log = logger('webrtcperf:scenarios')\n\n/**\n * It parses a CSV stats file and returns an array of objects representing each row.\n * @param filePath The path to the CSV stats file.\n * @returns An array of objects where each object represents a row in the CSV file with keys as column headers.\n */\nexport async function parseStatsFile(filePath: string) {\n log.debug(`parseStatsFile: ${filePath}`)\n const fileData = await fs.promises.readFile(filePath, 'utf-8')\n const lines = fileData.split('\\n')\n const headers = lines[0].split(',')\n const data = lines.slice(1).map(line =>\n line.split(',').reduce(\n (acc, value, index) => {\n if (value !== '') {\n acc[headers[index]] = isNaN(Number(value)) ? value : Number(value)\n }\n return acc\n },\n {} as Record<string, string | number>,\n ),\n )\n return data\n}\n\nexport type StatsSummary = {\n timestamp: number\n id: string\n scenario: string\n videoRecvBitratePerPixel: FastStats\n videoRecvFps: FastStats\n videoSentFps: FastStats\n}\n\n/**\n * It aggregates the stats summary from multiple test runs in a directory.\n * @param options.dirPath Directory path containing test run subdirectories. Default is 'logs'.\n * @param options.senderParticipantName Participant name of the sender. Default is 'Participant-000001'.\n * @param options.receiverParticipantName Participant name of the receiver. Default is 'Participant-000000'.\n * @param options.nameParser Function to parse test directory names. Default splits by '_' and extracts id and scenario.\n * @returns Array of aggregated stats including timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps, and videoSentFps.\n */\nexport async function aggregateStatsSummary({\n dirPath = 'logs',\n senderParticipantName = 'Participant-000001',\n receiverParticipantName = 'Participant-000000',\n nameParser = (name: string) => {\n const [_, id, scenario] = name.split('_')\n return { id, scenario }\n },\n}) {\n log.debug(`aggregateStatsSummary: ${dirPath}`)\n const stats: StatsSummary[] = []\n const results = await fs.promises.readdir(dirPath)\n for (const test of results) {\n const filePath = path.join(dirPath, test, 'detailed-stats-summary.csv')\n if (!fs.existsSync(filePath)) continue\n const timestamp = fs.statSync(path.join(dirPath, test)).ctime.getTime()\n const data = await parseStatsFile(filePath)\n const { id, scenario } = nameParser(test)\n\n const aggregated = {\n timestamp,\n id,\n scenario,\n videoRecvBitratePerPixel: new FastStats(),\n videoRecvFps: new FastStats(),\n videoSentFps: new FastStats(),\n }\n data.forEach(v => {\n const { participantName, trackId } = v as { participantName: string; trackId: string }\n const metrics = v as Record<string, number>\n if (participantName === receiverParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoRecvFrames > 0) {\n const videoRecvBitratePerPixel =\n metrics.videoRecvBitrates / (metrics.videoRecvWidth * metrics.videoRecvHeight)\n if (!isNaN(videoRecvBitratePerPixel)) aggregated.videoRecvBitratePerPixel.push(videoRecvBitratePerPixel)\n if (!isNaN(metrics.videoRecvFps)) aggregated.videoRecvFps.push(metrics.videoRecvFps)\n }\n } else if (participantName === senderParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoSentFrames > 0) {\n if (!isNaN(metrics.videoSentFps)) aggregated.videoSentFps.push(metrics.videoSentFps)\n }\n }\n })\n stats.push(aggregated)\n }\n return stats.sort((a, b) => a.timestamp - b.timestamp)\n}\n\n/**\n * It uploads the aggregated stats to a Google Sheet.\n * A valid Google service account credentials file must be specified\n * in the `GOOGLE_CREDENTIALS_PATH` environment variable.\n * @param stats The aggregated stats to upload.\n * @param spreadsheetId The ID of the Google Spreadsheet.\n * @param table The name of the table (sheet) within the spreadsheet. Default is 'data'.\n */\nexport async function uploadStatsToGoogleSheet(stats: StatsSummary[], spreadsheetId: string, table = 'data') {\n log.debug(`uploadResultsToGoogleSheet spreadsheetId: ${spreadsheetId} table: ${table}`)\n if (!process.env.GOOGLE_CREDENTIALS_PATH) throw new Error('GOOGLE_CREDENTIALS_PATH environment variable is not set')\n if (!fs.existsSync(process.env.GOOGLE_CREDENTIALS_PATH))\n throw new Error(`Google credentials file not found: ${process.env.GOOGLE_CREDENTIALS_PATH}`)\n if (!stats.length) return\n const auth = new Auth.GoogleAuth({\n keyFile: process.env.GOOGLE_CREDENTIALS_PATH,\n scopes: ['https://www.googleapis.com/auth/spreadsheets'],\n })\n const sheets = google.sheets({ version: 'v4', auth })\n // Update headers.\n const headers = ['datetime', 'id', 'scenario', 'videoRecvBitratePerPixel', 'videoRecvFps']\n await sheets.spreadsheets.values.update({\n spreadsheetId,\n range: `${table}!A1:E1`,\n valueInputOption: 'USER_ENTERED',\n requestBody: { majorDimension: 'ROWS', values: [headers] },\n })\n // Append values.\n const values = [] as string[][]\n stats.forEach(s => {\n const { timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps } = s\n if (!videoRecvBitratePerPixel.length) return\n const datetime = new Date(timestamp).toLocaleString('en-US', {\n timeZone: 'UTC',\n hourCycle: 'h23',\n })\n values.push([\n datetime,\n id,\n formatThrottleRule(parseThrottleRule(scenario), true),\n videoRecvBitratePerPixel.percentile(95).toFixed(3),\n videoRecvFps.percentile(95).toFixed(3),\n ])\n })\n if (values.length) {\n await sheets.spreadsheets.values.append({\n spreadsheetId,\n range: `${table}!A:E`,\n valueInputOption: 'USER_ENTERED',\n insertDataOption: 'INSERT_ROWS',\n requestBody: { majorDimension: 'ROWS', values },\n })\n }\n}\n\nexport type ThrottleDirection = 'up' | 'down' | 'bidi'\n\nexport function formatBitrate(bitrate: number | undefined, prefix = ' ') {\n if (bitrate === undefined) return ''\n let suffix = 'Kbps'\n if (bitrate >= 1000) {\n bitrate /= 1000\n suffix = 'Mbps'\n }\n return `${prefix}${sprintf('%5.4g', bitrate)}${suffix}`\n}\n\nexport function formatLoss(loss: number | undefined, prefix = ' ') {\n return loss !== undefined ? `${prefix}${loss.toFixed(0).padStart(2, ' ')}%` : ''\n}\n\nexport function formatDelay(delay: number | undefined, prefix = ' ') {\n return delay !== undefined ? `${prefix}${delay.toFixed(0).padStart(3, ' ')}ms` : ''\n}\n\nexport function formatThrottleRule(throttleRule: ThrottleRule & { direction: ThrottleDirection }, human = false) {\n const { rate, loss, delay, direction } = throttleRule\n return human\n ? `${direction.padEnd(4, ' ')}${formatBitrate(rate)}${formatLoss(loss)}${formatDelay(delay)}`\n : `${direction}-r${rate}-l${loss}-d${delay}`\n}\n\nexport function parseThrottleRule(throttleDesc: string) {\n const match = throttleDesc.match(/(up|down|bidi)-r(\\d+)-l([\\d.]+)-d(\\d+)/)\n if (!match) throw new Error(`Invalid throttle description: ${throttleDesc}`)\n const direction = match[1] as ThrottleDirection\n const rate = parseInt(match[2])\n const loss = parseInt(match[3])\n const delay = parseInt(match[4])\n return { direction, rate, loss, delay }\n}\n\n/**\n * It generates a test configuration with a scenario including 2 participants.\n * The first participant sends video and the second receives it.\n * Both participants send and receive audio.\n * The network conditions are applied according to the specified direction to the sender (`up`),\n * the receiver (`down`) or both (`bidi`).\n * The test is repeated the specified number of times.\n * The output is an array of partial configuration objects that can be used to run the tests\n * with the main application, after merging it with a configuration that includes\n * the destination url (mandatory) and other optional parameters.\n * @param id The unique identifier for the test scenario.\n * @param options.rate The target bandwidth in kbps.\n * @param options.loss The packet loss percentage.\n * @param options.delay The network delay in milliseconds.\n * @param options.direction The direction of the network throttling: 'up', 'down', or 'bidi'.\n * @param repeat The number of times to repeat the test scenario. Default is 1.\n * @returns An array of partial configuration objects for each test scenario.\n */\nexport async function twoParticipantsWithRateLossDelay(\n id: string,\n { rate, loss, delay, direction }: { rate: number; loss: number; delay: number; direction: ThrottleDirection },\n repeat: 1,\n) {\n const throttle: ThrottleConfig = {}\n const queue = 25\n if (direction === 'down' || direction === 'bidi') {\n throttle.down = [\n { rate: 20000, loss: 0, delay: 0, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n if (direction === 'up' || direction === 'bidi') {\n throttle.up = [\n { rate: 20000, loss: 0, delay, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n const throttleDesc = formatThrottleRule({ rate, loss, delay, direction })\n const now = Date.now()\n const ret: Partial<Config>[] = []\n for (let i = 0; i < repeat; i++) {\n const basePath = `logs/${now}-${i + 1}_${id}_${throttleDesc}`\n const sessions = direction === 'bidi' ? '0-1' : direction === 'down' ? '0' : '1'\n ret.push({\n sessions: 2,\n runDuration: 60 * 3,\n debuggingPort: 9000,\n prometheusPushgateway: 'http://localhost:9091',\n prometheusPushgatewayJobName: id,\n statsPath: `${basePath}/stats.csv`,\n detailedStatsPath: `${basePath}/detailed-stats.csv`,\n showPageLog: false,\n showStats: false,\n statsInterval: 5,\n scriptParams: JSON.stringify({\n enableMic: '0-1',\n enableCam: '1',\n }),\n throttleConfig: JSON.stringify([\n {\n sessions,\n protocol: 'udp',\n skipSourcePorts: '53,80,443',\n skipDestinationPorts: '53,80,443',\n ...throttle,\n },\n ]),\n })\n }\n return ret\n}\n"]}
|
|
1
|
+
{"version":3,"file":"scenarios.js","sourceRoot":"","sources":["../../src/scenarios.ts"],"names":[],"mappings":";;;;;AAiBA,wCAiBC;AAmBD,sDA8CC;AAUD,4DA6CC;AAID,sCAQC;AAED,gCAEC;AAED,kCAEC;AAED,gDASC;AAED,8CAQC;AAED,4CA0CC;AAoBD,4EAoDC;AAvTD,4CAAmB;AACnB,gDAAuB;AACvB,mCAAmC;AAGnC,2CAAyC;AACzC,mCAAgC;AAChC,2CAAoC;AACpC,iCAA2C;AAE3C,MAAM,GAAG,GAAG,IAAA,cAAM,EAAC,sBAAsB,CAAC,CAAA;AAE1C;;;;GAIG;AACI,KAAK,UAAU,cAAc,CAAC,QAAgB;IACnD,GAAG,CAAC,KAAK,CAAC,mBAAmB,QAAQ,EAAE,CAAC,CAAA;IACxC,MAAM,QAAQ,GAAG,MAAM,YAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IAC9D,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CACrC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,CACpB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACpB,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;YACjB,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,KAA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IACD,OAAO,GAAG,CAAA;AACZ,CAAC","sourcesContent":["import fs from 'fs'\nimport path from 'path'\nimport { FastStats } from './stats'\nimport { ThrottleConfig, ThrottleRule } from '@vpalmisano/throttler'\nimport { Config } from './config'\nimport { Auth, google } from 'googleapis'\nimport { logger } from './utils'\nimport { sprintf } from 'sprintf-js'\nimport { PlotData, plotHtml } from './plot'\n\nconst log = logger('webrtcperf:scenarios')\n\n/**\n * It parses a CSV stats file and returns an array of objects representing each row.\n * @param filePath The path to the CSV stats file.\n * @returns An array of objects where each object represents a row in the CSV file with keys as column headers.\n */\nexport async function parseStatsFile(filePath: string) {\n log.debug(`parseStatsFile: ${filePath}`)\n const fileData = await fs.promises.readFile(filePath, 'utf-8')\n const lines = fileData.split('\\n')\n const headers = lines[0].split(',')\n const data = lines.slice(1).map(line =>\n line.split(',').reduce(\n (acc, value, index) => {\n if (value !== '') {\n acc[headers[index]] = isNaN(Number(value)) ? value : Number(value)\n }\n return acc\n },\n {} as Record<string, string | number>,\n ),\n )\n return data\n}\n\nexport type StatsSummary = {\n timestamp: number\n id: string\n scenario: string\n videoRecvBitratePerPixel: FastStats\n videoRecvFps: FastStats\n videoSentFps: FastStats\n}\n\n/**\n * It aggregates the stats summary from multiple test runs in a directory.\n * @param options.dirPath Directory path containing test run subdirectories. Default is 'logs'.\n * @param options.senderParticipantName Participant name of the sender. Default is 'Participant-000001'.\n * @param options.receiverParticipantName Participant name of the receiver. Default is 'Participant-000000'.\n * @param options.nameParser Function to parse test directory names. Default splits by '_' and extracts id and scenario.\n * @returns Array of aggregated stats including timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps, and videoSentFps.\n */\nexport async function aggregateStatsSummary({\n dirPath = 'logs',\n senderParticipantName = 'Participant-000001',\n receiverParticipantName = 'Participant-000000',\n nameParser = (name: string) => {\n const [_, id, scenario] = name.split('_')\n return { id, scenario }\n },\n}) {\n log.debug(`aggregateStatsSummary: ${dirPath}`)\n const stats: StatsSummary[] = []\n const results = await fs.promises.readdir(dirPath)\n for (const test of results) {\n const filePath = path.join(dirPath, test, 'detailed-stats-summary.csv')\n if (!fs.existsSync(filePath)) continue\n const timestamp = fs.statSync(path.join(dirPath, test)).ctime.getTime()\n const data = await parseStatsFile(filePath)\n const { id, scenario } = nameParser(test)\n\n const aggregated = {\n timestamp,\n id,\n scenario,\n videoRecvBitratePerPixel: new FastStats(),\n videoRecvFps: new FastStats(),\n videoSentFps: new FastStats(),\n }\n data.forEach(v => {\n const { participantName, trackId } = v as { participantName: string; trackId: string }\n const metrics = v as Record<string, number>\n if (participantName === receiverParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoRecvFrames > 0) {\n const videoRecvBitratePerPixel =\n metrics.videoRecvBitrates / (metrics.videoRecvWidth * metrics.videoRecvHeight)\n if (!isNaN(videoRecvBitratePerPixel)) aggregated.videoRecvBitratePerPixel.push(videoRecvBitratePerPixel)\n if (!isNaN(metrics.videoRecvFps)) aggregated.videoRecvFps.push(metrics.videoRecvFps)\n }\n } else if (participantName === senderParticipantName) {\n if (trackId?.endsWith('-v') && metrics.videoSentFrames > 0) {\n if (!isNaN(metrics.videoSentFps)) aggregated.videoSentFps.push(metrics.videoSentFps)\n }\n }\n })\n stats.push(aggregated)\n }\n return stats.sort((a, b) => a.timestamp - b.timestamp)\n}\n\n/**\n * It uploads the aggregated stats to a Google Sheet.\n * A valid Google service account credentials file must be specified\n * in the `GOOGLE_CREDENTIALS_PATH` environment variable.\n * @param stats The aggregated stats to upload.\n * @param spreadsheetId The ID of the Google Spreadsheet.\n * @param table The name of the table (sheet) within the spreadsheet. Default is 'data'.\n */\nexport async function uploadStatsToGoogleSheet(stats: StatsSummary[], spreadsheetId: string, table = 'data') {\n log.debug(`uploadResultsToGoogleSheet spreadsheetId: ${spreadsheetId} table: ${table}`)\n if (!process.env.GOOGLE_CREDENTIALS_PATH) throw new Error('GOOGLE_CREDENTIALS_PATH environment variable is not set')\n if (!fs.existsSync(process.env.GOOGLE_CREDENTIALS_PATH))\n throw new Error(`Google credentials file not found: ${process.env.GOOGLE_CREDENTIALS_PATH}`)\n if (!stats.length) return\n const auth = new Auth.GoogleAuth({\n keyFile: process.env.GOOGLE_CREDENTIALS_PATH,\n scopes: ['https://www.googleapis.com/auth/spreadsheets'],\n })\n const sheets = google.sheets({ version: 'v4', auth })\n // Update headers.\n const headers = ['datetime', 'id', 'scenario', 'videoRecvBitratePerPixel', 'videoRecvFps']\n await sheets.spreadsheets.values.update({\n spreadsheetId,\n range: `${table}!A1:E1`,\n valueInputOption: 'USER_ENTERED',\n requestBody: { majorDimension: 'ROWS', values: [headers] },\n })\n // Append values.\n const values = [] as string[][]\n stats.forEach(s => {\n const { timestamp, id, scenario, videoRecvBitratePerPixel, videoRecvFps } = s\n if (!videoRecvBitratePerPixel.length) return\n const datetime = new Date(timestamp).toLocaleString('en-US', {\n timeZone: 'UTC',\n hourCycle: 'h23',\n })\n values.push([\n datetime,\n id,\n formatThrottleRule(parseThrottleRule(scenario), true),\n videoRecvBitratePerPixel.percentile(95).toFixed(3),\n videoRecvFps.percentile(95).toFixed(3),\n ])\n })\n if (values.length) {\n await sheets.spreadsheets.values.append({\n spreadsheetId,\n range: `${table}!A:E`,\n valueInputOption: 'USER_ENTERED',\n insertDataOption: 'INSERT_ROWS',\n requestBody: { majorDimension: 'ROWS', values },\n })\n }\n}\n\nexport type ThrottleDirection = 'up' | 'down' | 'bidi'\n\nexport function formatBitrate(bitrate: number | undefined, prefix = ' ', pad = true) {\n if (bitrate === undefined) return ''\n let suffix = 'Kbps'\n if (bitrate >= 1000) {\n bitrate /= 1000\n suffix = 'Mbps'\n }\n return `${prefix}${sprintf(`%${pad ? '5' : ''}.4g`, bitrate)}${suffix}`\n}\n\nexport function formatLoss(loss: number | undefined, prefix = ' ', pad = true) {\n return loss !== undefined ? `${prefix}${loss.toFixed(0).padStart(pad ? 2 : 0, ' ')}%` : ''\n}\n\nexport function formatDelay(delay: number | undefined, prefix = ' ', pad = true) {\n return delay !== undefined ? `${prefix}${delay.toFixed(0).padStart(pad ? 3 : 0, ' ')}ms` : ''\n}\n\nexport function formatThrottleRule(\n throttleRule: ThrottleRule & { direction: ThrottleDirection },\n human = false,\n pad = true,\n) {\n const { rate, loss, delay, direction } = throttleRule\n return human\n ? `${direction.padEnd(pad ? 4 : 0, ' ')}${formatBitrate(rate, ' ', pad)}${formatLoss(loss, ' ', pad)}${formatDelay(delay, ' ', pad)}`\n : `${direction}-r${rate}-l${loss}-d${delay}`\n}\n\nexport function parseThrottleRule(throttleDesc: string) {\n const match = throttleDesc.match(/(up|down|bidi)-r(\\d+)-l([\\d.]+)-d(\\d+)/)\n if (!match) throw new Error(`Invalid throttle description: ${throttleDesc}`)\n const direction = match[1] as ThrottleDirection\n const rate = parseInt(match[2])\n const loss = parseInt(match[3])\n const delay = parseInt(match[4])\n return { direction, rate, loss, delay }\n}\n\nexport async function plotStatsSummary(stats: StatsSummary[]) {\n const labels = new Set<string>()\n const data = {} as Record<string, Record<string, FastStats>>\n stats.forEach(s => {\n const { id, scenario, videoRecvBitratePerPixel } = s\n if (!videoRecvBitratePerPixel.length) return null\n if (!data[id]) {\n data[id] = {}\n }\n const scenarioFormatted = formatThrottleRule(parseThrottleRule(scenario), true, true)\n if (!data[id][scenarioFormatted]) {\n data[id][scenarioFormatted] = new FastStats()\n }\n labels.add(scenarioFormatted)\n data[id][scenarioFormatted].push(videoRecvBitratePerPixel.percentile(95))\n })\n const series: PlotData[] = []\n Object.entries(data)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .forEach(([id, data]) => {\n const plotData: PlotData = { label: id, data: [] }\n Object.entries(data)\n .sort((a, b) => a[0].localeCompare(b[0]))\n .forEach(([scenario, stats]) => {\n plotData.data.push({\n x: scenario,\n y: stats.percentile(50),\n yMin: stats.percentile(5),\n yMax: stats.percentile(95),\n })\n })\n series.push(plotData)\n })\n await plotHtml(\n {\n type: 'barWithErrorBars',\n xLabel: 'Scenario',\n yLabel: 'Video Receive Bitrate per Pixel',\n labels: Array.from(labels).sort((a, b) => a.localeCompare(b)),\n },\n series,\n )\n}\n\n/**\n * It generates a test configuration with a scenario including 2 participants.\n * The first participant sends video and the second receives it.\n * Both participants send and receive audio.\n * The network conditions are applied according to the specified direction to the sender (`up`),\n * the receiver (`down`) or both (`bidi`).\n * The test is repeated the specified number of times.\n * The output is an array of partial configuration objects that can be used to run the tests\n * with the main application, after merging it with a configuration that includes\n * the destination url (mandatory) and other optional parameters.\n * @param id The unique identifier for the test scenario.\n * @param options.rate The target bandwidth in kbps.\n * @param options.loss The packet loss percentage.\n * @param options.delay The network delay in milliseconds.\n * @param options.direction The direction of the network throttling: 'up', 'down', or 'bidi'.\n * @param repeat The number of times to repeat the test scenario. Default is 1.\n * @returns An array of partial configuration objects for each test scenario.\n */\nexport async function twoParticipantsWithRateLossDelay(\n id: string,\n { rate, loss, delay, direction }: { rate: number; loss: number; delay: number; direction: ThrottleDirection },\n repeat: 1,\n) {\n const throttle: ThrottleConfig = {}\n const queue = 25\n if (direction === 'down' || direction === 'bidi') {\n throttle.down = [\n { rate: 20000, loss: 0, delay: 0, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n if (direction === 'up' || direction === 'bidi') {\n throttle.up = [\n { rate: 20000, loss: 0, delay, queue },\n { rate, loss, delay, queue, at: 30 },\n ]\n }\n const throttleDesc = formatThrottleRule({ rate, loss, delay, direction })\n const now = Date.now()\n const ret: Partial<Config>[] = []\n for (let i = 0; i < repeat; i++) {\n const basePath = `logs/${now}-${i + 1}_${id}_${throttleDesc}`\n const sessions = direction === 'bidi' ? '0-1' : direction === 'down' ? '0' : '1'\n ret.push({\n sessions: 2,\n runDuration: 60 * 3,\n debuggingPort: 9000,\n prometheusPushgateway: 'http://localhost:9091',\n prometheusPushgatewayJobName: id,\n statsPath: `${basePath}/stats.csv`,\n detailedStatsPath: `${basePath}/detailed-stats.csv`,\n showPageLog: false,\n showStats: false,\n statsInterval: 5,\n scriptParams: JSON.stringify({\n enableMic: '0-1',\n enableCam: '1',\n }),\n throttleConfig: JSON.stringify([\n {\n sessions,\n protocol: 'udp',\n skipSourcePorts: '53,80,443',\n skipDestinationPorts: '53,80,443',\n ...throttle,\n },\n ]),\n })\n }\n return ret\n}\n"]}
|