@rubensworks/process-sparql-benchmark-results 1.1.2 → 1.1.3

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.
@@ -74,23 +74,40 @@ const handler = (argv) => CliHelpers_1.wrapCommandHandler(argv, async (context)
74
74
  const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;
75
75
  // Collect timings
76
76
  const ghbenchData = [];
77
+ const ghbenchDataRaw = {};
77
78
  for (const [experimentId, experimentDirectory] of experimentDirectories.entries()) {
78
- let total = 0;
79
79
  await TexUtils_1.handleCsvFile(experimentDirectory, argv, data => {
80
80
  if (!queryRegex || queryRegex.test(data.name)) {
81
- // Add one to avoid zero values, as the action does not handle those well for threshold checking.
82
- const value = Number.parseInt(data.results, 10) + 1;
83
- total += value;
84
- if (argv.detailed) {
85
- ghbenchData.push({
86
- name: `${experimentNames[experimentId]} - ${data.name}.${data.id}`,
81
+ const value = Number.parseInt(data.time, 10);
82
+ if (!ghbenchDataRaw[data.name]) {
83
+ ghbenchDataRaw[data.name] = {
84
+ name: `${experimentNames[experimentId]} - ${data.name}`,
87
85
  unit: 'ms',
88
- value,
86
+ values: [value],
89
87
  extra: `Results: ${data.results}; Error: ${data.error}; HTTP Requests: ${data.httpRequests}`,
90
- });
88
+ };
89
+ }
90
+ else {
91
+ ghbenchDataRaw[data.name].values.push(value);
91
92
  }
92
93
  }
93
94
  });
95
+ // Calculate averages
96
+ let total = 0;
97
+ for (const entry of Object.values(ghbenchDataRaw)) {
98
+ const value = TexUtils_1.calcAverage(entry.values);
99
+ total += value;
100
+ // Output detailed
101
+ if (argv.detailed) {
102
+ ghbenchData.push({
103
+ name: entry.name,
104
+ unit: entry.unit,
105
+ value,
106
+ extra: entry.extra,
107
+ });
108
+ }
109
+ }
110
+ // Output totals
94
111
  if (argv.total) {
95
112
  ghbenchData.push({
96
113
  name: `${experimentNames[experimentId]}`,
@@ -1 +1 @@
1
- {"version":3,"file":"Comm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K;aACb,CAAC,CAAC;SACJ;KACF;IAED,eAAe;IACf,mCAAmC;IACnC,EAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5G,CAAC,CAAC,CAAC,CAAC;AAvCO,QAAA,OAAO,WAuCd","sourcesContent":["import * as fs from 'fs';\nimport Path from 'path';\nimport type { Argv } from 'yargs';\nimport { wrapCommandHandler, wrapVisualProgress } from '../../CliHelpers';\nimport type { ITaskContext } from '../../ITaskContext';\nimport {\n getExperimentNames,\n handleCsvFile,\n} from '../tex/TexUtils';\n\nexport const command = 'ghbench <experiment-dir...>';\nexport const desc = 'Generates a JSON file for usage in the Benchmark Github Action';\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: 'ghbench.json',\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 total: {\n type: 'boolean',\n describe: 'If total execution time across the experiment must be reported',\n default: false,\n },\n detailed: {\n type: 'boolean',\n describe: 'If separate execution time for each query in the experiment must be reported',\n default: true,\n },\n });\nexport const handler = (argv: Record<string, any>): Promise<void> => wrapCommandHandler(argv,\n async(context: ITaskContext) => wrapVisualProgress('Collecting ghbench data', async() => {\n // Load options\n const { experimentDirectories, experimentNames } = getExperimentNames(argv);\n const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;\n\n // Collect timings\n const ghbenchData: GhbenchData = [];\n for (const [ experimentId, experimentDirectory ] of experimentDirectories.entries()) {\n let total = 0;\n\n await handleCsvFile(experimentDirectory, argv, data => {\n if (!queryRegex || queryRegex.test(data.name)) {\n // Add one to avoid zero values, as the action does not handle those well for threshold checking.\n const value = Number.parseInt(data.results, 10) + 1;\n total += value;\n if (argv.detailed) {\n ghbenchData.push({\n name: `${experimentNames[experimentId]} - ${data.name}.${data.id}`,\n unit: 'ms',\n value,\n extra: `Results: ${data.results}; Error: ${data.error}; HTTP Requests: ${data.httpRequests}`,\n });\n }\n }\n });\n\n if (argv.total) {\n ghbenchData.push({\n name: `${experimentNames[experimentId]}`,\n unit: 'ms',\n value: total,\n });\n }\n }\n\n // Write output\n // eslint-disable-next-line no-sync\n fs.writeFileSync(Path.join(context.cwd, `${argv.name}`), JSON.stringify(ghbenchData, null, ' '), 'utf8');\n }));\n\ntype GhbenchData = {\n name: string;\n unit: string;\n value: number;\n range?: string;\n extra?: string;\n}[];\n"]}
1
+ {"version":3,"file":"CommandGithubActionsBenchmark.js","sourceRoot":"","sources":["CommandGithubActionsBenchmark.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,gDAAwB;AAExB,iDAA0E;AAE1E,8CAIyB;AAEZ,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,IAAI,GAAG,gEAAgE,CAAC;AAC9E,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,cAAc;KACxB;IACD,SAAS,EAAE;QACT,IAAI,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aACb,CAAC,CAAC;SACJ;KACF;IAED,eAAe;IACf,mCAAmC;IACnC,EAAE,CAAC,aAAa,CAAC,cAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAC5G,CAAC,CAAC,CAAC,CAAC;AAxDO,QAAA,OAAO,WAwDd","sourcesContent":["import * as fs from 'fs';\nimport Path from 'path';\nimport type { Argv } from 'yargs';\nimport { wrapCommandHandler, wrapVisualProgress } from '../../CliHelpers';\nimport type { ITaskContext } from '../../ITaskContext';\nimport {\n calcAverage,\n getExperimentNames,\n handleCsvFile,\n} from '../tex/TexUtils';\n\nexport const command = 'ghbench <experiment-dir...>';\nexport const desc = 'Generates a JSON file for usage in the Benchmark Github Action';\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: 'ghbench.json',\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 total: {\n type: 'boolean',\n describe: 'If total execution time across the experiment must be reported',\n default: false,\n },\n detailed: {\n type: 'boolean',\n describe: 'If separate execution time for each query in the experiment must be reported',\n default: true,\n },\n });\nexport const handler = (argv: Record<string, any>): Promise<void> => wrapCommandHandler(argv,\n async(context: ITaskContext) => wrapVisualProgress('Collecting ghbench data', async() => {\n // Load options\n const { experimentDirectories, experimentNames } = getExperimentNames(argv);\n const queryRegex = argv.queryRegex ? new RegExp(argv.queryRegex, 'u') : undefined;\n\n // Collect timings\n const ghbenchData: GhbenchData = [];\n const ghbenchDataRaw: Record<string, GhbenchDataRaw> = {};\n for (const [ experimentId, experimentDirectory ] of experimentDirectories.entries()) {\n await handleCsvFile(experimentDirectory, argv, data => {\n if (!queryRegex || queryRegex.test(data.name)) {\n const value = Number.parseInt(data.time, 10);\n if (!ghbenchDataRaw[data.name]) {\n ghbenchDataRaw[data.name] = {\n name: `${experimentNames[experimentId]} - ${data.name}`,\n unit: 'ms',\n values: [ value ],\n extra: `Results: ${data.results}; Error: ${data.error}; HTTP Requests: ${data.httpRequests}`,\n };\n } else {\n ghbenchDataRaw[data.name].values.push(value);\n }\n }\n });\n\n // Calculate averages\n let total = 0;\n for (const entry of Object.values(ghbenchDataRaw)) {\n const value = calcAverage(entry.values);\n total += value;\n\n // Output detailed\n if (argv.detailed) {\n ghbenchData.push({\n name: entry.name,\n unit: entry.unit,\n value,\n extra: entry.extra,\n });\n }\n }\n\n // Output totals\n if (argv.total) {\n ghbenchData.push({\n name: `${experimentNames[experimentId]}`,\n unit: 'ms',\n value: total,\n });\n }\n }\n\n // Write output\n // eslint-disable-next-line no-sync\n fs.writeFileSync(Path.join(context.cwd, `${argv.name}`), JSON.stringify(ghbenchData, null, ' '), 'utf8');\n }));\n\ninterface GhbenchDataRaw {\n name: string;\n unit: string;\n values: number[];\n range?: string;\n extra?: string;\n}\n\ntype GhbenchData = {\n name: string;\n unit: string;\n value: number;\n range?: string;\n extra?: string;\n}[];\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rubensworks/process-sparql-benchmark-results",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "Personal tools to post-process query results from SPARQL benchmarks",
5
5
  "repository": "https://github.com/rubensworks/process-sparql-benchmark-results.js",
6
6
  "keywords": [