1#!/bin/bash 2 3set -e 4 5DIR=$(mktemp -d out/perfetto.XXXXXX) 6 7function cleanup { 8 rm -rf "$DIR" 9 echo "Deleted temp working directory $DIR" 10} 11 12#trap cleanup EXIT 13 14function is_mac { 15 ! test -d /proc 16 return $? 17} 18 19tools/gn gen $DIR --args='is_clang=true is_debug=false' 20tools/ninja -C $DIR trace_to_text 21 22if is_mac; then 23 platform=mac 24else 25 platform=linux 26 strip $DIR/trace_to_text 27fi 28 29if which shasum; then 30 NEW_SHA=$(shasum $DIR/trace_to_text | cut -f1 -d' ') # Mac OS 31else 32 NEW_SHA=$(sha1sum $DIR/trace_to_text | cut -f1 -d' ') # Linux 33fi 34 35name=trace_to_text-$platform-$NEW_SHA 36 37gsutil cp $DIR/trace_to_text gs://perfetto/$name 38gsutil cp $DIR/trace_to_text gs://chromium-telemetry/binary_dependencies/$name 39gsutil acl ch -u AllUsers:R gs://perfetto/$name 40gsutil acl ch -u AllUsers:R gs://chromium-telemetry/binary_dependencies/$name 41 42echo 'Now run the following command to update tools/traceconv:' 43echo "sed \"s/'$platform': '[^']*',/'$platform': '$NEW_SHA',/\" --in-place tools/traceconv" 44 45echo 'Now run the following command to update tools/heap_profile:' 46echo "sed \"s/'$platform': '[^']*',/'$platform': '$NEW_SHA',/\" --in-place tools/heap_profile" 47