Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add support for recording runtime traces #7

Merged
merged 1 commit into from
Feb 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ interface Opts {
readonly fast?: number;

readonly verbose?: boolean;
readonly runtimeTrace?: boolean;
}

const Constants = {
Expand Down Expand Up @@ -143,6 +144,10 @@ async function runPerformanceTest(opts: Opts): Promise<void> {
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"');
}

return new Promise(resolve => {
const npx = cp.spawn('npx', args, {
Expand Down Expand Up @@ -313,7 +318,8 @@ module.exports = async function (argv: string[]): Promise<void> {
.option('--slack-token <token>', `a Slack token for writing Slack messages`)
.option('--slack-message-threads <filepath>', `a file in which commit -> message thread mappings are stored`)
.option('-f, --fast <number>', '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) {
Expand Down