aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-06-30 03:04:42 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-06-30 03:04:42 +0000
commitef939b7fc41e42c5cc31c6a67ae3f72ab8d4430c (patch)
treed9ecb9020b67dd91f7e83f6149a047e5b2a015fe
parent623af41af1b48d12ef644e509934d1f7241b0ce6 (diff)
parentc97060a3feded2490a99ac6ccf88c5acde04e577 (diff)
downloadperfetto-ef939b7fc41e42c5cc31c6a67ae3f72ab8d4430c.tar.gz
Snap for 6640159 from c97060a3feded2490a99ac6ccf88c5acde04e577 to mainline-release
Change-Id: Ie548ff529630ad674fc2b90c6d1376b42e9b2035
-rw-r--r--src/traced/probes/ftrace/proto_translation_table.cc6
-rw-r--r--src/traced/probes/ftrace/proto_translation_table.h10
2 files changed, 9 insertions, 7 deletions
diff --git a/src/traced/probes/ftrace/proto_translation_table.cc b/src/traced/probes/ftrace/proto_translation_table.cc
index ceb0973a5..44fe5f587 100644
--- a/src/traced/probes/ftrace/proto_translation_table.cc
+++ b/src/traced/probes/ftrace/proto_translation_table.cc
@@ -94,13 +94,13 @@ ProtoTranslationTable::FtracePageHeaderSpec GuessFtracePageHeaderSpec() {
return spec;
}
-const std::vector<Event> BuildEventsVector(const std::vector<Event>& events) {
+const std::deque<Event> BuildEventsDeque(const std::vector<Event>& events) {
size_t largest_id = 0;
for (const Event& event : events) {
if (event.ftrace_event_id > largest_id)
largest_id = event.ftrace_event_id;
}
- std::vector<Event> events_by_id;
+ std::deque<Event> events_by_id;
events_by_id.resize(largest_id + 1);
for (const Event& event : events) {
events_by_id[event.ftrace_event_id] = event;
@@ -466,7 +466,7 @@ ProtoTranslationTable::ProtoTranslationTable(
FtracePageHeaderSpec ftrace_page_header_spec,
CompactSchedEventFormat compact_sched_format)
: ftrace_procfs_(ftrace_procfs),
- events_(BuildEventsVector(events)),
+ events_(BuildEventsDeque(events)),
largest_id_(events_.size() - 1),
common_fields_(std::move(common_fields)),
ftrace_page_header_spec_(ftrace_page_header_spec),
diff --git a/src/traced/probes/ftrace/proto_translation_table.h b/src/traced/probes/ftrace/proto_translation_table.h
index 83dd19d6b..2cf092618 100644
--- a/src/traced/probes/ftrace/proto_translation_table.h
+++ b/src/traced/probes/ftrace/proto_translation_table.h
@@ -19,6 +19,7 @@
#include <stdint.h>
+#include <deque>
#include <iostream>
#include <map>
#include <memory>
@@ -121,9 +122,10 @@ class ProtoTranslationTable {
const Event* GetEventById(size_t id) const {
if (id == 0 || id > largest_id_)
return nullptr;
- if (!events_.at(id).ftrace_event_id)
+ const Event* evt = &events_[id];
+ if (!evt->ftrace_event_id)
return nullptr;
- return &events_.at(id);
+ return evt;
}
size_t EventToFtraceId(const GroupAndName& group_and_name) const {
@@ -132,7 +134,7 @@ class ProtoTranslationTable {
return group_and_name_to_event_.at(group_and_name)->ftrace_event_id;
}
- const std::vector<Event>& events() { return events_; }
+ const std::deque<Event>& events() { return events_; }
const FtracePageHeaderSpec& ftrace_page_header_spec() const {
return ftrace_page_header_spec_;
}
@@ -173,7 +175,7 @@ class ProtoTranslationTable {
Event& event);
const FtraceProcfs* ftrace_procfs_;
- std::vector<Event> events_;
+ std::deque<Event> events_;
size_t largest_id_;
std::map<GroupAndName, const Event*> group_and_name_to_event_;
std::map<std::string, std::vector<const Event*>> name_to_events_;