2

I've been trying to get ftrace to work on Android, but to no avail. I am using ICS with kernel 3.08. Here are the steps I followed:

  • Used menuconfig and enabled all the options under KernelHacking->Tracers. The final .config which was generated had all the ftrace options enabled.
  • Created new system and boot images with the generated zImage.
  • If I try doing mount -t debugfs nodev /sys/kernel/debug I get a message saying 'mount: Device or resource busy'. I guess it is already mounted. I tried unmounting and remounting it but that didn't do anything for me.
  • Now in adb shell I can already see /sys/kernel/debug created. But if I look into available_tracers all I can see are blk and nop.
  • Now if I run the output the trace file this is what I get:

tracer: nop

       TASK-PID    CPU#    TIMESTAMP  FUNCTION
          | |       |          |         |
 rb_producer-15    [000]   606.337706: ring_buffer_producer_thread: Starting  ring buffer hammer
 rb_producer-15    [000]   616.264577: ring_buffer_producer_thread: End ring buffer hammer
 rb_producer-15    [000]   616.264606: ring_buffer_producer_thread: RunningConsumer at nice: 19
 rb_producer-15    [000]   616.264609: ring_buffer_producer_thread: RunningProducer at nice: 19
 rb_producer-15    [000]   616.264612: ring_buffer_producer_thread: WARNING!!! This test is running at lowest priority.
 rb_producer-15    [000]   616.264614: ring_buffer_producer_thread: Time:  9932418 (usecs)
 rb_producer-15    [000]   616.264616: ring_buffer_producer_thread: Overruns: 0
 rb_producer-15    [000]   616.264619: ring_buffer_producer_thread: Read:  10514159  (by pages)
 rb_producer-15    [000]   616.264621: ring_buffer_producer_thread: Entries:  3491
 rb_producer-15    [000]   616.264623: ring_buffer_producer_thread: Total:  10517650
 rb_producer-15    [000]   616.264625: ring_buffer_producer_thread: Missed:  0
 rb_producer-15    [000]   616.264626: ring_buffer_producer_thread: Hit:  10517650
 rb_producer-15    [000]   616.264629: ring_buffer_producer_thread: Entriesper millisec: 1058
 rb_producer-15    [000]   616.264630: ring_buffer_producer_thread: 945 ns per entry
 rb_producer-15    [000]   616.264633: ring_buffer_producer_thread: Sleeping for 10 secs
 rb_producer-15    [000]   626.261167: ring_buffer_producer_thread: Starting ring buffer hammer

How do I enable the other tracing options, like function?

It cannot be this difficult, especially when I read about people having used ftrace on Android. There must be something I am missing here.

Any help/suggestions will be highly appreciated.

Thanks!

-Kanav

Kano
  • 388
  • 5
  • 11

2 Answers2

2

Do not enable RING_BUFFER_BENCHMARK. That's a debug option used to test the ring buffer. Your output shows that it's enabled and is wasting a lot of your CPU.

rostedt
  • 21
  • 2
0

Ahh got it. Had forgotten to do a herring_defconfig. Also enabled only the function tracer instead of all of them. Works now.

Kano
  • 388
  • 5
  • 11
  • Hi, Is the kernel available for compiling for android, in order to use ftrace, or is it depends on manufacture available sources ? – ransh Nov 26 '16 at 10:54