diff options
author | Yabin Cui <yabinc@google.com> | 2023-05-02 17:01:00 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2023-05-02 17:09:35 -0700 |
commit | 37901380f15753af25ec9b3a3cf3c34604e13051 (patch) | |
tree | bc7567f8fa7f1f2ab81d3d9c3fb59119fba4ea65 /profcollectd | |
parent | fc1f178a6710eeff1f752a66eb3b8b435418b3e0 (diff) | |
download | extras-37901380f15753af25ec9b3a3cf3c34604e13051.tar.gz |
profcollectd: Control record scope by binary filter
Record ETM data for kernel space only when it's not filtered out by
binary_filter.
Bug: 279094308
Test: run profcollectd manually
Change-Id: I3debd97798aac0756dfeb829f60104a41076d140
Diffstat (limited to 'profcollectd')
-rw-r--r-- | profcollectd/libprofcollectd/simpleperf_etm_trace_provider.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/profcollectd/libprofcollectd/simpleperf_etm_trace_provider.rs b/profcollectd/libprofcollectd/simpleperf_etm_trace_provider.rs index cb61802e..2239a182 100644 --- a/profcollectd/libprofcollectd/simpleperf_etm_trace_provider.rs +++ b/profcollectd/libprofcollectd/simpleperf_etm_trace_provider.rs @@ -40,13 +40,15 @@ impl TraceProvider for SimpleperfEtmTraceProvider { fn trace(&self, trace_dir: &Path, tag: &str, sampling_period: &Duration, binary_filter: &str) { let trace_file = trace_provider::get_path(trace_dir, tag, ETM_TRACEFILE_EXTENSION); + // Record ETM data for kernel space only when it's not filtered out by binary_filter. So we + // can get more ETM data for user space when ETM data for kernel space isn't needed. + let record_scope = if binary_filter.contains("kernel") { + simpleperf_profcollect::RecordScope::BOTH + } else { + simpleperf_profcollect::RecordScope::USERSPACE + }; - simpleperf_profcollect::record( - &trace_file, - sampling_period, - binary_filter, - simpleperf_profcollect::RecordScope::BOTH, - ); + simpleperf_profcollect::record(&trace_file, sampling_period, binary_filter, record_scope); } fn process(&self, trace_dir: &Path, profile_dir: &Path, binary_filter: &str) -> Result<()> { |