Skip to content

Commit 34fd92e

Browse files
authored
Merge pull request #197 from perftool-incubator/fix-cdm-bugs
fix: undefined vars, regex bugs, sourceType crash, and typos
2 parents e746315 + da6a18b commit 34fd92e

10 files changed

Lines changed: 27 additions & 25 deletions

queries/cdmq/add-run-worker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ module.exports = async ({ instance, filePath, docTypes, mode }) => {
7676
var action = JSON.parse(jsonArr[k - 1]);
7777
var doc = JSON.parse(jsonArr[k]);
7878
} catch (jsonError) {
79-
console.log('Could not porse: [' + jsonArr[k] + ']');
79+
console.log('Could not parse: [' + jsonArr[k] + ']');
8080
continue;
8181
}
8282
let runId = doc['run']['run-uuid'];

queries/cdmq/add-run.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function save_ver(ver) {
2929
console.log('You must specify a --host before a --ver');
3030
process.exit(1);
3131
}
32-
if (/^v[7|8|9]dev$/.exec(ver)) {
32+
if (/^v[789]dev$/.exec(ver)) {
3333
instances[instances.length - 1]['ver'] = ver;
3434
} else {
3535
console.log('The version must be v7dev, v8dev, or v9dev, not: ' + ver);
@@ -160,8 +160,8 @@ async function main() {
160160
instance['ver'] = cdmVer;
161161
} else {
162162
console.log('ERROR: there was not exactly one CDM version found in the data to be indexed:\n');
163-
console.log(Object.keys(info['indices']));
164-
console.log('info\n' + JSON.stringify(info['indices'], null, 2));
163+
console.log(Object.keys(info['runIds'][runId]['indices']));
164+
console.log('info\n' + JSON.stringify(info['runIds'][runId]['indices'], null, 2));
165165
process.exit(1);
166166
}
167167
if (info.docFields) {

queries/cdmq/cdm.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -368,12 +368,12 @@ indexDefs['v9dev']['metric_desc'] = deepClone(indexDefs['v8dev']['metric_desc'])
368368
//
369369
// For example, for mpstat:
370370
// <doc1>
371-
// mestric_desc-uuid: same uuid in metric_desc doc that has source: mpstat, type: Busy-CPU
371+
// metric_desc-uuid: same uuid in metric_desc doc that has source: mpstat, type: Busy-CPU
372372
// name: cpu
373373
// definition: A logical CPU ID, as found in lscpu, /proc/cpu, and /sys/devices/system/cpu/cpu*
374374
//
375375
// <doc2>
376-
// mestric_desc-uuid: same uuid in metric_desc doc that has source: mpstat, type: Busy-CPU
376+
// metric_desc-uuid: same uuid in metric_desc doc that has source: mpstat, type: Busy-CPU
377377
// name: package
378378
// definition: The ID of a physical grouping of CPU cores on a single chip. Often the same as a NUMA node ID.
379379
indexDefs['v9dev']['metric_def'] = deepClone(indexDefs['v9dev']['period']);
@@ -1014,7 +1014,7 @@ mSearch = async function (instance, index, yearDotMonth, termKeys, values, sourc
10141014
i +
10151015
'].hits.hits.length (' +
10161016
responses[i].hits.hits.length +
1017-
') are not equal, which means the retured data is probably incomplete'
1017+
') are not equal, which means the returned data is probably incomplete'
10181018
);
10191019
}
10201020
var ids = [];
@@ -2221,7 +2221,7 @@ reportIters = function (iterTree, indent, count) {
22212221
return count;
22222222
}
22232223
} else {
2224-
// We should be at a leaf of the tree. Anything in breakout[] should be params or tags which were reqsuested to not break-out
2224+
// We should be at a leaf of the tree. Anything in breakout[] should be params or tags which were requested to not break-out
22252225
const sorted = iterTree.iterations.sort((a, b) =>
22262226
a.labels.localeCompare(b.labels, undefined, {
22272227
numeric: true,
@@ -2246,7 +2246,7 @@ reportIters = function (iterTree, indent, count) {
22462246
};
22472247

22482248
// --------------------------------------------------------------------------------------------------------------
2249-
// getIters(): filter and group interations, typically for generating comparisons (clustered bar graphs)
2249+
// getIters(): filter and group iterations, typically for generating comparisons (clustered bar graphs)
22502250
getIters = async function (
22512251
instance,
22522252
filterByAge,
@@ -3324,7 +3324,7 @@ calcAvg = function (thisBegin, thisEnd, responses, jsonArrIdx, jsonArrTracker, n
33243324
jsonArrIdx / 2 +
33253325
'].hits.hits.length (' +
33263326
responses[jsonArrIdx / 2].hits.hits.length +
3327-
') are not equal, which means the retured data is probably incomplete'
3327+
') are not equal, which means the returned data is probably incomplete'
33283328
);
33293329
}
33303330
responses[jsonArrIdx / 2].hits.hits.forEach((element) => {
@@ -3577,7 +3577,7 @@ getMetricDataSets = async function (instance, sets, yearDotMonth) {
35773577
for (var i = 0; i < sets.length; i++) {
35783578
if (!metricSources[i].includes(sets[i].source)) {
35793579
retMsg = 'ERROR: the metric-source [' + sets[i].source + '] was not found in run [' + sets[i].run + ']\n';
3580-
retMsg += 'The available soucres for this run are: ' + metricSources[i];
3580+
retMsg += 'The available sources for this run are: ' + metricSources[i];
35813581
retCode = 1;
35823582
return { 'ret-code': retCode, 'ret-msg': retMsg };
35833583
}

queries/cdmq/create-index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function save_ver(ver) {
2424
console.log('You must specify a --host before a --ver');
2525
process.exit(1);
2626
}
27-
if (/^v[7|8|9]dev$/.exec(ver)) {
27+
if (/^v[789]dev$/.exec(ver)) {
2828
instances[instances.length - 1]['ver'] = ver;
2929
} else {
3030
console.log('The version must be v7dev, v8dev, or v9dev, not: ' + ver);
@@ -50,7 +50,7 @@ async function main() {
5050
if (program.index) {
5151
cdm.checkCreateIndex(instances[instances.length - 1], program.index);
5252
} else {
53-
console.log('--index <index-nane> is required');
53+
console.log('--index <index-name> is required');
5454
}
5555
console.log('create-index is complete');
5656
}

queries/cdmq/delete-run.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function save_ver(ver) {
2323
console.log('You must specify a --host before a --ver');
2424
process.exit(1);
2525
}
26-
if (/^v[7|8|9]dev$/.exec(ver)) {
26+
if (/^v[789]dev$/.exec(ver)) {
2727
instances[instances.length - 1]['ver'] = ver;
2828
} else {
2929
console.log('The version must be v7dev, v8dev, or v9dev, not: ' + ver);
@@ -83,7 +83,7 @@ async function main() {
8383
cdm.deleteDocs(instance, allDocTypes, q, yearDotMonth);
8484
const numDocTypes = await cdm.waitForDeletedDocs(instance, program.run, allDocTypes, yearDotMonth);
8585
if (numDocTypes > 0) {
86-
console.log('Warning: could not delete all documents for ' + docTypes + ' with ' + numAttempts);
86+
console.log('Warning: could not delete all documents for ' + numDocTypes + ' remaining doc type(s)');
8787
console.log(
8888
'These documents may continue to be deleted in the background. To check on the status, run this utility again'
8989
);

queries/cdmq/get-instances-info.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function save_ver(ver) {
2424
console.log('You must specify a --host before a --ver');
2525
process.exit(1);
2626
}
27-
if (/^v[7|8|9]dev$/.exec(ver)) {
27+
if (/^v[789]dev$/.exec(ver)) {
2828
instances[instances.length - 1]['ver'] = ver;
2929
} else {
3030
console.log('The version must be v7dev, v8dev, or v9dev, not: ' + ver);

queries/cdmq/get-metric-data.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function save_ver(ver) {
105105
console.log('You must specify a --host before a --ver');
106106
process.exit(1);
107107
}
108-
if (/^v[7|8|9]dev$/.exec(ver)) {
108+
if (/^v[789]dev$/.exec(ver)) {
109109
program.instances[program.instances.length - 1]['ver'] = ver;
110110
} else {
111111
console.log('The version must be v7dev, v8dev, or v9dev, not: ' + ver);
@@ -148,7 +148,7 @@ async function main() {
148148
)
149149
.option(
150150
'--end [uint]',
151-
"[optional] Timestamp in epochtime_ms, within the period's begin-end time range, where the calculation of the metric will end. If no --begin and no -end are provided, a begin and end timestamp will be derived based on when all metrics of this source and type have data present. If --begin is before or --end is after these derived begin/end vaules, they will be adjusted (--begin is increased and/or --end is decreased) to fit within this range."
151+
"[optional] Timestamp in epochtime_ms, within the period's begin-end time range, where the calculation of the metric will end. If no --begin and no -end are provided, a begin and end timestamp will be derived based on when all metrics of this source and type have data present. If --begin is before or --end is after these derived begin/end values, they will be adjusted (--begin is increased and/or --end is decreased) to fit within this range."
152152
)
153153
.option('--resolution [uint]', '[optional] The number of datapoints to produce in a data-series', 1)
154154
.option(
@@ -159,12 +159,12 @@ async function main() {
159159
)
160160
.option(
161161
'--filter <gt|ge|lt|le:value>',
162-
'[optional] Filter out (do not output) metrics which do not pass the conditional. gt=greather-than, ge=greater-than-or-equal, lt=less-than, le=less-than-or-equal'
162+
'[optional] Filter out (do not output) metrics which do not pass the conditional. gt=greater-than, ge=greater-than-or-equal, lt=less-than, le=less-than-or-equal'
163163
)
164164
.option('--output-format <json|table|csv>', 'table')
165165
.option(
166-
'--date-format <default|eopch_ms>',
167-
'[optional] otuput date/time in DD-MM-YYYY HH:MM:SS (the default) or epoch time in milliseconds',
166+
'--date-format <default|epoch_ms>',
167+
'[optional] output date/time in DD-MM-YYYY HH:MM:SS (the default) or epoch time in milliseconds',
168168
'default'
169169
)
170170
.option(

queries/cdmq/get-primary-periods.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function save_ver(ver) {
3030
console.log('You must specify a --host before a --ver');
3131
process.exit(1);
3232
}
33-
if (/^v[7|8|9]dev$/.exec(ver)) {
33+
if (/^v[789]dev$/.exec(ver)) {
3434
instances[instances.length - 1]['ver'] = ver;
3535
} else {
3636
console.log('The version must be v7dev, v8dev, or v9dev, not: ' + ver);

queries/cdmq/get-result-summary.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,8 @@ async function main() {
523523
thisIteration['results'] = [];
524524
for (var k = 0; k < primaryMetrics.length; k++) {
525525
var sourceType = primaryMetrics[k].split('::');
526+
var source = sourceType.length == 2 ? sourceType[0] : benchmarks[0];
527+
var type = sourceType.length == 2 ? sourceType[1] : primaryMetrics[k];
526528
var thisValue = {};
527529
if (allBenchMsampleCount[k] > 0) {
528530
var mean = allBenchMsampleTotal[k] / allBenchMsampleCount[k];
@@ -535,9 +537,9 @@ async function main() {
535537
var mstddevpct = (100 * mstddev) / mean;
536538
logOutput(
537539
' result: (' +
538-
sourceType[0] +
540+
source +
539541
'::' +
540-
sourceType[1] +
542+
type +
541543
') samples:' +
542544
allBenchMsampleFixedList[k] +
543545
' mean: ' +

queries/cdmq/server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function save_ver(ver) {
6767
console.log('You must specify a --host before a --ver');
6868
process.exit(1);
6969
}
70-
if (/^v[7|8|9]dev$/.exec(ver)) {
70+
if (/^v[789]dev$/.exec(ver)) {
7171
instances[instances.length - 1]['ver'] = ver;
7272
} else {
7373
console.log('The version must be v7dev, v8dev, or v9dev, not: ' + ver);

0 commit comments

Comments
 (0)