blob: 666c2527c674c4c729d877519d41fc7e032eb715 [file] [log] [blame]
<!--
Documentation/_templates/layout.html
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership. The
ASF licenses this file to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
-->
<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
<meta charset="utf-8" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Task Trace User Guide &mdash; NuttX latest documentation</title>
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="../_static/css/theme.css" type="text/css" />
<link rel="stylesheet" href="../_static/copybutton.css" type="text/css" />
<link rel="stylesheet" href="../_static/tabs.css" type="text/css" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
<link rel="shortcut icon" href="../_static/favicon.ico"/>
<!--[if lt IE 9]>
<script src="../_static/js/html5shiv.min.js"></script>
<![endif]-->
<script src="../_static/jquery.js"></script>
<script src="../_static/_sphinx_javascript_frameworks_compat.js"></script>
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
<script src="../_static/doctools.js"></script>
<script src="../_static/sphinx_highlight.js"></script>
<script src="../_static/clipboard.min.js"></script>
<script src="../_static/copybutton.js"></script>
<script src="../_static/js/theme.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Task Trace Internals" href="tasktraceinternal.html" />
<link rel="prev" title="Task Trace" href="tasktrace.html" />
</head>
<body class="wy-body-for-nav">
<div class="wy-grid-for-nav">
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
<div class="wy-side-scroll">
<div class="wy-side-nav-search" >
<a href="../index.html" class="icon icon-home"> NuttX
</a>
<!-- this version selector is quite ugly, should be probably replaced by something
more modern -->
<div class="version-selector">
<select onchange="javascript:location.href = this.value;">
<option value="../../latest" selected="selected">latest</option>
<option value="../../10.0.0" >10.0.0</option>
<option value="../../10.0.1" >10.0.1</option>
<option value="../../10.1.0" >10.1.0</option>
<option value="../../10.2.0" >10.2.0</option>
<option value="../../10.3.0" >10.3.0</option>
<option value="../../11.0.0" >11.0.0</option>
<option value="../../12.0.0" >12.0.0</option>
<option value="../../12.1.0" >12.1.0</option>
<option value="../../12.2.0" >12.2.0</option>
<option value="../../12.2.1" >12.2.1</option>
<option value="../../12.3.0" >12.3.0</option>
<option value="../../12.4.0" >12.4.0</option>
<option value="../../12.5.0" >12.5.0</option>
<option value="../../12.5.1" >12.5.1</option>
</select>
</div>
<div role="search">
<form id="rtd-search-form" class="wy-form" action="../search.html" method="get">
<input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu">
<p class="caption" role="heading"><span class="caption-text">Table of Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../index.html">Home</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/index.html">Introduction</a></li>
<li class="toctree-l1"><a class="reference internal" href="../quickstart/index.html">Getting Started</a></li>
<li class="toctree-l1"><a class="reference internal" href="../contributing/index.html">Contributing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../introduction/inviolables.html">The Inviolable Principles of NuttX</a></li>
<li class="toctree-l1"><a class="reference internal" href="../platforms/index.html">Supported Platforms</a></li>
<li class="toctree-l1"><a class="reference internal" href="../components/index.html">OS Components</a></li>
<li class="toctree-l1"><a class="reference internal" href="../applications/index.html">Applications</a></li>
<li class="toctree-l1"><a class="reference internal" href="../implementation/index.html">Implementation Details</a></li>
<li class="toctree-l1"><a class="reference internal" href="../reference/index.html">API Reference</a></li>
<li class="toctree-l1"><a class="reference internal" href="../faq/index.html">FAQ</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="index.html">Guides</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="nfs.html">NFS Client How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="usbtrace.html">USB Device Trace</a></li>
<li class="toctree-l2"><a class="reference internal" href="simulator.html">Simulator</a></li>
<li class="toctree-l2"><a class="reference internal" href="qemugdb.html">How to debug NuttX using QEMU and GDB</a></li>
<li class="toctree-l2"><a class="reference internal" href="rndis.html">How to use RNDIS</a></li>
<li class="toctree-l2"><a class="reference internal" href="drivers.html">Drivers</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="tasktrace.html">Task Trace</a><ul class="current">
<li class="toctree-l3 current"><a class="current reference internal" href="#">Task Trace User Guide</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#installation">Installation</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#install-trace-compass">Install Trace Compass</a></li>
<li class="toctree-l5"><a class="reference internal" href="#nuttx-kernel-configuration">NuttX kernel configuration</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="#how-to-get-trace-data">How to get trace data</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#quick-guide">Quick Guide</a></li>
</ul>
</li>
<li class="toctree-l4"><a class="reference internal" href="#trace-command-description">Trace command description</a><ul>
<li class="toctree-l5"><a class="reference internal" href="#trace-start">trace start</a></li>
<li class="toctree-l5"><a class="reference internal" href="#trace-stop">trace stop</a></li>
<li class="toctree-l5"><a class="reference internal" href="#trace-cmd">trace cmd</a></li>
<li class="toctree-l5"><a class="reference internal" href="#trace-dump">trace dump</a></li>
<li class="toctree-l5"><a class="reference internal" href="#trace-mode">trace mode</a></li>
<li class="toctree-l5"><a class="reference internal" href="#trace-syscall">trace syscall</a></li>
<li class="toctree-l5"><a class="reference internal" href="#trace-irq">trace irq</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="tasktraceinternal.html">Task Trace Internals</a></li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="cpp_cmake.html">C++ Example using CMake</a></li>
<li class="toctree-l2"><a class="reference internal" href="pysimcoder.html">pysimCoder integration with NuttX</a></li>
<li class="toctree-l2"><a class="reference internal" href="customboards.html">Custom Boards How-To</a></li>
<li class="toctree-l2"><a class="reference internal" href="customapps.html">Custom Apps How-to</a></li>
<li class="toctree-l2"><a class="reference internal" href="citests.html">Running CI Test Locally</a></li>
<li class="toctree-l2"><a class="reference internal" href="zerolatencyinterrupts.html">High Performance, Zero Latency Interrupts</a></li>
<li class="toctree-l2"><a class="reference internal" href="nestedinterrupts.html">Nested Interrupts</a></li>
<li class="toctree-l2"><a class="reference internal" href="cortexmhardfaults.html">Analyzing Cortex-M Hardfaults</a></li>
<li class="toctree-l2"><a class="reference internal" href="coredump.html">Core Dump</a></li>
<li class="toctree-l2"><a class="reference internal" href="minidumpserver.html">minidumpserver</a></li>
<li class="toctree-l2"><a class="reference internal" href="gdbwithpython.html">GDB with Python</a></li>
<li class="toctree-l2"><a class="reference internal" href="ofloader.html">Open Flash Loader</a></li>
<li class="toctree-l2"><a class="reference internal" href="testingtcpip.html">Testing TCP/IP Network Stacks</a></li>
<li class="toctree-l2"><a class="reference internal" href="automounter.html">Auto-Mounter</a></li>
<li class="toctree-l2"><a class="reference internal" href="stm32nullpointer.html">STM32 Null Pointer Detection</a></li>
<li class="toctree-l2"><a class="reference internal" href="stm32ccm.html">STM32 CCM Allocator</a></li>
<li class="toctree-l2"><a class="reference internal" href="stackrecord.html">Run time stack statistics</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../glossary.html">Glossary</a></li>
</ul>
</div>
</div>
</nav>
<section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" >
<i data-toggle="wy-nav-top" class="fa fa-bars"></i>
<a href="../index.html">NuttX</a>
</nav>
<div class="wy-nav-content">
<div class="rst-content">
<div role="navigation" aria-label="Page navigation">
<ul class="wy-breadcrumbs">
<li><a href="../index.html" class="icon icon-home" aria-label="Home"></a></li>
<li class="breadcrumb-item"><a href="index.html">Guides</a></li>
<li class="breadcrumb-item"><a href="tasktrace.html">Task Trace</a></li>
<li class="breadcrumb-item active">Task Trace User Guide</li>
<li class="wy-breadcrumbs-aside">
<a href="../_sources/guides/tasktraceuser.rst.txt" rel="nofollow"> View page source</a>
</li>
</ul>
<hr/>
</div>
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
<div itemprop="articleBody">
<section id="task-trace-user-guide">
<h1>Task Trace User Guide<a class="headerlink" href="#task-trace-user-guide" title="Permalink to this heading"></a></h1>
<section id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this heading"></a></h2>
<section id="install-trace-compass">
<h3>Install Trace Compass<a class="headerlink" href="#install-trace-compass" title="Permalink to this heading"></a></h3>
<p>Task Trace uses the external tool <a class="reference external" href="https://www.eclipse.org/tracecompass/">“Trace Compass”</a> to display the trace result.</p>
<p>Download it from <a class="reference external" href="https://www.eclipse.org/tracecompass/">https://www.eclipse.org/tracecompass/</a> and install into the host environment.
After the installation, execute it and choose <code class="docutils literal notranslate"><span class="pre">Tools</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">add-ons</span></code> menu, then select <code class="docutils literal notranslate"><span class="pre">Install</span> <span class="pre">Extensions</span></code> to install the extension named “Trace Compass ftrace (Incubation)”.</p>
</section>
<section id="nuttx-kernel-configuration">
<h3>NuttX kernel configuration<a class="headerlink" href="#nuttx-kernel-configuration" title="Permalink to this heading"></a></h3>
<p>To enable the task trace function, the NuttX kernel configuration needs to be modified.</p>
<p>The following configurations must be enabled.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_INSTRUMENTATION</span></code> : Enables the feature of scheduler notes.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_INSTRUMENTATION_FILTER</span></code> : Enables the filter logic of the notes.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_INSTRUMENTATION_SYSCALL</span></code> : Enable system call instrumentation.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_INSTRUMENTATION_IRQHANDLER</span></code> : Enables IRQ instrumentation.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_DRIVERS_NOTE</span></code> : Enables note driver support.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_DRIVERS_NOTERAM</span></code> : Enables <code class="docutils literal notranslate"><span class="pre">/dev/note</span></code> in-memory buffering driver.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_DRIVERS_NOTECTL</span></code> : Enables <code class="docutils literal notranslate"><span class="pre">/dev/notectl</span></code> filter control driver.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SYSTEM_TRACE</span></code> : Enables “<code class="docutils literal notranslate"><span class="pre">trace</span></code>” command</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SYSTEM_SYSTEM</span></code> : Enables “<code class="docutils literal notranslate"><span class="pre">system</span></code>” command (required by <a class="reference internal" href="#trace-cmd"><span class="std std-ref">trace cmd</span></a>)</p></li>
</ul>
<p>The following configurations are configurable parameters for trace.</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE</span></code></p>
<ul>
<li><p>Specify the default filter mode.
If the following bits are set, the corresponding instrumentations are enabled on boot.</p>
<ul>
<li><p>Bit 0 = Enable instrumentation</p></li>
<li><p>Bit 1 = Enable syscall instrumentation</p></li>
<li><p>Bit 2 = Enable IRQ instrumentation</p></li>
<li><p>Bit 3 = Enable collecting syscall arguments</p></li>
</ul>
</li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_DRIVERS_NOTE_TASKNAME_BUFSIZE</span></code></p>
<ul>
<li><p>Specify the task name buffer size in bytes.
The buffer is used to hold the name of the task during instrumentation.
Trace dump can find and show a task name corresponding to given pid in the instrumentation data by using this buffer.
If 0 is specified, this feature is disabled and trace dump shows only the name of the newly created task.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_DRIVERS_NOTERAM_BUFSIZE</span></code></p>
<ul>
<li><p>Specify the note buffer size in bytes.
Higher value can hold more note records, but consumes more kernel memory.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_DRIVERS_NOTERAM_DEFAULT_NOOVERWRITE</span></code></p>
<ul>
<li><p>If enabled, stop overwriting old notes in the circular buffer when the buffer is full by default.
This is useful to keep instrumentation data of the beginning of a system boot.</p></li>
</ul>
</li>
<li><p><code class="docutils literal notranslate"><span class="pre">CONFIG_DRIVERS_NOTERAM_CRASH_DUMP</span></code></p>
<ul>
<li><p>If enabled, it will dump the data in the noteram buffer after a system crash.
This function can help to view the behavior of the system before the crash</p></li>
</ul>
</li>
</ul>
<p>After the configuration, rebuild the NuttX kernel and application.</p>
<p>If the trace function is enabled, “<code class="docutils literal notranslate"><span class="pre">trace</span></code><a class="reference internal" href="../applications/nsh/builtin.html"><span class="doc">NSH “Built-In” Applications</span></a> will be available.</p>
</section>
</section>
<section id="how-to-get-trace-data">
<h2>How to get trace data<a class="headerlink" href="#how-to-get-trace-data" title="Permalink to this heading"></a></h2>
<p>The trace function can be controlled by “<code class="docutils literal notranslate"><span class="pre">trace</span></code>” command.</p>
<section id="quick-guide">
<h3>Quick Guide<a class="headerlink" href="#quick-guide" title="Permalink to this heading"></a></h3>
<section id="getting-the-trace">
<h4>Getting the trace<a class="headerlink" href="#getting-the-trace" title="Permalink to this heading"></a></h4>
<p>Trace is started by the following command.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; trace start
</pre></div>
</div>
<p>Trace is stopped by the following command.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; trace stop
</pre></div>
</div>
<p>If you want to get the trace while executing some command, the following command can be used.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; trace cmd &lt;command&gt; [&lt;args&gt;...]
</pre></div>
</div>
</section>
<section id="displaying-the-trace-result">
<h4>Displaying the trace result<a class="headerlink" href="#displaying-the-trace-result" title="Permalink to this heading"></a></h4>
<p>The trace result is accumulated in the memory.
After getting the trace, the following command displays the accumulated trace data to the console.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; trace dump
</pre></div>
</div>
<p>This will get the trace results like the following:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>&lt;noname&gt;-1 [0] 7.640000000: sys_close()
&lt;noname&gt;-1 [0] 7.640000000: sys_close -&gt; 0
&lt;noname&gt;-1 [0] 7.640000000: sys_sched_lock()
&lt;noname&gt;-1 [0] 7.640000000: sys_sched_lock -&gt; 0
&lt;noname&gt;-1 [0] 7.640000000: sys_nxsched_get_stackinfo()
&lt;noname&gt;-1 [0] 7.640000000: sys_nxsched_get_stackinfo -&gt; 0
&lt;noname&gt;-1 [0] 7.640000000: sys_sched_unlock()
&lt;noname&gt;-1 [0] 7.640000000: sys_sched_unlock -&gt; 0
&lt;noname&gt;-1 [0] 7.640000000: sys_clock_nanosleep()
&lt;noname&gt;-1 [0] 7.640000000: sched_switch: prev_comm=&lt;noname&gt; prev_pid=1 prev_state=S ==&gt; next_comm=&lt;noname&gt; next_pid=0
&lt;noname&gt;-0 [0] 7.640000000: irq_handler_entry: irq=11
&lt;noname&gt;-0 [0] 7.640000000: irq_handler_exit: irq=11
&lt;noname&gt;-0 [0] 7.640000000: irq_handler_entry: irq=15
&lt;noname&gt;-0 [0] 7.650000000: irq_handler_exit: irq=15
&lt;noname&gt;-0 [0] 7.650000000: irq_handler_entry: irq=15
:
</pre></div>
</div>
<p>By using the logging function of your terminal software, the trace result can be saved into the host environment and it can be used as the input for <a class="reference external" href="https://www.eclipse.org/tracecompass/">“Trace Compass”</a>.</p>
<p>If the target has a storage, the trace result can be stored into the file by using the following command.
It also can be used as the input for “Trace Compass” by transferring the file in the target device to the host.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; trace dump &lt;file name&gt;
</pre></div>
</div>
<p>To display the trace result by <a class="reference external" href="https://www.eclipse.org/tracecompass/">“Trace Compass”</a>, choose <code class="docutils literal notranslate"><span class="pre">File</span></code> -&gt; <code class="docutils literal notranslate"><span class="pre">Open</span> <span class="pre">Trace</span></code> menu to specify the trace data file name.</p>
<img alt="../_images/trace-compass-screenshot.png" src="../_images/trace-compass-screenshot.png" />
</section>
</section>
</section>
<section id="trace-command-description">
<h2>Trace command description<a class="headerlink" href="#trace-command-description" title="Permalink to this heading"></a></h2>
<section id="trace-start">
<span id="id3"></span><h3>trace start<a class="headerlink" href="#trace-start" title="Permalink to this heading"></a></h3>
<p>Start task tracing</p>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>trace start [-c][&lt;duration&gt;]
</pre></div>
</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">-c</span></code> : Continue the previous trace.
The trace data is not cleared before starting new trace.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;duration&gt;</span></code> : Specify the duration of the trace by seconds.
Task tracing is stopped after the specified period.
If not specified, the tracing continues until stopped by the command.</p></li>
</ul>
</section>
<section id="trace-stop">
<span id="id4"></span><h3>trace stop<a class="headerlink" href="#trace-stop" title="Permalink to this heading"></a></h3>
<p>Stop task tracing</p>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>trace stop
</pre></div>
</div>
</section>
<section id="trace-cmd">
<span id="id5"></span><h3>trace cmd<a class="headerlink" href="#trace-cmd" title="Permalink to this heading"></a></h3>
<p>Get the trace while running the specified command.
After the termination of the command, task tracing is stopped.
To use this command, <code class="docutils literal notranslate"><span class="pre">CONFIG_SYSTEM_SYSTEM</span></code> needs to be enabled.</p>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>trace cmd [-c] &lt;command&gt; [&lt;args&gt;...]
</pre></div>
</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">-c</span></code> : Continue the previous trace.
The trace data is not cleared before starting new trace.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;command&gt;</span></code> : Specify the command to get the task trace.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;args&gt;</span></code> : Arguments for the command.</p></li>
</ul>
<p><strong>Example:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; trace cmd sleep 1
</pre></div>
</div>
</section>
<section id="trace-dump">
<span id="id6"></span><h3>trace dump<a class="headerlink" href="#trace-dump" title="Permalink to this heading"></a></h3>
<p>Output the trace result.
If the task trace is running, it is stopped before the output.</p>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>trace dump [-c][&lt;filename&gt;]
</pre></div>
</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">-c</span></code> : Not stop tracing before the output.
Because dumping trace itself is a task activity and new trace data is added while output, the dump will never stop.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&lt;filename&gt;</span></code> : Specify the filename to save the trace result.
If not specified, the trace result is displayed to console.</p></li>
</ul>
</section>
<section id="trace-mode">
<span id="id7"></span><h3>trace mode<a class="headerlink" href="#trace-mode" title="Permalink to this heading"></a></h3>
<p>Set the task trace mode options.
The default value is given by the kernel configuration <code class="docutils literal notranslate"><span class="pre">CONFIG_SCHED_INSTRUMENTATION_FILTER_DEFAULT_MODE</span></code>.</p>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>trace mode [{+|-}{o|s|a|i}...]
</pre></div>
</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">+o</span></code> : Enable overwrite mode.
The trace buffer is a ring buffer and it can overwrite old data if no free space is available in the buffer.
Enables this behavior.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-o</span></code> : Disable overwrite mode.
The new trace data will be disposed when the buffer is full.
This is useful to keep the data of the beginning of the trace.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">+s</span></code> : Enable system call trace.
It records the event of enter/leave system call which is issued by the application.
All system calls are recorded by default. <code class="docutils literal notranslate"><span class="pre">trace</span> <span class="pre">syscall</span></code> command can filter the system calls to be recorded.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-s</span></code> : Disable system call trace.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">+a</span></code> : Enable recording the system call arguments.
It records the arguments passed to the issued system call to the trace data.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-a</span></code> : Disable recording the system call arguments.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">+i</span></code> : Enable interrupt trace.
It records the event of enter/leave interrupt handler which occurred while tracing.
All IRQs are recorded by default. <code class="docutils literal notranslate"><span class="pre">trace</span> <span class="pre">irq</span></code> command can filter the IRQs to be recorded.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-i</span></code> : Disable interrupt trace.</p></li>
</ul>
<p>If no command parameters are specified, display the current mode as the follows.</p>
<p><strong>Example:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>nsh&gt; trace mode
Task trace mode:
Trace : enabled
Overwrite : on (+o)
Syscall trace : on (+s)
Filtered Syscalls : 16
Syscall trace with args : on (+a)
IRQ trace : on (+i)
Filtered IRQs : 2
</pre></div>
</div>
</section>
<section id="trace-syscall">
<span id="id8"></span><h3>trace syscall<a class="headerlink" href="#trace-syscall" title="Permalink to this heading"></a></h3>
<p>Configure the filter of the system call trace.</p>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>trace syscall [{+|-}&lt;syscallname&gt;...]
</pre></div>
</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">+&lt;syscallname&gt;</span></code> : Add the specified system call name to the filter.
The execution of the filtered system call is not recorded into the trace data.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-&lt;syscallname&gt;</span></code> : Remove the specified system call name from the filter.</p></li>
</ul>
<p>Wildcard “<code class="docutils literal notranslate"><span class="pre">*</span></code>” can be used to specify the system call name.
For example, “<code class="docutils literal notranslate"><span class="pre">trace</span> <span class="pre">syscall</span> <span class="pre">+sem_*</span></code>” filters the system calls begin with “<code class="docutils literal notranslate"><span class="pre">sem_</span></code>”, such as <code class="docutils literal notranslate"><span class="pre">sem_post()</span></code>, <code class="docutils literal notranslate"><span class="pre">sem_wait()</span></code>,…</p>
<p>If no command parameters are specified, display the current filter settings as the follows.</p>
<p><strong>Example:</strong></p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">nsh&gt; trace syscall</span>
<span class="go">Filtered Syscalls: 16</span>
<span class="go"> getpid</span>
<span class="go"> sem_destroy</span>
<span class="go"> sem_post</span>
<span class="go"> sem_timedwait</span>
<span class="go"> sem_trywait</span>
<span class="go"> sem_wait</span>
<span class="go"> mq_close</span>
<span class="go"> mq_getattr</span>
<span class="go"> mq_notify</span>
<span class="go"> mq_open</span>
<span class="go"> mq_receive</span>
<span class="go"> mq_send</span>
<span class="go"> mq_setattr</span>
<span class="go"> mq_timedreceive</span>
<span class="go"> mq_timedsend</span>
<span class="go"> mq_unlink</span>
</pre></div>
</div>
</section>
<section id="trace-irq">
<span id="id9"></span><h3>trace irq<a class="headerlink" href="#trace-irq" title="Permalink to this heading"></a></h3>
<p>Configure the filter of the interrupt trace.</p>
<p><strong>Command Syntax:</strong></p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>trace irq [{+|-}&lt;irqnum&gt;...]
</pre></div>
</div>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">+&lt;irqnum&gt;</span></code> : Add the specified IRQ number to the filter.
The execution of the filtered IRQ handler is not recorded into the trace data.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-&lt;irqnum&gt;</span></code> : Remove the specified IRQ number from the filter.</p></li>
</ul>
<p>Wildcard “<code class="docutils literal notranslate"><span class="pre">*</span></code>” can be used to specify all IRQs.</p>
<p>If no command parameters are specified, display the current filter settings as the follows.</p>
<p><strong>Example:</strong></p>
<div class="highlight-console notranslate"><div class="highlight"><pre><span></span><span class="go">nsh&gt; trace irq</span>
<span class="go">Filtered IRQs: 2</span>
<span class="go"> 11</span>
<span class="go"> 15</span>
</pre></div>
</div>
</section>
</section>
</section>
</div>
</div>
<footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
<a href="tasktrace.html" class="btn btn-neutral float-left" title="Task Trace" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
<a href="tasktraceinternal.html" class="btn btn-neutral float-right" title="Task Trace Internals" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
</div>
<hr/>
<div role="contentinfo">
<p>&#169; Copyright 2023, The Apache Software Foundation.</p>
</div>
</footer>
</div>
</div>
</section>
</div>
<script>
jQuery(function () {
SphinxRtdTheme.Navigation.enable(true);
});
</script>
</body>
</html>