Skip to content

Commit

Permalink
chore: add support for recording runtime traces
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Feb 13, 2023
1 parent 3df72b8 commit c911d2b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -28,6 +29,7 @@ interface Opts {
readonly fast?: number;

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

const Constants = {
Expand Down Expand Up @@ -143,6 +145,12 @@ 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"');
}

log(JSON.stringify(args));

return new Promise(resolve => {
const npx = cp.spawn('npx', args, {
Expand Down Expand Up @@ -313,7 +321,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

0 comments on commit c911d2b

Please sign in to comment.