forked from mariadb-corporation/mariadb-connector-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmarks.js
31 lines (30 loc) · 837 Bytes
/
benchmarks.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
'use strict';
const fs = require('fs');
const Bench = require('./common_benchmarks');
const launchBenchs = function (path) {
fs.readdir(path, function (err, list) {
if (err) {
console.error(err);
return;
}
const bench = new Bench();
//launch all benchmarks
for (let i = 0; i < list.length; i++) {
console.log('benchmark: ./benchs/' + list[i]);
const m = require('./benchs/' + list[i]);
bench.initFcts.push([m.initFct, m.promise]);
bench.add(m.title, m.displaySql, m.benchFct, m.onComplete, m.promise, m.pool);
}
bench.suiteReady();
});
};
fs.access('./benchs', function (err) {
if (err) {
fs.access('./benchmarks/benchs', function (err) {
if (err) return;
launchBenchs('./benchmarks/benchs');
});
} else {
launchBenchs('./benchs');
}
});