Android 4.1 (Jelly Bean) new tools

by groleo

In 4.1 arm emulator image there are a couple of new tools: schedtop, atrace, latencytop,

/system/bin/schedtop output looks something like:

   TID    -------- SINCE LAST --------       ------------- TOTAL -------------
  PID     EXEC_TIME   DELAY_TIME SCHED       EXEC_TIME      DELAY_TIME   SCHED NAME
    1   0.000000000  0.000000000     0     3.029379557     0.408314327     216 /init
    2   0.000000000  0.000000000     0     0.005235383     0.012034906      51 kthreadd
    3   0.001637475  0.005042099     3     0.014593854     0.104118138      61 ksoftirqd/0
    4   0.001257789  0.000313636     2     0.336109346     0.411691037    1564 events/0
    5   0.000000000  0.000000000     0     0.000000000     0.030000001       2 khelper
    6   0.000000000  0.000000000     0     0.000000000     0.020000001       2 suspend
    7   0.000000000  0.000000000     0     0.000000000     0.010000000       2 kblockd/0

and it doesn’t look like this schedtop

Latencytop raises an error when run, but I figure it has something to do with some un-mounted filesystem.
I’ll have to see if it’s the same latencytop we all know

# latencytop
latencytop
Could not open /proc/sys/kernel/latencytop: No such file or directory
Could not open /proc/sys/kernel/latencytop: No such file or directory

atrace also spits errors of missing debugfs:

# atrace
atrace
error opening /sys/kernel/debug/tracing/options/overwrite: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/sched/sched_switch/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/sched/sched_wakeup/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/power/cpu_frequency/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/events/power/cpu_idle/enable: No such file or directory (2)
error opening /sys/kernel/debug/tracing/buffer_size_kb: No such file or directory (2)
error opening /sys/kernel/debug/tracing/trace_clock: No such file or directory (2)

Now, in the SDK 2.0 directory, you can find systrace, a python script that does, I quote:

"""Android system-wide tracing utility.

This is a tool for capturing a trace that includes data from both userland and
the kernel.  It creates an HTML file for visualizing the trace.

It uses the atrace from the target to collect information about the disk, CPU, workqueue
and it nicely tag them:

  'gfx':      1<<1,
  'input':    1<<2,
  'view':     1<<3,
  'webview':  1<<4,
  'wm':       1<<5,
  'am':       1<<6,
  'sync':     1<<7,
  'audio':    1<<8,
  'video':    1<<9,
  'camera':   1<<10,

One thing that caught my eye in the systrace.py, is this line:
# This list is based on the tags in frameworks/native/include/utils/Trace.h
I wonder what other goodies lies in that frameworks/native/utils directory ?

Advertisements