Coder Social home page Coder Social logo

systraceanalysis's Introduction

Systrace-Analysis

This is a copy of ftrace ,Since the author of this project is not maintaining, I make a copy for my own use

How to use

  1. install python2
  2. python setup.py build
  3. python setup.py install
  4. python xxxxxxx.py (write by yourself)

Once you change the code of this project, you need to rebuild && reinstall

The following is the project description of the original project

Ftrace

Ftrace is a Python library for parsing and analyzing performance/power of Linux-based platform (e.g.Android). It relies on Function Tracer (Ftrace) - an internal tracing framework introduced in Linux kernel (>= 2.6.27). For complete documentation, see here.

Android devices are shipped with atrace binary that utilizes Ftrace and supports enabling and profiling of useful android events. In addition, Systrace tool

  • Python/HTML-based wrapper - was developed by Google for profiling and visualizing via chrome://tracing/ on Chrome browser.

Prerequisites

Ftrace

Ftrace must be configured/enabled in the kernel. This requires CONFIG_FTRACE and other Ftrace options.

debugfs

Requires a kernel with CONFIG_DEBUG_FS option enabled (debugfs was added in 2.6.10-rc3). The debugfs needs to be mounted:

# mount -t debugfs nodev /sys/kernel/debug

Most non-rooted (production) devices ship with some support for Ftrace and restrictions on what can be traced.

Quick Start

Ftrace parsing library provides API for in-depth analysis of both performance/power related issues. A version of this tool was used at Qualcomm (by previous employer) for development of big.LITTLE scheduler, UX analysis (application launch time), HMP usage and much more. To get started, lets load a trace file.

Loading a trace file.

trace = Ftrace(r'/some/path/to/trace.html')
# how long is this trace (in seconds)
print trace.interval
print trace.duration

CPU API examples

# Task intervals
print trace.cpu.task_intervals(cpu=0) # you can filter to specific task with task argument

# Idle/busy times for CPU0
print trace.cpu.idle_intervals(cpu=0)
print trace.cpu.idle_time(cpu=0)
print trace.cpu.busy_intervals(cpu=0)
print trace.cpu.busy_time(cpu=0)

# Run-Queue information for CPU0
print trace.cpu.runqueue_depth_time(cpu=0, rq_depth=3) # time we has 3 things runnable in queue
print trace.cpu.runqueue_interval(cpu=0)

# Low Power Modes (LPM) for CPU0
print trace.cpu.lpm_time(cpu=0)
print trace.cpu.lpm_intervals(cpu=0)

# Simultaneously busy cores
print trace.cpu.simultaneously_busy_time(num_cores=2) # time when 2 cores were busy
print trace.cpu.simultaneously_busy_intervals(num_cores=2, cpus=[0,1,2,3]) # when 2 or more cpus in list were busy

# Frequency intervals
print trace.cpu.frequency_intervals(cpu=0)

Android API examples

# Android events intervals. There are 3 types (sync context, async context and counters)
print trace.android.event_intervals(name='postFramebuffer') # postFramebuffer events only.
# Dump events seen
print trace.android.names

# Get launch-time for an app (assuming an app was launched during trace)
print trace.android.app_launch_latency()

Clk API examples

# Dump clks seen
print trace.clk.names
# Clock intervals
print trace.clk.frequency_intervals(clk='oxili_gfx3d_clk') # for Adreno GPU on Qualcomm Snapdragon

systraceanalysis's People

Contributors

gracker 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.