diff options
author | Android Partner Docs <noreply@android.com> | 2017-06-19 21:12:35 -0700 |
---|---|---|
committer | Clay Murphy <claym@google.com> | 2017-06-20 13:09:22 -0700 |
commit | d72514453123a8634ae55406807d77f03362a2bd (patch) | |
tree | b528f70cbfa22decfea5899870efc1a42e7b7778 /en/devices/tech/debug/ftrace.html | |
parent | 8560a623b8040782583740e9dd1cbc4be310a568 (diff) | |
download | source.android.com-d72514453123a8634ae55406807d77f03362a2bd.tar.gz |
Docs: Changes to source.android.com
- 159519221 Add CTS Media 1.3 file link by claym <claym@google.com>
- 159296442 Changed devsite tag classes on a couple pages. by cqn <cqn@google.com>
- 159296357 Add devsite class to tags in devices/tech/power by cqn <cqn@google.com>
- 159296314 Added devsite class to tags in compatibility/cts. by cqn <cqn@google.com>
- 159296265 Added devsite class to tags in devices/tech/ota. by cqn <cqn@google.com>
- 159273197 Added devsite class to tags for devices/tech/test_infra/t... by cqn <cqn@google.com>
- 159269559 Add speed-profile and verify-profile to the list of options by claym <claym@google.com>
- 159268556 Add devsite class to tags in devices/tech/display by cqn <cqn@google.com>
- 159247742 Add devsite class to tags in devices/tech/admin by cqn <cqn@google.com>
- 159246177 Finished adding devsite class to tags on devices/tech/debug by cqn <cqn@google.com>
- 159245597 Add devsite tag to classes in devices/tech/debug by cqn <cqn@google.com>
- 159128910 Changed breaks to paragraph tags for formatting, and adde... by cqn <cqn@google.com>
- 159115811 Add devsite class to tags for devices/tech/config by cqn <cqn@google.com>
- 159115392 Added devsite class to tags on devices/tech/connect and d... by cqn <cqn@google.com>
- 159114997 Add devsite class to tags in devices/storage and devices/tv by cqn <cqn@google.com>
- 158948331 Provide advice to OEM and carrier app developers to reduc... by Android Partner Docs <noreply@android.com>
- 158920824 Add devsite class to tags in devices/tech/dalvik by cqn <cqn@google.com>
- 158917965 Fix links to sensors.h reference file by claym <claym@google.com>
- 158916603 Docs: moving gdb to own page, updating index by hvm <hvm@google.com>
- 158915436 Update Security acknowledgement with new researcher info by daroberts <daroberts@google.com>
- 158883841 Finish adding devsite class to tags in devices/audio by cqn <cqn@google.com>
- 158883680 Add devsite class to tags in devices/sensors and devices/... by cqn <cqn@google.com>
- 158871012 Improve Jack deprecation warning message. by gdimino <gdimino@google.com>
- 158867373 Add devsite classes to tags for devices/graphics by cqn <cqn@google.com>
- 158867298 Added devsite classes to tags in devices/input by cqn <cqn@google.com>
- 158867192 Add devsite classes to tags in devices/camera and devices... by cqn <cqn@google.com>
PiperOrigin-RevId: 159519221
Change-Id: I924de0c1668bcbcc94ee97e60c144aac4c81708d
Diffstat (limited to 'en/devices/tech/debug/ftrace.html')
-rw-r--r-- | en/devices/tech/debug/ftrace.html | 109 |
1 files changed, 84 insertions, 25 deletions
diff --git a/en/devices/tech/debug/ftrace.html b/en/devices/tech/debug/ftrace.html index e48362df..2fbaba4b 100644 --- a/en/devices/tech/debug/ftrace.html +++ b/en/devices/tech/debug/ftrace.html @@ -55,10 +55,14 @@ way to determine the correct values other than looking at the appropriate header divided into categories in <code>/d/tracing/events</code>. <p>To enable events on a per-category basis, use: -<pre>$ echo 1 > /d/tracing/events/irq/enable</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 1 > /d/tracing/events/irq/enable +</pre> <p>To enable events on per-event basis, use: -<pre>$ echo 1 > /d/tracing/events/sched/sched_wakeup/enable</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 1 > /d/tracing/events/sched/sched_wakeup/enable +</pre> <p>If extra events have been enabled by writing to sysfs nodes, they will <strong>not</strong> be reset by atrace. A common pattern @@ -66,9 +70,11 @@ for Qualcomm device bringup is to enable <code>kgsl</code> (GPU) and <code>mdss</code> (display pipeline) tracepoints and then use atrace or <a href="/devices/tech/debug/systrace.html">systrace</a>:</p> -<pre>$ adb shell "echo 1 > /d/tracing/events/mdss/enable" -$ adb shell "echo 1 > /d/tracing/events/kgsl/enable" -$ ./systrace.py sched freq idle am wm gfx view binder_driver irq workq ss sync -t 10 -b 96000 -o full_trace.html</pre> +<pre class="devsite-click-to-copy"> +<code class="devsite-terminal">adb shell "echo 1 > /d/tracing/events/mdss/enable"</code> +<code class="devsite-terminal">adb shell "echo 1 > /d/tracing/events/kgsl/enable"</code> +<code class="devsite-terminal">./systrace.py sched freq idle am wm gfx view binder_driver irq workq ss sync -t 10 -b 96000 -o full_trace.html</code> +</pre> <p>You can also use ftrace without atrace or systrace, which is useful when you want kernel-only traces (or if you've taken the time to write @@ -76,13 +82,25 @@ the user-mode tracing property by hand). To run just ftrace:</p> <ol> <li>Set the buffer size to a value large enough for your trace: -<pre>$ echo 96000 > /d/tracing/buffer_size_kb</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 96000 > /d/tracing/buffer_size_kb +</pre> +</li> <li>Enable tracing: -<pre>$ echo 1 > /d/tracing/tracing_on</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 1 > /d/tracing/tracing_on +</pre> +</li> <li>Run your test, then disable tracing: -<pre>$ echo 0 > /d/tracing/tracing_on</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 0 > /d/tracing/tracing_on +</pre> +</li> <li>Dump the trace: -<pre>$ cat /d/tracing/trace > /data/local/tmp/trace_output</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +cat /d/tracing/trace > /data/local/tmp/trace_output +</pre> +</li> </ol> <p>The trace_output gives the trace in text form. To visualize it using @@ -90,7 +108,9 @@ Catapult, get the <a href="https://github.com/catapult-project/catapult/tree/master/">Catapult repository</a> from Github and run trace2html:</p> -<pre>$ catapult/tracing/bin/trace2html ~/path/to/trace_file</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +catapult/tracing/bin/trace2html ~/path/to/trace_file +</pre> <p>By default, this writes <code>trace_file.html</code> in the same directory.</p> @@ -120,7 +140,9 @@ tree</a> (<code>tracing/bin/html2trace</code>) to uncompress the trace.</li> <li>Find a line at the beginning of the trace containing <code>tracing_mark_sync</code>. It should look something like this: -<pre><5134>-5134 (-----) [003] ...1 68.104349: tracing_mark_write: trace_event_clock_sync: parent_ts=68.104286</pre> +<pre class="devsite-click-to-copy"> +<5134>-5134 (-----) [003] ...1 68.104349: tracing_mark_write: trace_event_clock_sync: parent_ts=68.104286 +</pre> <br>If this line does not exist (or if you used ftrace without atrace), then timings will be relative from the first event in the ftrace log. @@ -154,11 +176,16 @@ CONFIG_IRQSOFF_TRACER=y, CONFIG_FUNCTION_PROFILER=y, and CONFIG_PREEMPT_TRACER=y </li> <li>Rebuild and boot the new kernel.</li> <li>Run the following to check for available tracers: -<pre>$ cat /d/tracing/available_tracers</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +cat /d/tracing/available_tracers +</pre> +</li> <li>Confirm the command returns <code>function</code>, <code>irqsoff</code>, <code>preemptoff</code>, and <code>preemptirqsoff</code>.</li> <li>Run the following to ensure dynamic ftrace is working: -<pre>$ cat /d/tracing/available_filter_functions | grep <a function you care about></pre> +<pre class="devsite-terminal devsite-click-to-copy"> +cat /d/tracing/available_filter_functions | grep <a function you care about> +</pre> </li> </ol> @@ -195,22 +222,43 @@ so it's time to use the function profiler:</p> <ol> <li>As functions are sometimes renamed by the compiler, confirm <code>ion_client_destroy</code> is there by using: -<pre>$ cat /d/tracing/available_filter_functions | grep ion_client_destroy</pre> +<pre class="devsite-terminal devsite-click-to-copy"> +cat /d/tracing/available_filter_functions | grep ion_client_destroy +</pre> </li> <li>After confirming it is there, use it as the ftrace filter: -<pre>$ echo ion_client_destroy > /d/tracing/set_ftrace_filter</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo ion_client_destroy > /d/tracing/set_ftrace_filter +</pre> +</li> <li>Turn on the function profiler: -<pre>$ echo function > /d/tracing/current_tracer</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo function > /d/tracing/current_tracer +</pre> +</li> <li>Turn on stack traces whenever a filter function is called: -<pre>$ echo func_stack_trace > /d/tracing/trace_options</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo func_stack_trace > /d/tracing/trace_options +</pre> +</li> <li>Increase the buffer size: -<pre>$ echo 64000 > /d/tracing/buffer_size_kb</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 64000 > /d/tracing/buffer_size_kb +</pre> +</li> <li>Turn on tracing: -<pre>$ echo 1 > /d/tracing/trace_on</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 1 > /d/tracing/trace_on +</pre> +</li> <li>Run the test and get the trace: -<pre>$ cat /d/tracing/trace > /data/local/tmp/trace</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +cat /d/tracing/trace > /data/local/tmp/trace +</pre> +</li> <li>View the trace to see lots and lots of stack traces: -<pre> cameraserver-643 [003] ...1 94.192991: ion_client_destroy <-ion_release +<pre class="devsite-click-to-copy"> + cameraserver-643 [003] ...1 94.192991: ion_client_destroy <-ion_release cameraserver-643 [003] ...1 94.192997: <stack trace> => ftrace_ops_no_ops => ftrace_graph_call @@ -220,7 +268,9 @@ so it's time to use the function profiler:</p> => ____fput => task_work_run => do_notify_resume - => work_pending</pre></li> + => work_pending + </pre> +</li> </ol> <p>Based on inspection of the ion driver, we can see that @@ -286,12 +336,21 @@ the lock trace when ftrace was not running.</p> ftrace:</p> <ol> <li>Enable tracing: -<pre>$ echo 1 > /proc/sys/kernel/lock_stat</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 1 > /proc/sys/kernel/lock_stat +</pre> +</li> <li>Run your test.</li> <li>Disable tracing: -<pre>$ echo 0 > /proc/sys/kernel/lock_stat</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +echo 0 > /proc/sys/kernel/lock_stat +</pre> +</li> <li>Dump your trace: -<pre>$ cat /proc/lock_stat > /data/local/tmp/lock_stat</pre></li> +<pre class="devsite-terminal devsite-click-to-copy"> +cat /proc/lock_stat > /data/local/tmp/lock_stat +</pre> +</li> </ol> <p>For help interpreting the resulting output, refer to lockstat documentation |