diff options
author | Yabin Cui <yabinc@google.com> | 2015-08-19 15:01:12 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2015-08-19 16:18:31 -0700 |
commit | 04d08a35c5e1cabdf6eb7397536a790b0ff44459 (patch) | |
tree | 1061b9086a6782f0b1630d2d98452633188242e0 /simpleperf/event_selection_set.cpp | |
parent | 3c599ffc9954dd25f0f3ad012189f825afd89449 (diff) | |
download | extras-04d08a35c5e1cabdf6eb7397536a790b0ff44459.tar.gz |
Simpleperf: improve output of stat command.
Before this change:
$sudo simpleperf record -a sleep 1
Performance counter statistics:
5994649915(scaled) cpu-cycles
8785461570(scaled) stalled-cycles-frontend
6089237592(scaled) instructions
1086987265(scaled) branch-instructions
11019426(scaled) branch-misses
40306210522 task-clock
21955 context-switches
16659 page-faults
Total test time: 1.007973 seconds.
After this change:
$sudo simpleperf record -a sleep 1
Performance counter statistics:
11,768,763,985 cpu-cycles # 11.675808 Ghz (83%)
16,142,943,081 stalled-cycles-frontend # 16.015 G/sec (67%)
17,286,201,730 instructions # 0.680818 cycles per instruction (83%)
3,141,529,369 branch-instructions # 3.117 G/sec (84%)
18,168,963 branch-misses # 0.578348% miss rate (83%)
40222.432118(ms) task-clock # 3990.473223% cpu usage (100%)
19,240 context-switches # 19.088 K/sec (100%)
9,302 page-faults # 9.229 K/sec (100%)
Total test time: 1.007961 seconds.
Change-Id: I5590699957650e246b14b3d2b405108483631908
Diffstat (limited to 'simpleperf/event_selection_set.cpp')
-rw-r--r-- | simpleperf/event_selection_set.cpp | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/simpleperf/event_selection_set.cpp b/simpleperf/event_selection_set.cpp index 555246e6..c3a538e8 100644 --- a/simpleperf/event_selection_set.cpp +++ b/simpleperf/event_selection_set.cpp @@ -205,18 +205,21 @@ bool EventSelectionSet::EnableEvents() { return true; } -bool EventSelectionSet::ReadCounters( - std::map<const EventTypeAndModifier*, std::vector<PerfCounter>>* counters_map) { +bool EventSelectionSet::ReadCounters(std::vector<CountersInfo>* counters) { + counters->clear(); for (auto& selection : selections_) { - std::vector<PerfCounter> counters; + CountersInfo counters_info; + counters_info.event_type = &selection.event_type_modifier; for (auto& event_fd : selection.event_fds) { - PerfCounter counter; - if (!event_fd->ReadCounter(&counter)) { + CountersInfo::CounterInfo counter_info; + if (!event_fd->ReadCounter(&counter_info.counter)) { return false; } - counters.push_back(counter); + counter_info.tid = event_fd->ThreadId(); + counter_info.cpu = event_fd->Cpu(); + counters_info.counters.push_back(counter_info); } - counters_map->insert(std::make_pair(&selection.event_type_modifier, counters)); + counters->push_back(counters_info); } return true; } @@ -278,17 +281,6 @@ bool EventSelectionSet::ReadMmapEventData(std::function<bool(const char*, size_t return true; } -std::string EventSelectionSet::FindEventFileNameById(uint64_t id) { - for (auto& selection : selections_) { - for (auto& event_fd : selection.event_fds) { - if (event_fd->Id() == id) { - return event_fd->Name(); - } - } - } - return ""; -} - EventSelectionSet::EventSelection* EventSelectionSet::FindSelectionByType( const EventTypeAndModifier& event_type_modifier) { for (auto& selection : selections_) { |