summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2023-05-02 17:01:00 -0700
committerYabin Cui <yabinc@google.com>2023-05-03 17:25:09 -0700
commita3b80db6fd6a15fc79b04ac982dab4d42c4cce95 (patch)
treed9fe1b141e78f5d6db7c73a4d402ea290b88722d
parent4b4679021b76d71468bf6fc0197bb039cc086f7b (diff)
downloadextras-a3b80db6fd6a15fc79b04ac982dab4d42c4cce95.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 (cherry picked from https://android-review.googlesource.com/q/commit:37901380f15753af25ec9b3a3cf3c34604e13051) Merged-In: I3debd97798aac0756dfeb829f60104a41076d140 Change-Id: I3debd97798aac0756dfeb829f60104a41076d140
-rw-r--r--profcollectd/libprofcollectd/simpleperf_etm_trace_provider.rs14
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<()> {