Skip to content

Commit

Permalink
feat: add slog file output to benchmark tool
Browse files Browse the repository at this point in the history
  • Loading branch information
FUDCo committed Oct 12, 2023
1 parent ac08b3e commit bb821bf
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
9 changes: 9 additions & 0 deletions packages/benchmark/src/benchmarkerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ let commandLineRounds;
let verbose = false;
let help = false;
let dump = false;
let slogFile;
/** @type ManagerType */
let defaultManagerType = 'xs-worker';
const options = {};
Expand Down Expand Up @@ -148,6 +149,9 @@ FLAGS may be:
--local - shorthand for '--vat-type local'
(less realistic perf numbers but faster and easier to debug)
-s
--slog PATH - output a slog file into PATH
-d
--dump - output JSON-formatted benchmark data to a file
Expand Down Expand Up @@ -209,6 +213,10 @@ while (argv[0] && stillScanningArgs) {
case '--help':
help = true;
break;
case '-s':
case '--slog':
slogFile = argv.shift();
break;
case '-o':
case '--option': {
const optionName = argv.shift();
Expand Down Expand Up @@ -433,6 +441,7 @@ export const makeBenchmarkerator = async () => {
const swingsetTestKit = await makeSwingsetTestKit(console.log, undefined, {
defaultManagerType,
verbose,
slogFile,
});
const {
runUtils,
Expand Down
1 change: 1 addition & 0 deletions packages/boot/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@agoric/kmarshal": "^0.1.0",
"@agoric/swing-store": "^0.9.1",
"@agoric/swingset-vat": "^0.32.2",
"@agoric/telemetry": "^0.6.2",
"@agoric/time": "^0.3.2",
"@agoric/vat-data": "^0.5.2",
"@agoric/vats": "^0.15.1",
Expand Down
16 changes: 15 additions & 1 deletion packages/boot/tools/supports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { makeFakeStorageKit } from '@agoric/internal/src/storage-test-utils.js';
import { initSwingStore } from '@agoric/swing-store';
import { loadSwingsetConfigFile } from '@agoric/swingset-vat';
import { krefOf } from '@agoric/kmarshal';
import { makeSlogSender } from '@agoric/telemetry';
import { TimeMath, Timestamp } from '@agoric/time';
import '@agoric/vats/exported.js';
import {
Expand Down Expand Up @@ -238,6 +239,7 @@ export const matchIter = (t: AvaT, iter, valueRef) => {
* @param [options.configSpecifier] bootstrap config specifier
* @param [options.storage]
* @param [options.verbose]
* @param [options.slogFile]
* @param [options.defaultManagerType]
*/
export const makeSwingsetTestKit = async (
Expand All @@ -247,6 +249,7 @@ export const makeSwingsetTestKit = async (
configSpecifier = undefined as string | undefined,
storage = makeFakeStorageKit('bootstrapTests'),
verbose = false,
slogFile = undefined as string | undefined,
defaultManagerType = 'local' as ManagerType,
} = {},
) => {
Expand Down Expand Up @@ -338,14 +341,25 @@ export const makeSwingsetTestKit = async (
}
};

let slogSender;
if (slogFile) {
slogSender = await makeSlogSender({
stateDir: '.',
env: {
...process.env,
SLOGFILE: slogFile,
SLOGSENDER: '',
},
});
}
const { controller, timer } = await buildSwingset(
new Map(),
bridgeOutbound,
kernelStorage,
configPath,
[],
{},
{ debugName: 'TESTBOOT', verbose },
{ debugName: 'TESTBOOT', verbose, slogSender },
);
console.timeLog('makeBaseSwingsetTestKit', 'buildSwingset');

Expand Down

0 comments on commit bb821bf

Please sign in to comment.