blob: fc1582807c86cebdc813fdad6b9990328237f3bc [file] [log] [blame] [view]
<link rel="stylesheet" href="../style.css" />
[TOC]
# fuchsia.memory.inspection
<div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 12</span></div>
## **PROTOCOLS**
## Collector {#Collector}
*Defined in [fuchsia.memory.inspection/inspection.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.memory.inspection/inspection.fidl;l=11)*
<p>Obtains the memory usage of a fuchsia device.</p>
### CollectJsonStats {#Collector.CollectJsonStats}
<p>Writes to <code>socket</code> a JSON capture of the memory usage and the memory
bucket definition, as a well-formed UTF-8 string.
The socket is closed by the server after all the data is written into
it.</p>
<p>TODO(fxbug.dev/122104): Document the schema of the JSON.</p>
<p>Sample output:
{&quot;Capture&quot;:
{
&quot;Time&quot;:28477260758625,
&quot;Kernel&quot;:{
&quot;total&quot;:1610612736,
&quot;free&quot;:170565632,
&quot;wired&quot;:67395584,
&quot;total_heap&quot;:30904320,
&quot;free_heap&quot;:1873728,
&quot;vmo&quot;:1276194816,
&quot;mmu&quot;:65294336,
&quot;ipc&quot;:196608,
&quot;other&quot;:61440
},
&quot;Processes&quot;:[
[&quot;koid&quot;,&quot;name&quot;,&quot;vmos&quot;],
[47325,&quot;fonts.cm&quot;,[47353, ...]],
...
],
&quot;VmoNames&quot;:[&quot;scudo:primary&quot;, ...],
&quot;Vmos&quot;:[
[&quot;koid&quot;,&quot;name&quot;,&quot;parent_koid&quot;,&quot;committed_bytes&quot;,&quot;allocated_bytes&quot;],
[47440,38,47437,4096,4096],
...
]
}
&quot;Buckets&quot;:
[
{
&quot;event_code&quot;: 29,
&quot;name&quot;: &quot;BlobfsInactive&quot;,
&quot;process&quot;: &quot;blobfs\.cm&quot;,
&quot;vmo&quot;: &quot;inactive-blob-.*&quot;
},
...
]
}</p>
<p>For size reasons:
- Processes and Vmos have an initial entry that contains the names of the the fields in
the rest of the entries.
- The names of the VMOs are an index into the VMONames array.</p>
#### Request {#Collector.CollectJsonStats_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>socket</code></td>
<td>
<code>handle&lt;socket&gt;</code>
</td>
</tr>
</table>