diff options
author | Yi Kong <yikong@google.com> | 2021-12-09 01:37:57 +0800 |
---|---|---|
committer | Yi Kong <yikong@google.com> | 2021-12-08 17:57:37 +0000 |
commit | 87d0a1757388ea06be70906f33033a0a57387a70 (patch) | |
tree | dbceb023245c44e1b7c77970adc9f031ba8b801c /profcollectd | |
parent | 356882916927b437f4ec3d4987245d7f46d81d4a (diff) | |
download | extras-87d0a1757388ea06be70906f33033a0a57387a70.tar.gz |
profcollectd: include apex binaries in binary filter
Also make binary filter controlled by device config.
Test: manual
Bug: 79161490
Change-Id: I9fbb393eb7c46fbef9640ccb8b31e22c498254ef
Diffstat (limited to 'profcollectd')
-rw-r--r-- | profcollectd/libprofcollectd/config.rs | 3 | ||||
-rw-r--r-- | profcollectd/libprofcollectd/scheduler.rs | 6 | ||||
-rw-r--r-- | profcollectd/libprofcollectd/service.rs | 2 |
3 files changed, 5 insertions, 6 deletions
diff --git a/profcollectd/libprofcollectd/config.rs b/profcollectd/libprofcollectd/config.rs index 74c3c8f1..3134e308 100644 --- a/profcollectd/libprofcollectd/config.rs +++ b/profcollectd/libprofcollectd/config.rs @@ -30,6 +30,7 @@ use std::time::Duration; const PROFCOLLECT_CONFIG_NAMESPACE: &str = "profcollect_native_boot"; const PROFCOLLECT_NODE_ID_PROPERTY: &str = "persist.profcollectd.node_id"; +const DEFAULT_BINARY_FILTER: &str = "^/(system|apex/.+)/(bin|lib|lib64)/.+"; pub const REPORT_RETENTION_SECS: u64 = 14 * 24 * 60 * 60; // 14 days. // Static configs that cannot be changed. @@ -71,7 +72,7 @@ impl Config { 600, )?), sampling_period: Duration::from_millis(get_device_config("sampling_period", 500)?), - binary_filter: get_device_config("binary_filter", "".to_string())?, + binary_filter: get_device_config("binary_filter", DEFAULT_BINARY_FILTER.to_string())?, max_trace_limit: get_device_config( "max_trace_limit", /* 512MB */ 512 * 1024 * 1024, diff --git a/profcollectd/libprofcollectd/scheduler.rs b/profcollectd/libprofcollectd/scheduler.rs index 29a14ff4..d083612e 100644 --- a/profcollectd/libprofcollectd/scheduler.rs +++ b/profcollectd/libprofcollectd/scheduler.rs @@ -27,8 +27,6 @@ use crate::config::{Config, PROFILE_OUTPUT_DIR, TRACE_OUTPUT_DIR}; use crate::trace_provider::{self, TraceProvider}; use anyhow::{anyhow, ensure, Context, Result}; -static BINARY_FILTER: &str = "^(/system/bin/|/system/lib/|/system/lib64/).+"; - pub struct Scheduler { /// Signal to terminate the periodic collection worker thread, None if periodic collection is /// not scheduled. @@ -95,12 +93,12 @@ impl Scheduler { Ok(()) } - pub fn process(&self) -> Result<()> { + pub fn process(&self, config: &Config) -> Result<()> { let trace_provider = self.trace_provider.clone(); trace_provider .lock() .unwrap() - .process(&TRACE_OUTPUT_DIR, &PROFILE_OUTPUT_DIR, BINARY_FILTER) + .process(&TRACE_OUTPUT_DIR, &PROFILE_OUTPUT_DIR, &config.binary_filter) .context("Failed to process profiles.")?; Ok(()) } diff --git a/profcollectd/libprofcollectd/service.rs b/profcollectd/libprofcollectd/service.rs index 0062b2b3..701edff6 100644 --- a/profcollectd/libprofcollectd/service.rs +++ b/profcollectd/libprofcollectd/service.rs @@ -74,7 +74,7 @@ impl IProfCollectd for ProfcollectdBinderService { fn process(&self) -> BinderResult<()> { let lock = &mut *self.lock(); lock.scheduler - .process() + .process(&lock.config) .context("Failed to process profiles.") .map_err(err_to_binder_status) } |