-
Notifications
You must be signed in to change notification settings - Fork 273
/
Copy pathbenchmark_to_spreadsheet.js
executable file
·35 lines (34 loc) · 1.35 KB
/
benchmark_to_spreadsheet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env node
let program = require('commander');
program
.arguments('<jsonFile>')
.option('-t, --total', 'Only print the total time')
.action(function (jsonFile) {
let lineReader = require('readline').createInterface({
input: require('fs').createReadStream(jsonFile)
});
const printTotalTime = typeof program.total != 'undefined';
let totalTime = 0.0;
if (!printTotalTime)
console.log("class file; function name; execution time (ms);"
+ "success; goals covered; total number of goals");
lineReader.on('line', function (data) {
let json = JSON.parse(data.toString());
totalTime += parseFloat(json.execTime);
if (printTotalTime)
return;
console.log(
json.classFile +";" +
json['function'].replace(/;/g, "_") + "; " +
json.execTime + ";" +
json.success + ";" +
((typeof json.goals != 'undefined')? json.goals.goalsCovered : "0") + ";" +
((typeof json.goals != 'undefined')? json.goals.totalGoals : ""));
});
if (printTotalTime) {
lineReader.on('close', function () {
console.log(jsonFile + "; " + totalTime)
});
}
})
.parse(process.argv);