Coder Social home page Coder Social logo

nasdaqgodzilla / cpuprobe Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 4 KB

An example of getting started with Android ebpf

Home Page: https://nasdaqgodzilla.github.io/2023/08/23/Android-bpf%E7%AE%80%E5%8D%95%E4%B8%8A%E6%89%8B%E6%95%99%E7%A8%8B/

C 44.28% C++ 55.72%
android bpf ebpf

cpuprobe's Introduction

cpuprobe

An example of getting started with Android ebpf. Using ebpf, on Android, print out the switching status of the process on the CPU.

一个Android ebpf的入门示例,利用ebpf,在Android上,打印出进程在CPU上的切换情况。

参考链接

Usage

Build -> Install -> Reboot -> Run

Build via AOSP

After lunch project:

m cpu_stats.o
m cpu_stats_client

Install

With adb rooted Android device:

adb push cpu_stats.o /system/etc/bpf
adb push cpu_stats_client /system/bin/

Reboot is needed.

Run

In adb, run command:

cpu_stats_client

Output format

When the process is switched, print out the information of the process switched to the CPU core.

当进程切换时,打印出切换到该CPU核心上的进程的信息。

timestamp    uid    pid    tgid    command    running_cpu_core_id

Example output:

844266752127     0        245      245      swapper/2                        2
844466688281     0        245      245      swapper/2                        2
844263030050     0        0        0        surfaceflinger                   5
844150573742     1000     1847     472      kworker/u16:2                    2
844430232281     0        235      235      swapper/1                        1
844288505434     0        1030     1030     swapper/3                        3
844235142742     0        0        0        mali-cmar-backe                  2
844453380357     0        0        0        kworker/u16:7                    1
844542420127     0        245      245      swapper/3                        3
844150695434     0        0        0        mali-cmar-backe                  2
844299940204     1000     2523     2198     swapper/3                        3
844381336434     0        0        0        mali-cmar-backe                  2
844504524819     0        0        0        kworker/u16:23                   0
844524850050     0        0        0        kworker/u16:23                   1
844483787127     1000     530      448      shell svc 4405                   0
844357043665     0        0        0        kworker/u16:7                    3
844350059588     0        0        0        shell svc 4405                   0
844297244204     0        0        0        kworker/u17:0                    2
844301078357     0        0        0        shell svc 4405                   1
844300169050     1000     2830     2198     kworker/u16:2                    5

cpuprobe's People

Contributors

nasdaqgodzilla avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.