How to use the tracerbench.loadTrace function in tracerbench

To help you get started, we’ve selected a few tracerbench examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TracerBench / tracerbench / packages / cli / src / commands / js-eval-time.ts View on Github external
task: () => {
          trace = loadTrace(events.traceEvents);
        },
        title: 'Loading Trace',
github TracerBench / tracerbench / packages / cli / src / commands / css-parse.ts View on Github external
let trace: any = null;
    let totalDuration: number = 0;

    const { flags } = this.parse(CSSParse);
    const { traceJSONOutput } = flags;

    try {
      events = JSON.parse(fs.readFileSync(traceJSONOutput, 'utf8'));
    } catch (error) {
      this.error(
        `Could not extract trace events from trace JSON file at path ${traceJSONOutput}, ${error}`
      );
    }

    try {
      trace = loadTrace(events.traceEvents);
    } catch (error) {
      this.error(error);
    }

    trace.events
      .filter((event: any) => event.name === 'ParseAuthorStyleSheet')
      .filter((event: any) => event.args.data.styleSheetUrl)
      .forEach((event: any) => {
        const url = event.args.data.styleSheetUrl;
        const durationInMs = event.dur / 1000;
        totalDuration += durationInMs;
        this.log(`CSS: ${url}: ${durationInMs.toFixed(2)}`);
      });

    this.log(`TOTAL DURATION: ${totalDuration.toFixed(2)}ms`);
  }
github TracerBench / tracerbench / packages / cli / src / commands / list-functions.ts View on Github external
let profile: any = null;

    const { flags } = this.parse(ListFunctions);
    const { traceJSONOutput, locations } = flags;
    const methods = new Set();

    try {
      events = JSON.parse(fs.readFileSync(traceJSONOutput, 'utf8'));
    } catch (error) {
      this.error(
        `Could not extract trace events from trace file at path ${traceJSONOutput}, ${error}`
      );
    }

    try {
      trace = loadTrace(events.traceEvents);
    } catch (error) {
      this.error(error);
    }

    try {
      profile = trace.cpuProfile(-1, -1);
    } catch (error) {
      this.error(error);
    }

    if (locations) {
      profile.nodeMap.forEach((node: any) => {
        const { functionName, url, lineNumber, columnNumber } = node.callFrame;

        methods.add(
          `${url}:${lineNumber}:${columnNumber}.${normalizeFnName(

tracerbench

CLI for TracerBench

BSD-2-Clause
Latest version published 2 years ago

Package Health Score

46 / 100
Full package analysis

Popular tracerbench functions