#ebpf #android #frame #app #analyzer #uprobe #frametime #debugging

frame-analyzer-ebpf-common

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

3 releases (breaking)

Uses new Rust 2024

0.3.4 Oct 4, 2025
0.2.7 Oct 3, 2024
0.1.0 Apr 20, 2024

#1 in #uprobe

Download history 32/week @ 2025-08-26 72/week @ 2025-09-02 50/week @ 2025-09-09 60/week @ 2025-09-16 52/week @ 2025-09-23 230/week @ 2025-09-30 121/week @ 2025-10-07 82/week @ 2025-10-14 47/week @ 2025-10-21 24/week @ 2025-10-28 40/week @ 2025-11-04 10/week @ 2025-11-11 41/week @ 2025-11-18 17/week @ 2025-11-25 38/week @ 2025-12-02 195/week @ 2025-12-09

292 downloads per month
Used in 5 crates

GPL-3.0 license

4KB

frame-analyzer-ebpf

Crates.io License Documentaiton

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

  • 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 anyhow::Result;
use clap::Parser;
use frame_analyzer::Analyzer;

/// Simple frame analyzer, print frametime on the screen
#[derive(Parser, Debug)]
#[command(version, about)]
struct Args {
    /// The pid of the target application
    #[arg(short, long)]
    pid: i32,
}

fn main() -> Result<()> {
    let arg = Args::parse();
    let pid = arg.pid;

    let mut analyzer = Analyzer::new()?;
    analyzer.attach_app(pid)?;

    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((_, frametime)) = analyzer.recv() {
            println!("frametime: {frametime:?}");
        }
    }

    Ok(())
}

LICENSE

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

Dependencies

~0–0.9MB
~18K SLoC