diff --git a/src/index.ts b/src/index.ts index 993ca48..7a22a61 100644 --- a/src/index.ts +++ b/src/index.ts @@ -11,6 +11,7 @@ import { program, Option } from 'commander'; import chalk from 'chalk'; import { Octokit } from '@octokit/rest'; import { WebClient, LogLevel, ChatPostMessageArguments } from '@slack/web-api'; +import { constants } from 'buffer'; interface Opts { readonly runtime?: 'desktop' | 'web'; @@ -28,6 +29,7 @@ interface Opts { readonly fast?: number; readonly verbose?: boolean; + readonly runtimeTrace?: boolean; } const Constants = { @@ -143,6 +145,12 @@ async function runPerformanceTest(opts: Opts): Promise { if (opts.verbose) { args.push('--verbose'); } + if (opts.runtimeTrace) { + // Collects metrics for loading, navigation and v8 script compilation phases. + args.push('--runtime-trace-categories="benchmark,browser,content,loading,navigation,mojom,renderer_host,startup,toplevel,v8,disabled-by-default-loading,disabled-by-default-network,disabled-by-default-v8.compile"'); + } + + log(JSON.stringify(args)); return new Promise(resolve => { const npx = cp.spawn('npx', args, { @@ -313,7 +321,8 @@ module.exports = async function (argv: string[]): Promise { .option('--slack-token ', `a Slack token for writing Slack messages`) .option('--slack-message-threads ', `a file in which commit -> message thread mappings are stored`) .option('-f, --fast ', 'what time is considered a fast performance run') - .option('-v, --verbose', 'logs verbose output to the console when errors occur'); + .option('-v, --verbose', 'logs verbose output to the console when errors occur') + .option('--runtime-trace', 'enable startup tracing of the runtime'); const opts: Opts = program.parse(argv).opts(); if (opts.fast) {