diff --git a/tools/callstats-from-telemetry.sh b/tools/callstats-from-telemetry.sh new file mode 100755 index 0000000000..ead482a3ae --- /dev/null +++ b/tools/callstats-from-telemetry.sh @@ -0,0 +1,61 @@ +#1/bin/env bash +set -e + +usage() { +cat << EOF +usage: $0 OPTIONS RESULTS_DIR + +Convert telemetry json trace result to callstats.html compatible +versions ot ./out.json + +OPTIONS: + -h Show this message. + RESULTS_DIR tools/perf/artifacts/run_XXX +EOF +} + + +while getopts ":h" OPTION ; do + case $OPTION in + h) usage + exit 0 + ;; + ?) echo "Illegal option: -$OPTARG" + usage + exit 1 + ;; + esac +done + +# ======================================================================= + +RESULTS_DIR=$1 + +if [[ ! -e "$RESULTS_DIR" ]]; then + echo "RESULTS_DIR '$RESULTS_DIR' not found"; + usage; + exit 1; +fi + + +OUT=out.json + +if [[ -e $OUT ]]; then + cp --backup=numbered $OUT $OUT.bak +fi + + +echo '{ "telemetry-results": { "placeholder":{}' > $OUT + +for PAGE_DIR in $RESULTS_DIR/*_1; do + PAGE=`basename $PAGE_DIR`; + JSON="$PAGE_DIR/trace/traceEvents/*_converted.json"; + du -sh $JSON; + echo "Converting PAGE=$PAGE"; + echo "," >> $OUT; + echo "\"$PAGE\": " >> $OUT; + jq '[.traceEvents[].args | select(."runtime-call-stats" != null) | ."runtime-call-stats"]' $JSON >> $OUT; +done + + +echo '}}' >> $OUT diff --git a/tools/callstats.html b/tools/callstats.html index f554c65eee..5e691ed5c6 100644 --- a/tools/callstats.html +++ b/tools/callstats.html @@ -2148,8 +2148,28 @@ code is governed by a BSD-style license that can be found in the LICENSE file.

Usage

    -
  1. Install scipy, e.g. sudo aptitude install python-scipy
  2. Build chrome.
  3. +
+

Telemetry benchmark

+
    +
  1. Run v8.browsing benchmarks: +
    $CHROMIUM_DIR/tools/perf/run_benchmark run v8.browsing_desktop \
    +          --browser=exact --browser-executable=$CHROMIUM_DIR/out/release/chrome \
    +          --story-filter='.*2020 ' \
    +          --also-run-disabled-tests
    +        
    +
  2. +
  3. Install jq.
  4. +
  5. Convert the telemetry JSON files to callstats JSON file: +
    +          $V8_DIR/tools/callstats-from-telemetry.sh $CHROMIUM_DIR/tools/perf/artifacts/run_XXXX
    +        
    +
  6. +
  7. Load the generated out.json
  8. +
+

Raw approach

+
    +
  1. Install scipy, e.g. sudo aptitude install python-scipy
  2. Check out a known working version of webpagereply:
    git -C $CHROME_DIR/third_party/webpagereplay checkout 7dbd94752d1cde5536ffc623a9e10a51721eff1d