summaryrefslogtreecommitdiff
path: root/simpleperf/event_selection_set.h
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-07-09 13:18:28 -0700
committerYabin Cui <yabinc@google.com>2018-07-09 13:18:48 -0700
commitcaf9fd54788c71cba570a3661c28839ebdaef944 (patch)
tree85dd03fa85a9b46b865af03ae7c68d30141cc143 /simpleperf/event_selection_set.h
parentf011a9ff8a6c2f7faa30153141d630c3878ae678 (diff)
downloadextras-caf9fd54788c71cba570a3661c28839ebdaef944.tar.gz
simpleperf: fix more recording time than requested.
EventSelectionSet::ReadMmapEventData() reads records until the record buffer is empty, so stop recording event may not be processed in time. This patch fix it with below changes: 1. Add time limit for ReadMmapEventData(). So it can stop reading after taking 100ms. 2. In FinishReadMmapEventData(), stop the read thread before reading all records. Bug: 111083259 Test: run simpleperf_unit_test. Test: run simpleperf manually, the recording time takes no more than Test: 200ms than requested. Change-Id: Id58e100e774770e3a10e41ac593867e8ae3b2288
Diffstat (limited to 'simpleperf/event_selection_set.h')
-rw-r--r--simpleperf/event_selection_set.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/simpleperf/event_selection_set.h b/simpleperf/event_selection_set.h
index e5d77e75..f8067868 100644
--- a/simpleperf/event_selection_set.h
+++ b/simpleperf/event_selection_set.h
@@ -134,7 +134,7 @@ class EventSelectionSet {
bool ReadCounters(std::vector<CountersInfo>* counters);
bool MmapEventFiles(size_t min_mmap_pages, size_t max_mmap_pages, size_t record_buffer_size);
bool PrepareToReadMmapEventData(const std::function<bool(Record*)>& callback);
- bool ReadMmapEventData(bool sync_kernel_buffer);
+ bool SyncKernelBuffer();
bool FinishReadMmapEventData();
void GetLostRecords(size_t* lost_samples, size_t* lost_non_samples, size_t* cut_stack_samples);
@@ -166,6 +166,7 @@ class EventSelectionSet {
const std::map<pid_t, std::set<pid_t>>& process_map);
bool OpenEventFilesOnGroup(EventSelectionGroup& group, pid_t tid, int cpu,
std::string* failed_event_type);
+ bool ReadMmapEventData(bool with_time_limit);
bool DetectCpuHotplugEvents();
bool HandleCpuOnlineEvent(int cpu);