summaryrefslogtreecommitdiff
path: root/tools/aapt2/format/Container.cpp
diff options
context:
space:
mode:
authorFabien Sanglard <sanglardf@google.com>2019-02-21 15:13:29 -0800
committerFabien Sanglard <sanglardf@google.com>2019-03-05 15:09:27 -0800
commit2d34e76daceaac41a8c578d7fa02aca864019dbb (patch)
treebd46b9065635728d88f2a6f40236c442ecad5f12 /tools/aapt2/format/Container.cpp
parent63ebfcba5d62de4db9cfeb627ac98a4bc65ef425 (diff)
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
Diffstat (limited to 'tools/aapt2/format/Container.cpp')
-rw-r--r--tools/aapt2/format/Container.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/aapt2/format/Container.cpp b/tools/aapt2/format/Container.cpp
index d4b45717e015..f1890488276c 100644
--- a/tools/aapt2/format/Container.cpp
+++ b/tools/aapt2/format/Container.cpp
@@ -19,6 +19,8 @@
#include "android-base/scopeguard.h"
#include "android-base/stringprintf.h"
+#include "trace/TraceBuffer.h"
+
using ::android::base::StringPrintf;
using ::google::protobuf::io::CodedInputStream;
using ::google::protobuf::io::CodedOutputStream;
@@ -171,6 +173,7 @@ ContainerEntryType ContainerReaderEntry::Type() const {
}
bool ContainerReaderEntry::GetResTable(pb::ResourceTable* out_table) {
+ TRACE_CALL();
CHECK(type_ == ContainerEntryType::kResTable) << "reading a kResTable when the type is kResFile";
if (length_ > std::numeric_limits<int>::max()) {
reader_->error_ = StringPrintf("entry length %zu is too large", length_);
@@ -261,6 +264,7 @@ ContainerReader::ContainerReader(io::InputStream* in)
total_entry_count_(0u),
current_entry_count_(0u),
entry_(this) {
+ TRACE_CALL();
::google::protobuf::uint32 magic;
if (!coded_in_.ReadLittleEndian32(&magic)) {
std::ostringstream error;