diff options
author | Igor Murashkin <iam@google.com> | 2019-02-22 14:20:42 -0800 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2019-03-29 15:25:39 -0700 |
commit | c86d0d01070422485c18f2cf9d6b6f401cf2f05e (patch) | |
tree | 6e0d2226d672ed3ec7ea24cb606cabc5768d2481 /Android.bp | |
parent | a128a86e290a930681786d85c8f24673776c219e (diff) | |
download | platform_system_iorap-c86d0d01070422485c18f2cf9d6b6f401cf2f05e.tar.gz platform_system_iorap-c86d0d01070422485c18f2cf9d6b6f401cf2f05e.tar.bz2 platform_system_iorap-c86d0d01070422485c18f2cf9d6b6f401cf2f05e.zip |
iorap: add compiler for perfetto TracePackets
Compile perfetto TracePacket protobufs (which contain Ftraces):
Front-end:
* Parse the perfetto protobufs, extracting the mm events
Resolver:
* Convert inodes to filename paths
Compiler:
* Lower ftrace events to simpler compiler IR
* Merge multiple IR events into a single event
* Greedily reorder IR events to optimize latency
$> iorap.cmd.compiler --output-proto <output-filename.pb> \
trace_packet1.pb trace_packet2.pb [...]
Bug: 72170747
Change-Id: I9ca6677e0cbd4818ec9c4392d9fd47fa23d67f67
Diffstat (limited to 'Android.bp')
-rw-r--r-- | Android.bp | 83 |
1 files changed, 83 insertions, 0 deletions
@@ -111,11 +111,13 @@ cc_library_static { include_dirs: ["frameworks/native/aidl/binder"], export_aidl_headers: true, }, + static_libs: [ "libplatformprotos", // android framework C++ protos. ], } + cc_defaults { name: "libiorap-manager-default-dependencies", static_libs: [ @@ -293,3 +295,84 @@ cc_binary { "perfetto_trace_protos", ], } + +// Static libraries cannot export their dependencies, +// the current convention is to use an extra 'defaults' rule for statics +// to bring in all the dependencies. +cc_defaults { + name: "libiorap-compiler-default-dependencies", + + defaults: [ + // use the perfetto namespace + "libiorap-perfetto-default-dependencies" + // use the inode2filename namespace + ], + + // Some of the libperfetto header typedefs leak out into iorap. + // Avoids compilation #include errors. + // TODO: clean this up, the headers should not leak out (maybe all we need is a PerfettoConsumer + // forward declaration?). + include_dirs: [], + // Various perfetto protos are used directly by iorap. + // + // Furthermore, we need this regardless to avoid linking errors when linking + // libiorap-compiler.a into the main cc_binary rule. + static_libs: [ + "libiorap-perfetto", + // "perfetto_trace_protos", + "libiorap-inode2filename", + ], + + shared_libs: [ + // Not part of true dependencies: Users of 'libiorap-compiler' do not link against + // libperfetto. + // We only put this to avoid linking errors when building iorapd. + // TODO: can we split iorapd into libiorapd-main that doesn't link against libperfetto? + // only the last cc_binary should need the full transitive closure of the dependency graph. + ] +} + +cc_library_static { + name: "libiorap-compiler", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-compiler-default-dependencies", + ], + + srcs: [ + "src/compiler/**/*.cc", + ], +} + +cc_binary { + name: "iorap.cmd.compiler", + defaults: [ + "iorap-default-flags", + "iorap-default-dependencies", + "libiorap-compiler-default-dependencies", + ], + shared_libs: [], + include_dirs: [], + srcs: [ + "src/compiler/**/*.cc", + ], + // Easier debugging. TODO: make a separate debug config. + // XX: Using -O0 seems to completely hide some errors. + cflags: ["-O2", "-UNDEBUG", "-DIORAP_COMPILER_MAIN=1"], + sanitize: { + undefined: true, + all_undefined: true, + // Pretty print when ubsan detects a problem. + // Otherwise it just calls abort(). + +/* + diag: { + undefined: true, + }, + */ // don't use the diag when you want it to crash. + }, + + static_libs: [ + ], +} |