5c1e0c0a23
- Deduplicate entries when writing multiple runs into a single .txt file - Add support to load multiple files directly via url params - Display graphs after appending new files - Fix tracing .json import script Change-Id: I06349df57faf206d6a215cfc279c79d1f0dd684c No-Try: true Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2650211 Commit-Queue: Camillo Bruni <cbruni@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#72390}
78 lines
1.5 KiB
Bash
Executable File
78 lines
1.5 KiB
Bash
Executable File
#1/bin/env bash
|
|
set -e
|
|
|
|
usage() {
|
|
cat << EOF
|
|
usage: $0 OPTIONS RESULTS_DIR | TRACE_JSON
|
|
|
|
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
|
|
TRACE_JSON .json trace files
|
|
EOF
|
|
}
|
|
|
|
|
|
while getopts ":h" OPTION ; do
|
|
case $OPTION in
|
|
h) usage
|
|
exit 0
|
|
;;
|
|
?) echo "Illegal option: -$OPTARG"
|
|
usage
|
|
exit 1
|
|
;;
|
|
esac
|
|
done
|
|
|
|
# =======================================================================
|
|
|
|
if [[ "$1" == *.json ]]; then
|
|
echo "Converting json files"
|
|
JSON=$1
|
|
elif [[ -e "$1" ]]; then
|
|
echo "Converting reults dir"
|
|
RESULTS_DIR=$1
|
|
else
|
|
echo "RESULTS_DIR '$RESULTS_DIR' not found";
|
|
usage;
|
|
exit 1;
|
|
fi
|
|
|
|
|
|
OUT=out.json
|
|
if [[ -e $OUT ]]; then
|
|
echo "# Creating backup for $OUT"
|
|
cp --backup=numbered $OUT $OUT.bak
|
|
fi
|
|
echo "# Writing to $OUT"
|
|
|
|
|
|
function convert {
|
|
NAME=$1
|
|
JSON=$2
|
|
du -sh $JSON;
|
|
echo "Converting NAME=$NAME";
|
|
echo "," >> $OUT;
|
|
echo "\"$NAME\": " >> $OUT;
|
|
jq '[.traceEvents[].args | select(."runtime-call-stats" != null) | ."runtime-call-stats"]' $JSON >> $OUT;
|
|
}
|
|
|
|
|
|
echo '{ "telemetry-results": { "placeholder":{}' > $OUT
|
|
if [[ $RESULTS_DIR ]]; then
|
|
for PAGE_DIR in $RESULTS_DIR/*_1; do
|
|
NAME=`basename $PAGE_DIR`;
|
|
JSON="$PAGE_DIR/trace/traceEvents/*_converted.json";
|
|
convert $NAME $JSON
|
|
done
|
|
else
|
|
for JSON in $@; do
|
|
convert $JSON $JSON
|
|
done
|
|
fi
|
|
echo '}}' >> $OUT
|