Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tracerbench-cli with all npm packages installed. Try it out:

var tracerbenchCli = require("tracerbench-cli")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tracerbench-cli v1.0.0

CLI for Tracerbench

!!! This is unstable, incomplete, work-in-progress software in a constant state of change. You have been warned!!!

TracerBench-CLI: Automated Chrome Tracing For Benchmarking

Build Status Version License

* [Usage](#usage) * [Optional Config](#optional-config) * [FAQ](#faq) * [Commands](#commands)

Usage

```sh-session $ npm install -g tracerbench-cli $ tracerbench COMMAND running command... $ tracerbench (-v|--version|version) tracerbench-cli/1.0.0 darwin-x64 node-v8.14.0 $ tracerbench --help [COMMAND] USAGE $ tracerbench COMMAND ... ```

Optional Config

The optional existance of a "tbconfig.json" file in the project root will be consumed by TracerBench and specifies default command flag options. Please note this file is optional, however is strongly recommended as this drastically speeds up running TracerBench tests succinctly. Typings and Example:

{
  "file": "./trace.json",
  "fidelity": "low",
  "methods": "''",
  "cpuThrottleRate": 2,
  "output": "tracerbench-results",
  "urlOrFrame": "https://www.tracerbench.com",
  "url": "https://www.tracerbench.com",
  "harsPath": "./hars",
  "routes": ["/about", "/contact"],
  "appName": "tracerbench",
  "markers": [
    {
      "start": "fetchStart",
      "label": "fetchStart"
    },
    {
      "start": "jqueryLoaded",
      "label": "jqueryLoaded"
    },
    {
      "start": "renderEnd",
      "label": "renderEnd"
    }
  ]
}

FAQ

What exactly is contained within the tracerbench compare "tracerbench-results.json"?
An overview of "tracerbench-results.json" is available here

What exactly is a HAR file?
HAR (HTTP Archive) is a file format used by several HTTP session tools to export the captured data. The format is basically a JSON object with a particular field distribution. In any case, please note that not all the fields are mandatory, and many times some information won't be saved to the file "Additional insight on Google's HAR Analyzer"

What exactly is contained within the output file "trace.json"?
The file "trace.json" is leveraged by TracerBench to capture an array of trace events. The interface of an individual trace event is essentially:

// process id
pid: number;
// thread id
tid: number;
// timestamp in μs
ts: number;
// event phase
ph: TRACE_EVENT_PHASE;
// event categories (comma delimited)
cat: string;
// event name
name: string;
// event key/value pairs
args: { [key: string]: any } | ARGS.STRIPPED;
// ?timestamp in μs for trace event phase complete
dur?: number;
// ?thread clock timestamp in μs
tts?: number;
// ?thread clock duration in μs for trace event phase complete
tdur?: number;
// ?thread clock timestamp for related async events
use_async_tts?: number;
// ?scope of id
scope?: string;
// ?event id. optionally serialized as int64
id?: string;
// ?scoped event ids
id2?: | { local: string; } | { global: string; };
// ?async event/event associations
bp?: string;
// ?flow binding id optionally serialized as int64
bind_id?: string;
// ?incoming flow flag
flow_in?: boolean;
// ?outgoing flow flag
flow_out?: boolean;
// ?scope for TRACE_EVENT_PHASE_INSTANT events
s?: TRACE_EVENT_SCOPE;

Commands

* [`tracerbench analyze`](#tracerbench-analyze) * [`tracerbench compare`](#tracerbench-compare) * [`tracerbench create-archive`](#tracerbench-create-archive) * [`tracerbench css-parse`](#tracerbench-css-parse) * [`tracerbench help [COMMAND]`](#tracerbench-help-command) * [`tracerbench js-eval-time`](#tracerbench-js-eval-time) * [`tracerbench list-functions`](#tracerbench-list-functions) * [`tracerbench timeline:find`](#tracerbench-timelinefind) * [`tracerbench timeline:list`](#tracerbench-timelinelist) * [`tracerbench timeline:show`](#tracerbench-timelineshow) * [`tracerbench trace`](#tracerbench-trace)

tracerbench analyze

Parses a CPU profile and aggregates time across heuristics. Can be vertically sliced with event names.

USAGE
  $ tracerbench analyze

OPTIONS
  -a, --archive=archive                  (required) [default: ./trace.har] Path to the existing HAR file
  -f, --traceJSONOutput=traceJSONOutput  (required) [default: ./trace.json] Path to the existing trace JSON file
  -m, --methods=methods                  (required) [default: ""] List of methods to aggregate

  -r, --report=report                    Directory path to generate a report with aggregated sums for each heuristic
                                         category and aggregated sum across all heuristics

  --event=event                          Slice time and see the events before and after the time slice

tracerbench compare

Compare the performance delta between an experiment and control

USAGE
  $ tracerbench compare

OPTIONS
  -n, --network=none|offline|dialup|2g|edge|slow-3g|em-3g|dsl|3g|fast-3g|4g|cable|LTE|FIOS
      Simulated network conditions.

  -o, --output=output
      (required) [default: ./tracerbench-results] The output filepath for compare results

  --browserArgs=browserArgs
      (required) [default: 
      --headless,--disable-gpu,--hide-scrollbars,--mute-audio,--v8-cache-options=none,--disable-cache,--disable-v8-idle-ta
      sks,--crash-dumps-dir=./tmp] (Default Recommended) Browser additional options for the TracerBench render benchmark

  --controlURL=controlURL
      (required) [default: http://localhost:8000/?tracing] Control URL to visit

  --cpuThrottleRate=cpuThrottleRate
      (required) [default: 1] CPU throttle multiplier

  --experimentURL=experimentURL
      (required) [default: http://localhost:8001/?tracing] Experiment URL to visit

  --fidelity=test|low|medium|high
      (required) [default: low] Directly correlates to the number of samples per trace. High means a longer trace time.

  --markers=markers
      (required) [default: [object Object],[object Object],[object Object],[object Object],[object Object],[object 
      Object]] DOM markers

tracerbench create-archive

Creates an automated HAR file from a URL.

USAGE
  $ tracerbench create-archive

OPTIONS
  --archiveOutput=archiveOutput  (required) [default: ./trace.har] The output filepath/name to save the HAR to
  --url=url                      (required) [default: http://localhost:8000/?tracing] URL to visit

tracerbench css-parse

Aggregates CSS parsing time from a trace.

USAGE
  $ tracerbench css-parse

OPTIONS
  -f, --traceJSONOutput=traceJSONOutput  (required) [default: ./trace.json] Path to the existing trace JSON file

tracerbench help [COMMAND]

display help for tracerbench

USAGE
  $ tracerbench help [COMMAND]

ARGUMENTS
  COMMAND  command to show help for

OPTIONS
  --all  see all commands in CLI

See code: @oclif/plugin-help

tracerbench js-eval-time

Aggregates JS Eval time from a trace.

USAGE
  $ tracerbench js-eval-time

OPTIONS
  -f, --traceJSONOutput=traceJSONOutput  (required) [default: ./trace.json] Path to the existing trace JSON file

tracerbench list-functions

Lists all the functions and source locations from a trace.

USAGE
  $ tracerbench list-functions

OPTIONS
  -f, --traceJSONOutput=traceJSONOutput  (required) [default: ./trace.json] Path to the existing trace JSON file
  -l, --locations=locations              include locations in names

tracerbench timeline:find

Get frame id from trace JSON file and url.

USAGE
  $ tracerbench timeline:find

OPTIONS
  -f, --traceJSONOutput=traceJSONOutput  (required) [default: ./trace.json] Path to the existing trace JSON file
  --url=url                              (required) [default: http://localhost:8000/?tracing] URL to visit

tracerbench timeline:list

list main frame loads

USAGE
  $ tracerbench timeline:list

OPTIONS
  -f, --traceJSONOutput=traceJSONOutput  (required) [default: ./trace.json] Path to the existing trace JSON file

tracerbench timeline:show

show tracefile with user timings

USAGE
  $ tracerbench timeline:show

OPTIONS
  -f, --traceJSONOutput=traceJSONOutput  (required) [default: ./trace.json] Path to the existing trace JSON file
  --filter=filter                        User timing marks start with
  --marks=marks                          Show user timing marks
  --urlOrFrame=urlOrFrame                (required) URL or Frame

tracerbench trace

Creates an automated trace JSON file. Also takes network conditioner and CPU throttling options.

USAGE
  $ tracerbench trace

OPTIONS
  -f, --traceJSONOutput=traceJSONOutput                                                     (required) [default:
                                                                                            ./trace.json] Path to the
                                                                                            existing trace JSON file

  -h, --har=har                                                                             Filepath to the existing HAR
                                                                                            file

  -n, --network=none|offline|dialup|2g|edge|slow-3g|em-3g|dsl|3g|fast-3g|4g|cable|LTE|FIOS  Simulated network
                                                                                            conditions.

  --archiveOutput=archiveOutput                                                             (required) [default:
                                                                                            ./trace.har] The output
                                                                                            filepath/name to save the
                                                                                            HAR to

  --cpuThrottleRate=cpuThrottleRate                                                         (required) [default: 1] CPU
                                                                                            throttle multiplier

  --iterations=iterations                                                                   (required) [default: 1]
                                                                                            Number of runs

  --url=url                                                                                 (required) [default:
                                                                                            http://localhost:8000/?traci
                                                                                            ng] URL to visit
RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free