1 #!/bin/bash 2 3 # This script generates .proto files for ftrace events from the /format files 4 # in src/traced/probes/ftrace/test/data/*/events/. 5 # Only the events in the whitelist are translated. 6 7 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 8 if [ "$BUILDDIR" == "" ]; then 9 BUILDDIR="$DIR/../out/ftrace_proto_gen_build" 10 "$DIR/gn" gen "$BUILDDIR" --args="is_debug=false" 11 else 12 BUILDDIR="$(realpath $BUILDDIR)" 13 if [ ! -d "$BUILDDIR" ]; then 14 echo "Directory does not exist: $BUILDDIR" 15 exit 1 16 fi 17 fi 18 19 DESCRIPTOR='gen/protos/perfetto/trace/ftrace.descriptor' 20 "$DIR/ninja" -C "$BUILDDIR" ftrace_proto_gen $DESCRIPTOR 21 22 # FIXME(fmayer): make ftrace_proto_gen independent of cwd. 23 cd "$DIR/.." 24 25 "$BUILDDIR/ftrace_proto_gen" \ 26 --whitelist_path "$DIR/ftrace_proto_gen/event_whitelist" \ 27 --output_dir "$DIR/../protos/perfetto/trace/ftrace/" \ 28 --proto_descriptor "$BUILDDIR/$DESCRIPTOR" \ 29 --update_build_files \ 30 "$@" \ 31 "$DIR"/../src/traced/probes/ftrace/test/data/*/events/ 32