#analyzer #ebpf #android #apps #frame #frametime #uprobe

frame-analyzer-pro-max

Track the frametime of Android apps, based on ebpf & uprobe

13 releases

new 0.0.14 Dec 26, 2024
0.0.13 Dec 26, 2024

#26 in #ebpf

Download history 731/week @ 2024-12-25

731 downloads per month

GPL-3.0 license

41KB
649 lines

frame-analyzer

  • This crate is used to monitor the frametime of the target application on the android device
  • Based on the EBPF and UPROBE implementations, you may need higher privileges (e.g. root) to use this crate properly
  • This IS NOT a bin crate, it uses some tricks (see source) to get it to work like a normal lib crate, even though it includes an EBPF program
  • Only 64-bit devices & apps are supported!

Examples

Simple frametime analyzer, print pid & frametime on the screen

use std::sync::{
  atomic::{AtomicBool, Ordering},
  Arc,
};

use frame_analyzer::Analyzer;

#
let mut analyzer = Analyzer::new()?;
analyzer.attach_app(app_pid_a)?;
analyzer.attach_app(app_pid_b)?;
analyzer.attach_app(app_pid_c)?; // muti-apps are supported

let running = Arc::new(AtomicBool::new(true));

{
    let running = running.clone();
    ctrlc::set_handler(move || {
        running.store(false, Ordering::Release);
    })?;
}
#
#
while running.load(Ordering::Acquire) {
    if let Some((pid, frametime)) = analyzer.recv() {
        println!("process: {pid}, frametime: {frametime:?}");
    }
}
#

Dependencies

~7–16MB
~206K SLoC