diff options
author | Yabin Cui <yabinc@google.com> | 2017-11-08 17:52:42 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2017-11-08 18:04:10 -0800 |
commit | bf1dd36838f4244e0934ca3c193889ae74a7c116 (patch) | |
tree | 16a7496e50a8f63e4d71b75b2637fa69f51c1ab8 /simpleperf/report_lib_interface.cpp | |
parent | 04c21cf5544e998da99f739466c679c4e1819a8d (diff) | |
download | extras-bf1dd36838f4244e0934ca3c193889ae74a7c116.tar.gz |
simpleperf: fix parsing perf.data generated by --trace-offcpu option.
When parsing perf.data generated by --trace-offcpu option, report_lib_interface
mixes all samples from cpu-cycles (or other events) and sched:sched_switch, and
uses timestamp difference as sample period. However, it still shows both event
names. This makes report_html.py generate sample table for each event name
separately. To fix this, this CL uses event name cpu-cycles for all samples.
Bug: http://b/66914187
Test: run report_html.py on perf.data generated by --trace-offcpu.
Test: run python test.py TestReportLib.test_offcpu.
Change-Id: Ic5f2e64564355f860283085fc691ead4134affa1
Diffstat (limited to 'simpleperf/report_lib_interface.cpp')
-rw-r--r-- | simpleperf/report_lib_interface.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/simpleperf/report_lib_interface.cpp b/simpleperf/report_lib_interface.cpp index c7a606c9..e3af8a88 100644 --- a/simpleperf/report_lib_interface.cpp +++ b/simpleperf/report_lib_interface.cpp @@ -285,8 +285,13 @@ Event* ReportLib::GetEventOfCurrentSample() { event_attrs_.push_back(attr); } } - size_t attr_index = - record_file_reader_->GetAttrIndexOfRecord(current_record_.get()); + size_t attr_index; + if (trace_offcpu_) { + // For trace-offcpu, we don't want to show event sched:sched_switch. + attr_index = 0; + } else { + attr_index = record_file_reader_->GetAttrIndexOfRecord(current_record_.get()); + } current_event_.name = event_attrs_[attr_index].name.c_str(); update_flag_ |= UPDATE_FLAG_OF_EVENT; } |