@rubensworks/process-sparql-benchmark-results 1.0.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/LICENSE.txt +21 -0
- package/README.md +285 -0
- package/bin/psbr +2 -0
- package/bin/psbr.d.ts +2 -0
- package/bin/psbr.js +6 -0
- package/bin/psbr.js.map +1 -0
- package/index.d.ts +3 -0
- package/index.js +16 -0
- package/index.js.map +1 -0
- package/index.ts +3 -0
- package/lib/TemplateUtils.d.ts +1 -0
- package/lib/TemplateUtils.js +35 -0
- package/lib/TemplateUtils.js.map +1 -0
- package/lib/cli/CliHelpers.d.ts +5 -0
- package/lib/cli/CliHelpers.js +87 -0
- package/lib/cli/CliHelpers.js.map +1 -0
- package/lib/cli/CliRunner.d.ts +1 -0
- package/lib/cli/CliRunner.js +24 -0
- package/lib/cli/CliRunner.js.map +1 -0
- package/lib/cli/ErrorHandled.d.ts +8 -0
- package/lib/cli/ErrorHandled.js +15 -0
- package/lib/cli/ErrorHandled.js.map +1 -0
- package/lib/cli/ITaskContext.d.ts +10 -0
- package/lib/cli/ITaskContext.js +3 -0
- package/lib/cli/ITaskContext.js.map +1 -0
- package/lib/cli/commands/CommandCsv.d.ts +4 -0
- package/lib/cli/commands/CommandCsv.js +10 -0
- package/lib/cli/commands/CommandCsv.js.map +1 -0
- package/lib/cli/commands/CommandStats.d.ts +4 -0
- package/lib/cli/commands/CommandStats.js +10 -0
- package/lib/cli/commands/CommandStats.js.map +1 -0
- package/lib/cli/commands/CommandTex.d.ts +4 -0
- package/lib/cli/commands/CommandTex.js +10 -0
- package/lib/cli/commands/CommandTex.js.map +1 -0
- package/lib/cli/commands/csv/CommandQuery.d.ts +5 -0
- package/lib/cli/commands/csv/CommandQuery.js +120 -0
- package/lib/cli/commands/csv/CommandQuery.js.map +1 -0
- package/lib/cli/commands/csv/CommandSummary.d.ts +5 -0
- package/lib/cli/commands/csv/CommandSummary.js +246 -0
- package/lib/cli/commands/csv/CommandSummary.js.map +1 -0
- package/lib/cli/commands/csv/CommandWins.d.ts +5 -0
- package/lib/cli/commands/csv/CommandWins.js +151 -0
- package/lib/cli/commands/csv/CommandWins.js.map +1 -0
- package/lib/cli/commands/csv/ITableSerializer.d.ts +9 -0
- package/lib/cli/commands/csv/ITableSerializer.js +3 -0
- package/lib/cli/commands/csv/ITableSerializer.js.map +1 -0
- package/lib/cli/commands/csv/TableSerializerCsv.d.ts +10 -0
- package/lib/cli/commands/csv/TableSerializerCsv.js +19 -0
- package/lib/cli/commands/csv/TableSerializerCsv.js.map +1 -0
- package/lib/cli/commands/csv/TableSerializerMarkdown.d.ts +18 -0
- package/lib/cli/commands/csv/TableSerializerMarkdown.js +34 -0
- package/lib/cli/commands/csv/TableSerializerMarkdown.js.map +1 -0
- package/lib/cli/commands/stats/CommandDocker.d.ts +7 -0
- package/lib/cli/commands/stats/CommandDocker.js +79 -0
- package/lib/cli/commands/stats/CommandDocker.js.map +1 -0
- package/lib/cli/commands/tex/CommandQuery.d.ts +5 -0
- package/lib/cli/commands/tex/CommandQuery.js +253 -0
- package/lib/cli/commands/tex/CommandQuery.js.map +1 -0
- package/lib/cli/commands/tex/CommandQueryTimes.d.ts +5 -0
- package/lib/cli/commands/tex/CommandQueryTimes.js +153 -0
- package/lib/cli/commands/tex/CommandQueryTimes.js.map +1 -0
- package/lib/cli/commands/tex/TexUtils.d.ts +34 -0
- package/lib/cli/commands/tex/TexUtils.js +149 -0
- package/lib/cli/commands/tex/TexUtils.js.map +1 -0
- package/lib/correctness/CorrectnessCheckerQueries.d.ts +6 -0
- package/lib/correctness/CorrectnessCheckerQueries.js +13 -0
- package/lib/correctness/CorrectnessCheckerQueries.js.map +1 -0
- package/lib/correctness/CorrectnessCheckerUtils.d.ts +2 -0
- package/lib/correctness/CorrectnessCheckerUtils.js +14 -0
- package/lib/correctness/CorrectnessCheckerUtils.js.map +1 -0
- package/lib/correctness/ICorrectnessChecker.d.ts +3 -0
- package/lib/correctness/ICorrectnessChecker.js +3 -0
- package/lib/correctness/ICorrectnessChecker.js.map +1 -0
- package/lib/templates/tex/plot_query_data.tex +94 -0
- package/lib/templates/tex/plot_query_times.tex +75 -0
- package/package.json +100 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type * as fs from 'fs';
|
|
3
|
+
import type { ITableSerializer } from './ITableSerializer';
|
|
4
|
+
export declare class TableSerializerCsv implements ITableSerializer {
|
|
5
|
+
readonly os: fs.WriteStream;
|
|
6
|
+
constructor(os: fs.WriteStream);
|
|
7
|
+
writeHeader(columns: string[]): void;
|
|
8
|
+
writeRow(columns: string[]): void;
|
|
9
|
+
close(): void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableSerializerCsv = void 0;
|
|
4
|
+
class TableSerializerCsv {
|
|
5
|
+
constructor(os) {
|
|
6
|
+
this.os = os;
|
|
7
|
+
}
|
|
8
|
+
writeHeader(columns) {
|
|
9
|
+
this.writeRow(columns);
|
|
10
|
+
}
|
|
11
|
+
writeRow(columns) {
|
|
12
|
+
this.os.write(`${columns.join(';')}\n`);
|
|
13
|
+
}
|
|
14
|
+
close() {
|
|
15
|
+
this.os.close();
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.TableSerializerCsv = TableSerializerCsv;
|
|
19
|
+
//# sourceMappingURL=TableSerializerCsv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSerializerCsv.js","sourceRoot":"","sources":["TableSerializerCsv.ts"],"names":[],"mappings":";;;AAGA,MAAa,kBAAkB;IAC7B,YACkB,EAAkB;QAAlB,OAAE,GAAF,EAAE,CAAgB;IACjC,CAAC;IAEG,WAAW,CAAC,OAAiB;QAClC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IACzB,CAAC;IAEM,QAAQ,CAAC,OAAiB;QAC/B,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF;AAhBD,gDAgBC","sourcesContent":["import type * as fs from 'fs';\nimport type { ITableSerializer } from './ITableSerializer';\n\nexport class TableSerializerCsv implements ITableSerializer {\n public constructor(\n public readonly os: fs.WriteStream,\n ) {}\n\n public writeHeader(columns: string[]): void {\n this.writeRow(columns);\n }\n\n public writeRow(columns: string[]): void {\n this.os.write(`${columns.join(';')}\\n`);\n }\n\n public close(): void {\n this.os.close();\n }\n}\n"]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import type fs from 'fs';
|
|
3
|
+
import type { ITableSerializer } from './ITableSerializer';
|
|
4
|
+
export declare class TableSerializerMarkdown implements ITableSerializer {
|
|
5
|
+
readonly os: fs.WriteStream;
|
|
6
|
+
protected headerColumns: number;
|
|
7
|
+
constructor(os: fs.WriteStream);
|
|
8
|
+
writeHeader(columns: string[], options?: {
|
|
9
|
+
align?: ('left' | 'right')[];
|
|
10
|
+
}): void;
|
|
11
|
+
writeRow(columns: string[], options?: {
|
|
12
|
+
mark?: boolean;
|
|
13
|
+
}): void;
|
|
14
|
+
protected writeLine(columns: number, options?: {
|
|
15
|
+
align?: ('left' | 'right')[];
|
|
16
|
+
}): void;
|
|
17
|
+
close(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TableSerializerMarkdown = void 0;
|
|
4
|
+
class TableSerializerMarkdown {
|
|
5
|
+
constructor(os) {
|
|
6
|
+
this.os = os;
|
|
7
|
+
this.headerColumns = 1;
|
|
8
|
+
}
|
|
9
|
+
writeHeader(columns, options) {
|
|
10
|
+
this.writeRow(columns);
|
|
11
|
+
this.writeLine(columns.length, options);
|
|
12
|
+
this.headerColumns = columns.length;
|
|
13
|
+
}
|
|
14
|
+
writeRow(columns, options) {
|
|
15
|
+
if (options === null || options === void 0 ? void 0 : options.mark) {
|
|
16
|
+
columns = columns.map(value => `**${value}**`);
|
|
17
|
+
}
|
|
18
|
+
this.os.write(`| ${columns.join(' | ')} |\n`);
|
|
19
|
+
}
|
|
20
|
+
writeLine(columns, options) {
|
|
21
|
+
let sb = '|';
|
|
22
|
+
for (let i = 0; i < columns; i++) {
|
|
23
|
+
const alignRight = (options === null || options === void 0 ? void 0 : options.align) ? options.align[i] === 'right' : 'false';
|
|
24
|
+
sb += ` ---${alignRight ? ':' : ''} |`;
|
|
25
|
+
}
|
|
26
|
+
sb += '\n';
|
|
27
|
+
this.os.write(sb);
|
|
28
|
+
}
|
|
29
|
+
close() {
|
|
30
|
+
this.os.close();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.TableSerializerMarkdown = TableSerializerMarkdown;
|
|
34
|
+
//# sourceMappingURL=TableSerializerMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableSerializerMarkdown.js","sourceRoot":"","sources":["TableSerializerMarkdown.ts"],"names":[],"mappings":";;;AAGA,MAAa,uBAAuB;IAGlC,YACkB,EAAkB;QAAlB,OAAE,GAAF,EAAE,CAAgB;QAH1B,kBAAa,GAAG,CAAC,CAAC;IAIzB,CAAC;IAEG,WAAW,CAAC,OAAiB,EAAE,OAA0C;QAC9E,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACvB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IACtC,CAAC;IAEM,QAAQ,CAAC,OAAiB,EAAE,OAA4B;QAC7D,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,IAAI,EAAE;YACjB,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;SAChD;QACD,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC;IAES,SAAS,CAAC,OAAe,EAAE,OAA0C;QAC7E,IAAI,EAAE,GAAG,GAAG,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,EAAE,CAAC,EAAE,EAAE;YAChC,MAAM,UAAU,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,EAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YAC3E,EAAE,IAAI,OAAO,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;SACxC;QACD,EAAE,IAAI,IAAI,CAAC;QAEX,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACpB,CAAC;IAEM,KAAK;QACV,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;CACF;AAlCD,0DAkCC","sourcesContent":["import type fs from 'fs';\nimport type { ITableSerializer } from './ITableSerializer';\n\nexport class TableSerializerMarkdown implements ITableSerializer {\n protected headerColumns = 1;\n\n public constructor(\n public readonly os: fs.WriteStream,\n ) {}\n\n public writeHeader(columns: string[], options?: { align?: ('left' | 'right')[] }): void {\n this.writeRow(columns);\n this.writeLine(columns.length, options);\n this.headerColumns = columns.length;\n }\n\n public writeRow(columns: string[], options?: { mark?: boolean }): void {\n if (options?.mark) {\n columns = columns.map(value => `**${value}**`);\n }\n this.os.write(`| ${columns.join(' | ')} |\\n`);\n }\n\n protected writeLine(columns: number, options?: { align?: ('left' | 'right')[] }): void {\n let sb = '|';\n for (let i = 0; i < columns; i++) {\n const alignRight = options?.align ? options.align[i] === 'right' : 'false';\n sb += ` ---${alignRight ? ':' : ''} |`;\n }\n sb += '\\n';\n\n this.os.write(sb);\n }\n\n public close(): void {\n this.os.close();\n }\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
|
+
export declare const command = "docker <docker-csv-file>";
|
|
3
|
+
export declare const desc = "Show the stats of an Docker CSV file from an experiment";
|
|
4
|
+
export declare const builder: (yargs: Argv<any>) => Argv<any>;
|
|
5
|
+
export declare const handler: (argv: Record<string, any>) => Promise<void>;
|
|
6
|
+
export declare function average(values: number[]): number;
|
|
7
|
+
export declare function last(values: number[]): number;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.last = exports.average = exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
26
|
+
const fs = __importStar(require("fs"));
|
|
27
|
+
const path_1 = __importDefault(require("path"));
|
|
28
|
+
const csv_parse_1 = __importDefault(require("csv-parse"));
|
|
29
|
+
const CliHelpers_1 = require("../../CliHelpers");
|
|
30
|
+
exports.command = 'docker <docker-csv-file>';
|
|
31
|
+
exports.desc = 'Show the stats of an Docker CSV file from an experiment';
|
|
32
|
+
const builder = (yargs) => yargs
|
|
33
|
+
.options({
|
|
34
|
+
digits: {
|
|
35
|
+
type: 'number',
|
|
36
|
+
alias: 'd',
|
|
37
|
+
describe: 'The precision of output numbers',
|
|
38
|
+
default: 2,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
exports.builder = builder;
|
|
42
|
+
const handler = (argv) => CliHelpers_1.wrapCommandHandler(argv, async (context) => {
|
|
43
|
+
// Load options
|
|
44
|
+
const file = argv.dockerCsvFile;
|
|
45
|
+
const digits = argv.digits;
|
|
46
|
+
// Read CSV file
|
|
47
|
+
const csvFile = path_1.default.join(context.cwd, file);
|
|
48
|
+
const entries = {};
|
|
49
|
+
await new Promise((resolve, reject) => {
|
|
50
|
+
const parser = csv_parse_1.default({ delimiter: argv.inputDelimiter, columns: true });
|
|
51
|
+
parser.on('data', (data) => {
|
|
52
|
+
for (const [key, value] of Object.entries(data)) {
|
|
53
|
+
if (!(key in entries)) {
|
|
54
|
+
entries[key] = [];
|
|
55
|
+
}
|
|
56
|
+
entries[key].push(Number.parseFloat(value));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
parser.on('error', reject);
|
|
60
|
+
parser.on('end', resolve);
|
|
61
|
+
fs.createReadStream(csvFile).pipe(parser);
|
|
62
|
+
});
|
|
63
|
+
// Calculate stats
|
|
64
|
+
context.logger.info(`CPU: ${average(entries.cpu_percentage).toFixed(digits)} %`);
|
|
65
|
+
context.logger.info(`Memory relative: ${(average(entries.memory) / 1024 / 1024).toFixed(digits)} MB`);
|
|
66
|
+
context.logger.info(`Memory absolute: ${average(entries.memory_percentage).toFixed(digits)} %`);
|
|
67
|
+
context.logger.info(`Received: ${(last(entries.received) / 1024 / 1024).toFixed(digits)} MB`);
|
|
68
|
+
context.logger.info(`Transmitted: ${(last(entries.transmitted) / 1024 / 1024).toFixed(digits)} MB`);
|
|
69
|
+
});
|
|
70
|
+
exports.handler = handler;
|
|
71
|
+
function average(values) {
|
|
72
|
+
return values.reduce((sum, current) => sum + current) / values.length;
|
|
73
|
+
}
|
|
74
|
+
exports.average = average;
|
|
75
|
+
function last(values) {
|
|
76
|
+
return values[values.length - 1];
|
|
77
|
+
}
|
|
78
|
+
exports.last = last;
|
|
79
|
+
//# sourceMappingURL=CommandDocker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandDocker.js","sourceRoot":"","sources":["CommandDocker.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAwB;AAExB,0DAA8B;AAG9B,iDAAsD;AAIzC,QAAA,OAAO,GAAG,0BAA0B,CAAC;AACrC,QAAA,IAAI,GAAG,yDAAyD,CAAC;AACvE,MAAM,OAAO,GAAG,CAAC,KAAgB,EAAa,EAAE,CACrD,KAAK;KACF,OAAO,CAAC;IACP,MAAM,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,iCAAiC;QAC3C,OAAO,EAAE,CAAC;KACX;CACF,CAAC,CAAC;AATM,QAAA,OAAO,WASb;AACA,MAAM,OAAO,GAAG,CAAC,IAAyB,EAAiB,EAAE,CAAC,+BAAkB,CAAC,IAAI,EAC1F,KAAK,EAAC,OAAqB,EAAE,EAAE;IAC7B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AAC,IAAI,CAAC,oBAAoB,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,IAAK,GAAG,IAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACxG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,oBAAoB,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAChG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,IAAK,GAAG,IAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAChG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,IAAK,GAAG,IAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACxG,CAAC,CAAC,CAAC;AA/BQ,QAAA,OAAO,WA+Bf;AAEL,SAAgB,OAAO,CAAC,MAAgB;IACtC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC;AACxE,CAAC;AAFD,0BAEC;AAED,SAAgB,IAAI,CAAC,MAAgB;IACnC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC;AAFD,oBAEC","sourcesContent":["import * as fs from 'fs';\nimport Path from 'path';\n\nimport parse from 'csv-parse';\nimport type { Argv } from 'yargs';\n\nimport { wrapCommandHandler } from '../../CliHelpers';\n\nimport type { ITaskContext } from '../../ITaskContext';\n\nexport const command = 'docker <docker-csv-file>';\nexport const desc = 'Show the stats of an Docker CSV file from an experiment';\nexport const builder = (yargs: Argv<any>): Argv<any> =>\n yargs\n .options({\n digits: {\n type: 'number',\n alias: 'd',\n describe: 'The precision of output numbers',\n default: 2,\n },\n });\nexport const handler = (argv: Record<string, any>): Promise<void> => wrapCommandHandler(argv,\n async(context: ITaskContext) => {\n // Load options\n const file: string = argv.dockerCsvFile;\n const digits: number = argv.digits;\n\n // Read CSV file\n const csvFile = Path.join(context.cwd, file);\n const entries: Record<string, number[]> = {};\n await new Promise((resolve, reject) => {\n const parser = parse({ delimiter: argv.inputDelimiter, columns: true });\n parser.on('data', (data: Record<string, string>) => {\n for (const [ key, value ] of Object.entries(data)) {\n if (!(key in entries)) {\n entries[key] = [];\n }\n entries[key].push(Number.parseFloat(value));\n }\n });\n parser.on('error', reject);\n parser.on('end', resolve);\n\n fs.createReadStream(csvFile).pipe(parser);\n });\n\n // Calculate stats\n context.logger.info(`CPU: ${average(entries.cpu_percentage).toFixed(digits)} %`);\n context.logger.info(`Memory relative: ${(average(entries.memory) / 1_024 / 1_024).toFixed(digits)} MB`);\n context.logger.info(`Memory absolute: ${average(entries.memory_percentage).toFixed(digits)} %`);\n context.logger.info(`Received: ${(last(entries.received) / 1_024 / 1_024).toFixed(digits)} MB`);\n context.logger.info(`Transmitted: ${(last(entries.transmitted) / 1_024 / 1_024).toFixed(digits)} MB`);\n });\n\nexport function average(values: number[]): number {\n return values.reduce((sum, current) => sum + current) / values.length;\n}\n\nexport function last(values: number[]): number {\n return values[values.length - 1];\n}\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
|
+
export declare const command = "query <experiment-dir...>";
|
|
3
|
+
export declare const desc = "Plot the query execution times from the given experiments";
|
|
4
|
+
export declare const builder: (yargs: Argv<any>) => Argv<any>;
|
|
5
|
+
export declare const handler: (argv: Record<string, any>) => Promise<void>;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.handler = exports.builder = exports.desc = exports.command = void 0;
|
|
26
|
+
const fs = __importStar(require("fs"));
|
|
27
|
+
const path_1 = __importDefault(require("path"));
|
|
28
|
+
const TemplateUtils_1 = require("../../../TemplateUtils");
|
|
29
|
+
const CliHelpers_1 = require("../../CliHelpers");
|
|
30
|
+
const TexUtils_1 = require("./TexUtils");
|
|
31
|
+
exports.command = 'query <experiment-dir...>';
|
|
32
|
+
exports.desc = 'Plot the query execution times from the given experiments';
|
|
33
|
+
const builder = (yargs) => yargs
|
|
34
|
+
.options({
|
|
35
|
+
queryRegex: {
|
|
36
|
+
type: 'string',
|
|
37
|
+
alias: 'q',
|
|
38
|
+
describe: 'Regex for queries to include (before any label overrides). Examples: \'^C\', \'^[^C]\', ...',
|
|
39
|
+
},
|
|
40
|
+
name: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
alias: 'n',
|
|
43
|
+
describe: 'Custom output file name',
|
|
44
|
+
default: 'plot_queries_data',
|
|
45
|
+
},
|
|
46
|
+
color: {
|
|
47
|
+
type: 'string',
|
|
48
|
+
alias: 'c',
|
|
49
|
+
describe: 'Color scheme name from colorbrewer2.org',
|
|
50
|
+
},
|
|
51
|
+
maxY: {
|
|
52
|
+
type: 'number',
|
|
53
|
+
describe: 'The upper limit of the Y-axis. Defaults to maximum Y value',
|
|
54
|
+
},
|
|
55
|
+
legend: {
|
|
56
|
+
type: 'boolean',
|
|
57
|
+
describe: 'If a legend should be included',
|
|
58
|
+
default: true,
|
|
59
|
+
},
|
|
60
|
+
legendPos: {
|
|
61
|
+
type: 'string',
|
|
62
|
+
describe: 'The legend position X,Y (anchor north-east)',
|
|
63
|
+
default: '1.0,1.0',
|
|
64
|
+
},
|
|
65
|
+
logY: {
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
describe: 'If the Y-Axis must have a log scale',
|
|
68
|
+
default: false,
|
|
69
|
+
},
|
|
70
|
+
inputName: {
|
|
71
|
+
type: 'string',
|
|
72
|
+
describe: 'Custom input file name per experiment',
|
|
73
|
+
default: 'query-times.csv',
|
|
74
|
+
},
|
|
75
|
+
inputDelimiter: {
|
|
76
|
+
type: 'string',
|
|
77
|
+
describe: 'Delimiter for the input CSV file',
|
|
78
|
+
default: ';',
|
|
79
|
+
},
|
|
80
|
+
overrideCombinationLabels: {
|
|
81
|
+
type: 'string',
|
|
82
|
+
describe: 'Comma-separated list of combination labels to use',
|
|
83
|
+
},
|
|
84
|
+
overrideQueryLabels: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
describe: 'Comma-separated list of query labels to use',
|
|
87
|
+
},
|
|
88
|
+
zeroReplacement: {
|
|
89
|
+
type: 'number',
|
|
90
|
+
describe: 'If zero values occur, what values they should be replaced with',
|
|
91
|
+
default: 0,
|
|
92
|
+
},
|
|
93
|
+
svg: {
|
|
94
|
+
type: 'boolean',
|
|
95
|
+
describe: 'If the tex file should be converted to svg via the tex2svg command',
|
|
96
|
+
default: false,
|
|
97
|
+
},
|
|
98
|
+
metric: {
|
|
99
|
+
type: 'string',
|
|
100
|
+
describe: 'The metric to plot',
|
|
101
|
+
choices: ['time', 'httpRequests'],
|
|
102
|
+
default: 'time',
|
|
103
|
+
},
|
|
104
|
+
relative: {
|
|
105
|
+
type: 'boolean',
|
|
106
|
+
describe: 'If the maximum value per query should be set to 1, and all other values made relative to that.',
|
|
107
|
+
default: false,
|
|
108
|
+
},
|
|
109
|
+
});
|
|
110
|
+
exports.builder = builder;
|
|
111
|
+
const handler = (argv) => CliHelpers_1.wrapCommandHandler(argv, async (context) => CliHelpers_1.wrapVisualProgress('Plotting data', async () => {
|
|
112
|
+
// Load CLI args
|
|
113
|
+
const { experimentDirectories, experimentNames, experimentIds } = TexUtils_1.getExperimentNames(argv);
|
|
114
|
+
const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;
|
|
115
|
+
const colorScheme = TexUtils_1.getColorScheme(argv, experimentDirectories);
|
|
116
|
+
const metric = argv.metric;
|
|
117
|
+
// Prepare query CSV file with averages per query group
|
|
118
|
+
let queryNames;
|
|
119
|
+
let outputCsvEntries = {};
|
|
120
|
+
const maxQueryValues = {};
|
|
121
|
+
for (const experimentDirectory of experimentDirectories) {
|
|
122
|
+
// Read CSV file
|
|
123
|
+
const totals = {};
|
|
124
|
+
const totalsFirst = {};
|
|
125
|
+
await TexUtils_1.handleCsvFile(experimentDirectory, argv, data => {
|
|
126
|
+
if (!queryRegex || queryRegex.test(data.name)) {
|
|
127
|
+
if (!(data.name in totals)) {
|
|
128
|
+
totals[data.name] = [];
|
|
129
|
+
}
|
|
130
|
+
let value = Number.parseInt(data[metric] || '0', 10);
|
|
131
|
+
value = Math.max(argv.zeroReplacement, value);
|
|
132
|
+
totals[data.name].push(value);
|
|
133
|
+
if (data.timestamps) {
|
|
134
|
+
if (!(data.name in totalsFirst)) {
|
|
135
|
+
totalsFirst[data.name] = [];
|
|
136
|
+
}
|
|
137
|
+
totalsFirst[data.name].push(Number.parseInt(data.timestamps.split(' ')[0], 10));
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
// Calculate average
|
|
142
|
+
const averages = {};
|
|
143
|
+
const averageMinus = {};
|
|
144
|
+
const averagePlus = {};
|
|
145
|
+
for (const [query, times] of Object.entries(totals)) {
|
|
146
|
+
const average = times.reduce((sum, current) => sum + current) / times.length;
|
|
147
|
+
averages[query] = average;
|
|
148
|
+
averageMinus[query] = average - times.reduce((minV, value) => Math.min(value, minV));
|
|
149
|
+
const maxValue = times.reduce((maxV, value) => Math.max(value, maxV));
|
|
150
|
+
averagePlus[query] = maxValue - average;
|
|
151
|
+
if (!(query in maxQueryValues)) {
|
|
152
|
+
maxQueryValues[query] = maxValue;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
maxQueryValues[query] = Math.max(maxQueryValues[query], maxValue);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
const averagesFirst = {};
|
|
159
|
+
const averageFirstMinus = {};
|
|
160
|
+
const averageFirstPlus = {};
|
|
161
|
+
for (const [query, times] of Object.entries(totalsFirst)) {
|
|
162
|
+
const average = times.reduce((sum, current) => sum + current) / times.length;
|
|
163
|
+
averagesFirst[query] = average;
|
|
164
|
+
averageFirstMinus[query] = average - times.reduce((minV, value) => Math.min(value, minV));
|
|
165
|
+
const maxValue = times.reduce((maxV, value) => Math.max(value, maxV));
|
|
166
|
+
averageFirstPlus[query] = maxValue - average;
|
|
167
|
+
}
|
|
168
|
+
// Set query names and count
|
|
169
|
+
if (!queryNames) {
|
|
170
|
+
queryNames = Object.keys(averages);
|
|
171
|
+
for (const queryName of queryNames) {
|
|
172
|
+
outputCsvEntries[queryName] = [];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else if (queryNames.join(',') !== Object.keys(averages).join(',')) {
|
|
176
|
+
throw new Error(`Tried to plot experiments with different query sets`);
|
|
177
|
+
}
|
|
178
|
+
// Append average, min, and max result
|
|
179
|
+
for (const queryName of queryNames) {
|
|
180
|
+
outputCsvEntries[queryName].push(averages[queryName], averageMinus[queryName], averagePlus[queryName]);
|
|
181
|
+
if (metric === 'time') {
|
|
182
|
+
outputCsvEntries[queryName].push(averagesFirst[queryName], averageFirstMinus[queryName], averageFirstPlus[queryName]);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
if (!queryNames) {
|
|
187
|
+
throw new Error(`No queries could be found`);
|
|
188
|
+
}
|
|
189
|
+
if (argv.relative) {
|
|
190
|
+
// Make values relative per query
|
|
191
|
+
for (const queryName of Object.keys(outputCsvEntries)) {
|
|
192
|
+
outputCsvEntries[queryName] = outputCsvEntries[queryName].map(value => value / maxQueryValues[queryName]);
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Determine query labels
|
|
196
|
+
queryNames = TexUtils_1.getQueryNames(queryNames, argv);
|
|
197
|
+
outputCsvEntries = TexUtils_1.relabelQueryNames(outputCsvEntries, queryNames);
|
|
198
|
+
// Write output CSV file
|
|
199
|
+
const csvOutputStream = fs.createWriteStream(path_1.default.join(context.cwd, `${argv.name}.csv`));
|
|
200
|
+
csvOutputStream.write(`query;${experimentIds.map(id => {
|
|
201
|
+
let value = `${id}-mean;${id}-minus;${id}-plus`;
|
|
202
|
+
if (metric === 'time') {
|
|
203
|
+
value = `${value};${id}-first-mean;${id}-first-minus;${id}-first-plus`;
|
|
204
|
+
}
|
|
205
|
+
return value;
|
|
206
|
+
}).join(';')}\n`);
|
|
207
|
+
for (const [key, columns] of Object.entries(outputCsvEntries)) {
|
|
208
|
+
csvOutputStream.write(`${key};${columns.join(';')}\n`);
|
|
209
|
+
}
|
|
210
|
+
csvOutputStream.close();
|
|
211
|
+
// Prepare bar lines
|
|
212
|
+
let barLines = experimentNames
|
|
213
|
+
.map((name, id) => {
|
|
214
|
+
const offset = (id - ((experimentNames.length - 1) / 2)) * 2.75;
|
|
215
|
+
const yModifier = metric === 'time' && !argv.relative ? ' / 1000' : '';
|
|
216
|
+
return `\\addplot+[ybar, xshift=${offset}pt,legend image post style={xshift=${-offset}pt}] table [x=query, y expr=(\\thisrow{${id}-mean}${yModifier}), y error plus expr=(\\thisrow{${id}-plus}${yModifier}), y error minus expr=(\\thisrow{${id}-minus}${yModifier}), col sep=semicolon]{"${argv.name}.csv"};`;
|
|
217
|
+
})
|
|
218
|
+
.join('\n');
|
|
219
|
+
if (metric === 'time') {
|
|
220
|
+
const extraBarLines = experimentNames
|
|
221
|
+
.map((name, id) => {
|
|
222
|
+
const offset = (id - ((experimentNames.length - 1) / 2)) * 2.75;
|
|
223
|
+
const yModifier = metric === 'time' && !argv.relative ? ' / 1000' : '';
|
|
224
|
+
return `\\addplot+[only marks,xshift=${offset}pt,mark=star,mark options={color=gray,scale=0.5}] table [x=query, y expr=(\\thisrow{${id}-first-mean}${yModifier}), col sep=semicolon]{"${argv.name}.csv"};`;
|
|
225
|
+
})
|
|
226
|
+
.join('\n');
|
|
227
|
+
barLines = `${barLines}\n${extraBarLines}`;
|
|
228
|
+
}
|
|
229
|
+
// Instantiate template
|
|
230
|
+
await TemplateUtils_1.instantiateTemplate(path_1.default.join(context.templatesRoot, 'tex', 'plot_query_data.tex'), path_1.default.join(context.cwd, `${argv.name}.tex`), Object.assign({ X_LIMITS: experimentDirectories.length * 2, WIDTH: queryNames.length * (experimentNames.length + 1) * 4, QUERIES: queryNames.join(','), LEGEND: experimentNames.map(name => name.replace(/_/gu, '\\_')).join(','), BARS: barLines, COLOR_SCHEME: colorScheme, LEGEND_POS: argv.legendPos }, argv.maxY ? { Y_MAX: `ymax=${argv.maxY},` } : {}), contents => {
|
|
231
|
+
if (!argv.legend) {
|
|
232
|
+
contents = contents.replace(/^\\legend.*$/u, '');
|
|
233
|
+
}
|
|
234
|
+
if (argv.logY) {
|
|
235
|
+
contents = contents
|
|
236
|
+
.replace(/ymin=0,/u, 'ymin=0.000001,ymode=log,log origin=infty,log basis y={10},')
|
|
237
|
+
.replace(/ \/ 1000\)/ug, ' / 1000)+1e-5');
|
|
238
|
+
}
|
|
239
|
+
if (argv.relative) {
|
|
240
|
+
contents = contents.replace('ylabel={Duration (s)},', 'ylabel={},');
|
|
241
|
+
}
|
|
242
|
+
if (metric === 'httpRequests') {
|
|
243
|
+
contents = contents.replace('ylabel={Duration (s)},', 'ylabel={HTTP Requests},');
|
|
244
|
+
}
|
|
245
|
+
return contents;
|
|
246
|
+
});
|
|
247
|
+
// Render CSV from TeX
|
|
248
|
+
if (argv.svg) {
|
|
249
|
+
await TexUtils_1.toSvg(argv, context);
|
|
250
|
+
}
|
|
251
|
+
}));
|
|
252
|
+
exports.handler = handler;
|
|
253
|
+
//# sourceMappingURL=CommandQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandQuery.js","sourceRoot":"","sources":["CommandQuery.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAwB;AAGxB,0DAA6D;AAC7D,iDAA0E;AAG1E,yCAQoB;AAEP,QAAA,OAAO,GAAG,2BAA2B,CAAC;AACtC,QAAA,IAAI,GAAG,2DAA2D,CAAC;AACzE,MAAM,OAAO,GAAG,CAAC,KAAgB,EAAa,EAAE,CACrD,KAAK;KACF,OAAO,CAAC;IACP,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,6FAA6F;KACxG;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,yBAAyB;QACnC,OAAO,EAAE,mBAAmB;KAC7B;IACD,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,yCAAyC;KACpD;IACD,IAAI,EAAE;QACJ,I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AAE,QAAQ,EACd,YAAY,EAAE,WAAW,EACzB,UAAU,EAAE,IAAI,CAAC,SAAS,IACvB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,GAErD,QAAQ,CAAC,EAAE;QACT,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;SAClD;QACD,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,QAAQ,GAAG,QAAQ;iBAChB,OAAO,CAAC,UAAU,EAAE,4DAA4D,CAAC;iBACjF,OAAO,CAAC,cAAc,EAAE,eAAe,CAAC,CAAC;SAC7C;QACD,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,YAAY,CAAC,CAAC;SACrE;QACD,IAAI,MAAM,KAAK,cAAc,EAAE;YAC7B,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,wBAAwB,EAAE,yBAAyB,CAAC,CAAC;SAClF;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC,CACF,CAAC;IAEF,sBAAsB;IACtB,IAAI,IAAI,CAAC,GAAG,EAAE;QACZ,MAAM,gBAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;KAC5B;AACH,CAAC,CAAC,CAAC,CAAC;AA7KO,QAAA,OAAO,WA6Kd","sourcesContent":["import * as fs from 'fs';\nimport Path from 'path';\n\nimport type { Argv } from 'yargs';\nimport { instantiateTemplate } from '../../../TemplateUtils';\nimport { wrapCommandHandler, wrapVisualProgress } from '../../CliHelpers';\n\nimport type { ITaskContext } from '../../ITaskContext';\nimport {\n\n getColorScheme,\n getExperimentNames,\n getQueryNames,\n handleCsvFile,\n relabelQueryNames,\n toSvg,\n} from './TexUtils';\n\nexport const command = 'query <experiment-dir...>';\nexport const desc = 'Plot the query execution times from the given experiments';\nexport const builder = (yargs: Argv<any>): Argv<any> =>\n yargs\n .options({\n queryRegex: {\n type: 'string',\n alias: 'q',\n describe: 'Regex for queries to include (before any label overrides). Examples: \\'^C\\', \\'^[^C]\\', ...',\n },\n name: {\n type: 'string',\n alias: 'n',\n describe: 'Custom output file name',\n default: 'plot_queries_data',\n },\n color: {\n type: 'string',\n alias: 'c',\n describe: 'Color scheme name from colorbrewer2.org',\n },\n maxY: {\n type: 'number',\n describe: 'The upper limit of the Y-axis. Defaults to maximum Y value',\n },\n legend: {\n type: 'boolean',\n describe: 'If a legend should be included',\n default: true,\n },\n legendPos: {\n type: 'string',\n describe: 'The legend position X,Y (anchor north-east)',\n default: '1.0,1.0',\n },\n logY: {\n type: 'boolean',\n describe: 'If the Y-Axis must have a log scale',\n default: false,\n },\n inputName: {\n type: 'string',\n describe: 'Custom input file name per experiment',\n default: 'query-times.csv',\n },\n inputDelimiter: {\n type: 'string',\n describe: 'Delimiter for the input CSV file',\n default: ';',\n },\n overrideCombinationLabels: {\n type: 'string',\n describe: 'Comma-separated list of combination labels to use',\n },\n overrideQueryLabels: {\n type: 'string',\n describe: 'Comma-separated list of query labels to use',\n },\n zeroReplacement: {\n type: 'number',\n describe: 'If zero values occur, what values they should be replaced with',\n default: 0,\n },\n svg: {\n type: 'boolean',\n describe: 'If the tex file should be converted to svg via the tex2svg command',\n default: false,\n },\n metric: {\n type: 'string',\n describe: 'The metric to plot',\n choices: [ 'time', 'httpRequests' ],\n default: 'time',\n },\n relative: {\n type: 'boolean',\n describe: 'If the maximum value per query should be set to 1, and all other values made relative to that.',\n default: false,\n },\n });\nexport const handler = (argv: Record<string, any>): Promise<void> => wrapCommandHandler(argv,\n async(context: ITaskContext) => wrapVisualProgress('Plotting data', async() => {\n // Load CLI args\n const { experimentDirectories, experimentNames, experimentIds } = getExperimentNames(argv);\n const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;\n const colorScheme = getColorScheme(argv, experimentDirectories);\n const metric = argv.metric;\n\n // Prepare query CSV file with averages per query group\n let queryNames: string[] | undefined;\n let outputCsvEntries: Record<string, number[]> = {};\n const maxQueryValues: Record<string, number> = {};\n for (const experimentDirectory of experimentDirectories) {\n // Read CSV file\n const totals: Record<string, number[]> = {};\n const totalsFirst: Record<string, number[]> = {};\n await handleCsvFile(experimentDirectory, argv, data => {\n if (!queryRegex || queryRegex.test(data.name)) {\n if (!(data.name in totals)) {\n totals[data.name] = [];\n }\n\n let value = Number.parseInt(data[metric] || '0', 10);\n value = Math.max(argv.zeroReplacement, value);\n\n totals[data.name].push(value);\n\n if (data.timestamps) {\n if (!(data.name in totalsFirst)) {\n totalsFirst[data.name] = [];\n }\n totalsFirst[data.name].push(Number.parseInt(data.timestamps.split(' ')[0], 10));\n }\n }\n });\n\n // Calculate average\n const averages: Record<string, number> = {};\n const averageMinus: Record<string, number> = {};\n const averagePlus: Record<string, number> = {};\n for (const [ query, times ] of Object.entries(totals)) {\n const average = times.reduce((sum, current) => sum + current) / times.length;\n averages[query] = average;\n averageMinus[query] = average - times.reduce((minV, value) => Math.min(value, minV));\n const maxValue = times.reduce((maxV, value) => Math.max(value, maxV));\n averagePlus[query] = maxValue - average;\n\n if (!(query in maxQueryValues)) {\n maxQueryValues[query] = maxValue;\n } else {\n maxQueryValues[query] = Math.max(maxQueryValues[query], maxValue);\n }\n }\n const averagesFirst: Record<string, number> = {};\n const averageFirstMinus: Record<string, number> = {};\n const averageFirstPlus: Record<string, number> = {};\n for (const [ query, times ] of Object.entries(totalsFirst)) {\n const average = times.reduce((sum, current) => sum + current) / times.length;\n averagesFirst[query] = average;\n averageFirstMinus[query] = average - times.reduce((minV, value) => Math.min(value, minV));\n const maxValue = times.reduce((maxV, value) => Math.max(value, maxV));\n averageFirstPlus[query] = maxValue - average;\n }\n\n // Set query names and count\n if (!queryNames) {\n queryNames = Object.keys(averages);\n for (const queryName of queryNames) {\n outputCsvEntries[queryName] = [];\n }\n } else if (queryNames.join(',') !== Object.keys(averages).join(',')) {\n throw new Error(`Tried to plot experiments with different query sets`);\n }\n\n // Append average, min, and max result\n for (const queryName of queryNames) {\n outputCsvEntries[queryName].push(\n averages[queryName],\n averageMinus[queryName],\n averagePlus[queryName],\n );\n if (metric === 'time') {\n outputCsvEntries[queryName].push(\n averagesFirst[queryName],\n averageFirstMinus[queryName],\n averageFirstPlus[queryName],\n );\n }\n }\n }\n if (!queryNames) {\n throw new Error(`No queries could be found`);\n }\n if (argv.relative) {\n // Make values relative per query\n for (const queryName of Object.keys(outputCsvEntries)) {\n outputCsvEntries[queryName] = outputCsvEntries[queryName].map(value => value / maxQueryValues[queryName]);\n }\n }\n // Determine query labels\n queryNames = getQueryNames(queryNames, argv);\n outputCsvEntries = relabelQueryNames(outputCsvEntries, queryNames);\n\n // Write output CSV file\n const csvOutputStream = fs.createWriteStream(Path.join(context.cwd, `${argv.name}.csv`));\n csvOutputStream.write(`query;${experimentIds.map(id => {\n let value = `${id}-mean;${id}-minus;${id}-plus`;\n if (metric === 'time') {\n value = `${value};${id}-first-mean;${id}-first-minus;${id}-first-plus`;\n }\n return value;\n }).join(';')}\\n`);\n for (const [ key, columns ] of Object.entries(outputCsvEntries)) {\n csvOutputStream.write(`${key};${columns.join(';')}\\n`);\n }\n csvOutputStream.close();\n\n // Prepare bar lines\n let barLines = experimentNames\n .map((name, id) => {\n const offset = (id - ((experimentNames.length - 1) / 2)) * 2.75;\n const yModifier = metric === 'time' && !argv.relative ? ' / 1000' : '';\n return `\\\\addplot+[ybar, xshift=${offset}pt,legend image post style={xshift=${-offset}pt}] table [x=query, y expr=(\\\\thisrow{${id}-mean}${yModifier}), y error plus expr=(\\\\thisrow{${id}-plus}${yModifier}), y error minus expr=(\\\\thisrow{${id}-minus}${yModifier}), col sep=semicolon]{\"${argv.name}.csv\"};`;\n })\n .join('\\n');\n if (metric === 'time') {\n const extraBarLines = experimentNames\n .map((name, id) => {\n const offset = (id - ((experimentNames.length - 1) / 2)) * 2.75;\n const yModifier = metric === 'time' && !argv.relative ? ' / 1000' : '';\n return `\\\\addplot+[only marks,xshift=${offset}pt,mark=star,mark options={color=gray,scale=0.5}] table [x=query, y expr=(\\\\thisrow{${id}-first-mean}${yModifier}), col sep=semicolon]{\"${argv.name}.csv\"};`;\n })\n .join('\\n');\n barLines = `${barLines}\\n${extraBarLines}`;\n }\n\n // Instantiate template\n await instantiateTemplate(\n Path.join(context.templatesRoot, 'tex', 'plot_query_data.tex'),\n Path.join(context.cwd, `${argv.name}.tex`),\n {\n X_LIMITS: experimentDirectories.length * 2,\n WIDTH: queryNames.length * (experimentNames.length + 1) * 4,\n QUERIES: queryNames.join(','),\n LEGEND: experimentNames.map(name => name.replace(/_/gu, '\\\\_')).join(','),\n BARS: barLines,\n COLOR_SCHEME: colorScheme,\n LEGEND_POS: argv.legendPos,\n ...argv.maxY ? { Y_MAX: `ymax=${argv.maxY},` } : {},\n },\n contents => {\n if (!argv.legend) {\n contents = contents.replace(/^\\\\legend.*$/u, '');\n }\n if (argv.logY) {\n contents = contents\n .replace(/ymin=0,/u, 'ymin=0.000001,ymode=log,log origin=infty,log basis y={10},')\n .replace(/ \\/ 1000\\)/ug, ' / 1000)+1e-5');\n }\n if (argv.relative) {\n contents = contents.replace('ylabel={Duration (s)},', 'ylabel={},');\n }\n if (metric === 'httpRequests') {\n contents = contents.replace('ylabel={Duration (s)},', 'ylabel={HTTP Requests},');\n }\n return contents;\n },\n );\n\n // Render CSV from TeX\n if (argv.svg) {\n await toSvg(argv, context);\n }\n }));\n"]}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Argv } from 'yargs';
|
|
2
|
+
export declare const command = "queryTimes <query> <experiment-dir...>";
|
|
3
|
+
export declare const desc = "Plot the query result arrival times from the given experiments";
|
|
4
|
+
export declare const builder: (yargs: Argv<any>) => Argv<any>;
|
|
5
|
+
export declare const handler: (argv: Record<string, any>) => Promise<void>;
|