blob: 420d6f8139ab20522ce34bc88e1c6a0bc9eefdb3 [file] [log] [blame]
page.title=CPU Monitor
parent.title=Android Monitor
parent.link=android-monitor.html
meta.tags="android, performance, profiling, tools, monitor"
page.tags="android", "performance", "profiling", "tools", "monitor"
page.metaDescription=Use the CPU Monitor to display CPU usage in real time and the percentage of total CPU time (including all cores) used in user and kernel mode.
page.image=tools/help/thumbnails/am-cpumon.png
page.article=true
@jd:body
<div id="qv-wrapper">
<div id="qv">
<h2>In this document</h2>
<ol>
<li><a href="#running">Displaying a Running App in the CPU Monitor</a></li>
<li><a href="#snapshot">Recording Call Stack Changes</a></li>
</ol>
</div>
</div>
<p>
The CPU Monitor lets you easily monitor the central processing unit (CPU) usage of your app. It
displays CPU usage in real time and displays the percentage of total CPU time (including all cores)
used in user and kernel mode. In user mode, the code must use system APIs to access hardware or
memory, has access to virtual memory addresses only, and crashes are usually
recoverable. In kernel mode, the code can directly access
hardware, including physical memory addresses; crashes halt the device.
</p>
<h2 id="running">
Displaying a Running App in the CPU Monitor
</h2>
<p>
To display an app running on a particular device or emulator in the CPU Monitor:
</p>
<ol>
<li>Meet the <a href=
"{@docRoot}tools/help/am-basics.html#byb">prerequisites and dependencies</a>.
</li>
<li>Open an app project.
</li>
<li><a href=
"{@docRoot}tools/building/building-studio.html#RunningApp">Run the app</a> on a hardware device or
emulator.
</li>
<li>
<a href="{@docRoot}tools/help/am-basics.html#displaying">Display Android Monitor</a>.
</li>
<li>Click the <strong>Monitors</strong> tab and <a href=
"{@docRoot}tools/help/am-basics.html#rearranging">display the CPU Monitor</a>.
</li>
<li>Enable the CPU Monitor by clicking Pause <img src="{@docRoot}images/tools/am-ipause.png"
style="vertical-align:sub;margin:0;height:17px" alt="Pause icon" /> to deselect it.
</li>
<p>
The CPU Monitor starts to display any CPU usage.
In the graph, the y-axis displays the percentage of CPU used. The x-axis records the time elapsed
and starts with seconds, and then minutes and seconds, and so on.
</p>
<img src="{@docRoot}images/tools/am-cpumon2.png" style="vertical-align:sub;margin:0" />
<li>To stop the CPU Monitor, click Pause <img src="{@docRoot}images/tools/am-ipause.png"
style="vertical-align:sub;margin:0;height:17px" alt="Pause icon" /> again to select
it.
</li>
</ol>
<h2 id="snapshot">
Recording Call Stack Changes
</h2>
<p>
You can capture a record of the changes on the call stack during a particular
time period while the CPU Monitor is running. For more information, see
<a href="{@docRoot}tools/help/am-methodtrace.html">Method Trace</a>.
</p>