Add --trace_folder to aapt2
Add a tracing API and instrument key functions in order to profile
aapt2 bottleneck. The API allows to generate systrace fragment files.
Impact on performance is neglibible with each Trace requiring less
than 1us and the final Flush operation at the end of a command
requiring around 40us.
Bug: None
Test: None
Change-Id: I51b564d3694e9384679f43b878b32295527dddf6
diff --git a/tools/aapt2/link/TableMerger.cpp b/tools/aapt2/link/TableMerger.cpp
index cc9fed5..e937517 100644
--- a/tools/aapt2/link/TableMerger.cpp
+++ b/tools/aapt2/link/TableMerger.cpp
@@ -21,6 +21,7 @@
#include "ResourceTable.h"
#include "ResourceUtils.h"
#include "ResourceValues.h"
+#include "trace/TraceBuffer.h"
#include "ValueVisitor.h"
#include "util/Util.h"
@@ -38,6 +39,7 @@
}
bool TableMerger::Merge(const Source& src, ResourceTable* table, bool overlay) {
+ TRACE_CALL();
// We allow adding new resources if this is not an overlay, or if the options allow overlays
// to add new resources.
return MergeImpl(src, table, overlay, options_.auto_add_overlay || !overlay /*allow_new*/);