blob: d1770f530c5760b09675cb6e9a2c649cbfdbb37b [file] [log] [blame] [edit]
#!/bin/bash
# This script generates .proto files for ftrace events from the /format files
# in src/traced/probes/ftrace/test/data/*/events/.
# Only the events in the event_list are translated.
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
if [ "$BUILDDIR" == "" ]; then
BUILDDIR="$DIR/../out/ftrace_proto_gen_build"
"$DIR/gn" gen "$BUILDDIR" --args="is_debug=false"
else
BUILDDIR="$(realpath $BUILDDIR)"
if [ ! -d "$BUILDDIR" ]; then
echo "Directory does not exist: $BUILDDIR"
exit 1
fi
fi
DESCRIPTOR='gen/protos/perfetto/trace/ftrace/ftrace.descriptor'
"$DIR/ninja" -C "$BUILDDIR" ftrace_proto_gen $DESCRIPTOR
# FIXME(fmayer): make ftrace_proto_gen independent of cwd.
cd "$DIR/.."
"$BUILDDIR/ftrace_proto_gen" \
--event_list "$DIR/ftrace_proto_gen/event_list" \
--output_dir "$DIR/../protos/perfetto/trace/ftrace/" \
--proto_descriptor "$BUILDDIR/$DESCRIPTOR" \
--update_build_files \
"$@" \
"$DIR"/../src/traced/probes/ftrace/test/data/*/events/