0

I'm trying to generate FTrace files inside an Android environment, using:

root@adroid:# echo 1 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable
root@adroid:# echo 1 > /sys/kernel/debug/tracing/tracing_on
root@adroid:# cat /sys/kernel/debug/tracing/trace > mytracefile.txt
root@adroid:# echo 0 > /sys/kernel/debug/tracing/tracing_on
root@adroid:# echo 0 > /sys/kernel/debug/tracing/events/sched/sched_switch/enable

The problem is that in mytracefile.txt the precision of time stamp is in milliseconds:

          <idle>-0     [000] d.h7 14186.690000: sched_wakeup: comm=tfm_b6bcf800 pid=1714 prio=35 success=1 target_cpu=000
          <idle>-0     [000] d..3 14186.690000: sched_switch: prev_comm=swapper/0 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=tfm_b6bcf800 next_pid=1714 next_prio=35
    tfm_b6bcf800-1714  [000] d..3 14186.690000: sched_switch: prev_comm=tfm_b6bcf800 prev_pid=1714 prev_prio=35 prev_state=D|W ==> next_comm=swapper/0 next_pid=0 next_prio=120
          <idle>-0     [001] d.h3 14186.690000: sched_wakeup: comm=Player Aud Mixe pid=146 prio=35 success=1 target_cpu=001
          <idle>-0     [001] d..3 14186.690000: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Player Aud Mixe next_pid=146 next_prio=35
 Player Aud Mixe-146   [001] d..3 14186.690000: sched_switch: prev_comm=Player Aud Mixe prev_pid=146 prev_prio=35 prev_state=D ==> next_comm=swapper/1 next_pid=0 next_prio=120
          <idle>-0     [001] d.h3 14186.690000: sched_wakeup: comm=Player Aud Mixe pid=146 prio=35 success=1 target_cpu=001
          <idle>-0     [001] d..3 14186.690000: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Player Aud Mixe next_pid=146 next_prio=35
 Player Aud Mixe-146   [001] d..3 14186.690000: sched_switch: prev_comm=Player Aud Mixe prev_pid=146 prev_prio=35 prev_state=S ==> next_comm=swapper/1 next_pid=0 next_prio=120
          <idle>-0     [001] d.h3 14186.700000: sched_wakeup: comm=Player Aud Mixe pid=146 prio=35 success=1 target_cpu=001
          <idle>-0     [001] d..3 14186.700000: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=Player Aud Mixe next_pid=146 next_prio=35

Normally, it should be in the order of microseconds, like 14186.691234 instead of just 14186.690000.

I have already tested all the other trace_clock options that I have (local, global and counter) but the results are always the same. Changing that parameter doesn't change anything in the output file.

I followed carefully FTrace documentation but I don't know what else to change in configuration.

Searching over the internet I had only been able to find this bug report but it was not solved: http://lists.linaro.org/pipermail/linaro-dev/2011-February/002720.html

Any advises?

Are there additional modules in the kernel that I have to install ?

Update:

  • Android Version: 4.2.2
  • Kernel Linux Version: 3.4.7

dmesg output is also showing milliseconds precision:

<4>[   38.130000] oom_adj 0 => oom_score_adj 0
<4>[   38.130000] oom_adj 1 => oom_score_adj 58
<4>[   38.140000] oom_adj 2 => oom_score_adj 117
<4>[   38.140000] oom_adj 4 => oom_score_adj 235
<4>[   38.150000] oom_adj 9 => oom_score_adj 529
<4>[   38.150000] oom_adj 15 => oom_score_adj 1000

Thank you,

Rodmar Conde
  • 956
  • 1
  • 12
  • 24
  • You need to look at the kernel version that you are using on your android device. Probably checking that kernel source would be helpful. – rakib_ Jun 05 '13 at 16:56
  • @rakib Thank you, I added the kernel version and did some updates to the question. – Rodmar Conde Jun 06 '13 at 08:32
  • Well, what I was saying is look for the Android kernel you're using. You need to look at that Android kernel's ftrace feature, whether was there any modification in ftrace code or so. Generally Android kernel contains some modification from stable Linux kernel. – rakib_ Jun 06 '13 at 08:37

2 Answers2

0

I don't think that there is a nanosecond accurate timer in Android. Milliseconds is the best you can get.

CaseyB
  • 24,780
  • 14
  • 77
  • 112
  • Sorry, I made an update to the question. I'm interested in **microseconds**, I'm sure that we can get that precision because it is explicitly shown in FTrace documentation. Thanks. – Rodmar Conde Jun 06 '13 at 08:28
0

Almost all hardware have the ability to generate millisecond-accurate times, but the accuracy of timers is hardware dependent. Many system these days offer timers with microsecond or better resolution. These can usually be configured to provide the precision you want.