提交 7aff3df8 编写于 作者: D duangavin123

上传英文

Signed-off-by: Nduangavin123 <duanxichao@huawei.com>
上级 2569f4fc
# MIPI CSI<a name="EN-US_TOPIC_0000001198067744"></a>
- [Overview](#section72226945170128)
- [Available APIs](#section735525713405)
- [How to Develop](#section378858277170128)
- [Development Example](#section2049027816170128)
## Overview<a name="section72226945170128"></a>
Defined by the Mobile Industry Processor Interface \(MIPI\) Alliance, the Camera Serial Interface \(CSI\) is a specification that allows data to be transmitted from the camera to the host processor on mobile platforms. In the Hardware Driver Foundation \(HDF\), the MIPI CSI module uses the service-free mode for API adaptation. The service-free mode applies to the devices that do not provide user-mode APIs or the OS that does not distinguish the user mode and the kernel mode. In the service-free mode, DevHandle \(a void pointer\) directly points to the kernel-mode address of the device object.
**Figure 1** Service-free mode<a name="fig260692723120"></a>
![](figures/service-free-mode.png "Service-free mode")
## Available APIs<a name="section735525713405"></a>
MipiCsiCntlrMethod:
```
struct MipiCsiCntlrMethod {
int32_t (*setComboDevAttr)(struct MipiCsiCntlr *cntlr, ComboDevAttr *pAttr);
int32_t (*setPhyCmvmode)(struct MipiCsiCntlr *cntlr, uint8_t devno, PhyCmvMode cmvMode);
int32_t (*setExtDataType)(struct MipiCsiCntlr *cntlr, ExtDataType* dataType);
int32_t (*setHsMode)(struct MipiCsiCntlr *cntlr, LaneDivideMode laneDivideMode);
int32_t (*enableClock)(struct MipiCsiCntlr *cntlr, uint8_t comboDev);
int32_t (*disableClock)(struct MipiCsiCntlr *cntlr, uint8_t comboDev);
int32_t (*resetRx)(struct MipiCsiCntlr *cntlr, uint8_t comboDev);
int32_t (*unresetRx)(struct MipiCsiCntlr *cntlr, uint8_t comboDev);
int32_t (*enableSensorClock)(struct MipiCsiCntlr *cntlr, uint8_t snsClkSource);
int32_t (*disableSensorClock)(struct MipiCsiCntlr *cntlr, uint8_t snsClkSource);
int32_t (*resetSensor)(struct MipiCsiCntlr *cntlr, uint8_t snsResetSource);
int32_t (*unresetSensor)(struct MipiCsiCntlr *cntlr, uint8_t snsResetSource);
};
```
**Table 1** Callbacks for the members in the MipiCsiCntlrMethod structure
<a name="table1233500677170128"></a>
<table><thead align="left"><tr id="row1000451054170128"><th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.1"><p id="entry1111988081170128p0"><a name="entry1111988081170128p0"></a><a name="entry1111988081170128p0"></a>Callback</p>
</th>
<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.2"><p id="entry1314377643170128p0"><a name="entry1314377643170128p0"></a><a name="entry1314377643170128p0"></a>Input Parameter</p>
</th>
<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.3"><p id="entry102571833170128p0"><a name="entry102571833170128p0"></a><a name="entry102571833170128p0"></a>Output Parameter</p>
</th>
<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.4"><p id="entry259883708170128p0"><a name="entry259883708170128p0"></a><a name="entry259883708170128p0"></a>Return Value</p>
</th>
<th class="cellrowborder" valign="top" width="20%" id="mcps1.2.6.1.5"><p id="entry1719007141170128p0"><a name="entry1719007141170128p0"></a><a name="entry1719007141170128p0"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row893348241170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry2092857420170128p0"><a name="entry2092857420170128p0"></a><a name="entry2092857420170128p0"></a>setComboDevAttr</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p155578927170128"><a name="p155578927170128"></a><a name="p155578927170128"></a><strong id="b2983104693117"><a name="b2983104693117"></a><a name="b2983104693117"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p534134719170128"><a name="p534134719170128"></a><a name="p534134719170128"></a><strong id="b717683263220"><a name="b717683263220"></a><a name="b717683263220"></a>pAttr</strong>: structure pointer to the configuration structure of the MIPI CSI.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry1300850044170128p0"><a name="entry1300850044170128p0"></a><a name="entry1300850044170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry1079550609170128p0"><a name="entry1079550609170128p0"></a><a name="entry1079550609170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry1104973652170128p0"><a name="entry1104973652170128p0"></a><a name="entry1104973652170128p0"></a>Sets the MIPI-CSI configuration.</p>
</td>
</tr>
<tr id="row1236584443170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry1263277119170128p0"><a name="entry1263277119170128p0"></a><a name="entry1263277119170128p0"></a>setPhyCmvmode</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p548503413170128"><a name="p548503413170128"></a><a name="p548503413170128"></a><strong id="b33316314348"><a name="b33316314348"></a><a name="b33316314348"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p1389106408170128"><a name="p1389106408170128"></a><a name="p1389106408170128"></a><strong id="b7288183093611"><a name="b7288183093611"></a><a name="b7288183093611"></a>devno</strong>: Device ID, which is of the uint8_t type.</p>
<p id="p118314402170128"><a name="p118314402170128"></a><a name="p118314402170128"></a><strong id="b1347113393714"><a name="b1347113393714"></a><a name="b1347113393714"></a>cmvMode</strong>: common-mode voltage (CMV) mode.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry886884421170128p0"><a name="entry886884421170128p0"></a><a name="entry886884421170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry1542733203170128p0"><a name="entry1542733203170128p0"></a><a name="entry1542733203170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry1506663070170128p0"><a name="entry1506663070170128p0"></a><a name="entry1506663070170128p0"></a>Sets the CMV mode.</p>
</td>
</tr>
<tr id="row1486148936170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry1589217404170128p0"><a name="entry1589217404170128p0"></a><a name="entry1589217404170128p0"></a>setExtDataType</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p114389566170128"><a name="p114389566170128"></a><a name="p114389566170128"></a><strong id="b34053117344"><a name="b34053117344"></a><a name="b34053117344"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p996608377170128"><a name="p996608377170128"></a><a name="p996608377170128"></a><strong id="b784685684412"><a name="b784685684412"></a><a name="b784685684412"></a>dataType</strong>: structure pointer to the data that defines the YUV, original data formats, and bit depth.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry378080489170128p0"><a name="entry378080489170128p0"></a><a name="entry378080489170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry851136224170128p0"><a name="entry851136224170128p0"></a><a name="entry851136224170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry1309676064170128p0"><a name="entry1309676064170128p0"></a><a name="entry1309676064170128p0"></a>Sets the YUV, RAW data format, and bit depth.</p>
</td>
</tr>
<tr id="row692364909170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry1017488702170128p0"><a name="entry1017488702170128p0"></a><a name="entry1017488702170128p0"></a>setHsMode</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p1054266120170128"><a name="p1054266120170128"></a><a name="p1054266120170128"></a><strong id="b144183117349"><a name="b144183117349"></a><a name="b144183117349"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p1574674418170128"><a name="p1574674418170128"></a><a name="p1574674418170128"></a><strong id="b18748194155516"><a name="b18748194155516"></a><a name="b18748194155516"></a>laneDivideMode</strong>: lane mode.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry1749069145170128p0"><a name="entry1749069145170128p0"></a><a name="entry1749069145170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry1237801346170128p0"><a name="entry1237801346170128p0"></a><a name="entry1237801346170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry1643965522170128p0"><a name="entry1643965522170128p0"></a><a name="entry1643965522170128p0"></a>Sets the MIPI RX lane distribution.</p>
</td>
</tr>
<tr id="row1437392211170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry80806261170128p0"><a name="entry80806261170128p0"></a><a name="entry80806261170128p0"></a>enableClock</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p867235167170128"><a name="p867235167170128"></a><a name="p867235167170128"></a><strong id="b94263116342"><a name="b94263116342"></a><a name="b94263116342"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p1770663973170128"><a name="p1770663973170128"></a><a name="p1770663973170128"></a><strong id="b1342116531004"><a name="b1342116531004"></a><a name="b1342116531004"></a>comboDev</strong>: channel ID, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry836736200170128p0"><a name="entry836736200170128p0"></a><a name="entry836736200170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry918324954170128p0"><a name="entry918324954170128p0"></a><a name="entry918324954170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry373275246170128p0"><a name="entry373275246170128p0"></a><a name="entry373275246170128p0"></a>Enables the MIPI clock.</p>
</td>
</tr>
<tr id="row1944617165170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry1879109927170128p0"><a name="entry1879109927170128p0"></a><a name="entry1879109927170128p0"></a>disableClock</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p252627163170128"><a name="p252627163170128"></a><a name="p252627163170128"></a><strong id="b343103114343"><a name="b343103114343"></a><a name="b343103114343"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p573650189170128"><a name="p573650189170128"></a><a name="p573650189170128"></a><strong id="b1747970172618"><a name="b1747970172618"></a><a name="b1747970172618"></a>comboDev</strong>: channel ID, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry8107921170128p0"><a name="entry8107921170128p0"></a><a name="entry8107921170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry349207958170128p0"><a name="entry349207958170128p0"></a><a name="entry349207958170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry693552037170128p0"><a name="entry693552037170128p0"></a><a name="entry693552037170128p0"></a>Disables the MIPI clock.</p>
</td>
</tr>
<tr id="row168452313170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry536818735170128p0"><a name="entry536818735170128p0"></a><a name="entry536818735170128p0"></a>resetRx</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p1214231503170128"><a name="p1214231503170128"></a><a name="p1214231503170128"></a><strong id="b1043031153417"><a name="b1043031153417"></a><a name="b1043031153417"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p104793304170128"><a name="p104793304170128"></a><a name="p104793304170128"></a><strong id="b597920533269"><a name="b597920533269"></a><a name="b597920533269"></a>comboDev</strong>: channel ID, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry349755171170128p0"><a name="entry349755171170128p0"></a><a name="entry349755171170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry608378681170128p0"><a name="entry608378681170128p0"></a><a name="entry608378681170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry1692819512170128p0"><a name="entry1692819512170128p0"></a><a name="entry1692819512170128p0"></a>Resets the MIPI RX.</p>
</td>
</tr>
<tr id="row812174477170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry677771062170128p0"><a name="entry677771062170128p0"></a><a name="entry677771062170128p0"></a>unresetRx</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p1883220887170128"><a name="p1883220887170128"></a><a name="p1883220887170128"></a><strong id="b1202156153016"><a name="b1202156153016"></a><a name="b1202156153016"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p114324757170128"><a name="p114324757170128"></a><a name="p114324757170128"></a><strong id="b105520153110"><a name="b105520153110"></a><a name="b105520153110"></a>comboDev</strong>: channel ID, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry2088687179170128p0"><a name="entry2088687179170128p0"></a><a name="entry2088687179170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry250678538170128p0"><a name="entry250678538170128p0"></a><a name="entry250678538170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry1714667992170128p0"><a name="entry1714667992170128p0"></a><a name="entry1714667992170128p0"></a>Deasserts the reset of the MIPI RX.</p>
</td>
</tr>
<tr id="row1282919412170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry204916079170128p0"><a name="entry204916079170128p0"></a><a name="entry204916079170128p0"></a>enableSensorClock</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p217879421170128"><a name="p217879421170128"></a><a name="p217879421170128"></a><strong id="b197181237203211"><a name="b197181237203211"></a><a name="b197181237203211"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p2098908158170128"><a name="p2098908158170128"></a><a name="p2098908158170128"></a><strong id="b12861154993218"><a name="b12861154993218"></a><a name="b12861154993218"></a>snsClkSource</strong>: number of the clock signal cable of the sensor, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry1290595383170128p0"><a name="entry1290595383170128p0"></a><a name="entry1290595383170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry1313850176170128p0"><a name="entry1313850176170128p0"></a><a name="entry1313850176170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry384362703170128p0"><a name="entry384362703170128p0"></a><a name="entry384362703170128p0"></a>Enables the MIPI sensor clock.</p>
</td>
</tr>
<tr id="row1992432516170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry980444503170128p0"><a name="entry980444503170128p0"></a><a name="entry980444503170128p0"></a>disableSensorClock</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p1996780281170128"><a name="p1996780281170128"></a><a name="p1996780281170128"></a><strong id="b4445316347"><a name="b4445316347"></a><a name="b4445316347"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p2021170726170128"><a name="p2021170726170128"></a><a name="p2021170726170128"></a><strong id="b17971423820"><a name="b17971423820"></a><a name="b17971423820"></a>snsClkSource</strong>: number of the clock signal cable of the sensor, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry1694413990170128p0"><a name="entry1694413990170128p0"></a><a name="entry1694413990170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry1647081928170128p0"><a name="entry1647081928170128p0"></a><a name="entry1647081928170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry2011696236170128p0"><a name="entry2011696236170128p0"></a><a name="entry2011696236170128p0"></a>Disables the MIPI sensor clock.</p>
</td>
</tr>
<tr id="row1739370133170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry386036597170128p0"><a name="entry386036597170128p0"></a><a name="entry386036597170128p0"></a>resetSensor</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p1065048089170128"><a name="p1065048089170128"></a><a name="p1065048089170128"></a><strong id="b19451631183417"><a name="b19451631183417"></a><a name="b19451631183417"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p998202090170128"><a name="p998202090170128"></a><a name="p998202090170128"></a><strong id="b10443111911384"><a name="b10443111911384"></a><a name="b10443111911384"></a>snsClkSource</strong>: number of the clock signal cable of the sensor, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry173182567170128p0"><a name="entry173182567170128p0"></a><a name="entry173182567170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry879245456170128p0"><a name="entry879245456170128p0"></a><a name="entry879245456170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry944835652170128p0"><a name="entry944835652170128p0"></a><a name="entry944835652170128p0"></a>Resets the sensor.</p>
</td>
</tr>
<tr id="row1197566339170128"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.1 "><p id="entry363281016170128p0"><a name="entry363281016170128p0"></a><a name="entry363281016170128p0"></a>unresetSensor</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.2 "><p id="p416483731170128"><a name="p416483731170128"></a><a name="p416483731170128"></a><strong id="b178488417385"><a name="b178488417385"></a><a name="b178488417385"></a>cntlr</strong>: structure pointer to the MIPI CSI controller.</p>
<p id="p1988272362170128"><a name="p1988272362170128"></a><a name="p1988272362170128"></a><strong id="b6353246183818"><a name="b6353246183818"></a><a name="b6353246183818"></a>snsClkSource</strong>: number of the clock signal cable of the sensor, which is of the uint8_t type.</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.3 "><p id="entry1658055665170128p0"><a name="entry1658055665170128p0"></a><a name="entry1658055665170128p0"></a></p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.4 "><p id="entry2142771023170128p0"><a name="entry2142771023170128p0"></a><a name="entry2142771023170128p0"></a>HDF_STATUS</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.2.6.1.5 "><p id="entry791107803170128p0"><a name="entry791107803170128p0"></a><a name="entry791107803170128p0"></a>Deasserts the reset of a sensor.</p>
</td>
</tr>
</tbody>
</table>
## How to Develop<a name="section378858277170128"></a>
The MIPI CSI module adaptation involves the following steps:
1. Instantiate the driver entry.
- Instantiate the **HdfDriverEntry** structure.
- Call **HDF\_INIT** to register the **HdfDriverEntry** instance with the HDF.
2. Configure attribute files.
- Add the **deviceNode** information to the **device\_info.hcs** file.
- \(Optional\) Add the **mipicsi\_config.hcs** file.
3. Instantiate the MIPI CSI controller object.
- Initialize **MipiCsiCntlr**.
- Instantiate **MipiCsiCntlrMethod** in the **MipiCsiCntlr** object.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>For details, see [Available APIs](#section735525713405).
4. Debug the driver.
- \(Optional\) For new drivers, verify basic functions, for example, verify the information returned after the connect operation and whether data is successfully transmitted.
## Development Example<a name="section2049027816170128"></a>
The following uses **mipi\_rx\_hi35xx.c** as an example to present the contents that need to be provided by the vendor to implement device functions.
1. Generally, you need to configure the device attributes in **busxx\_config.hcs** and add the **deviceNode** information to the **device\_info.hcs** file. The device attribute values are closely related to the default values or value range of the **MipiCsiCntlr** members at the core layer. The **deviceNode** information is related to the driver entry registration.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>In this example, the MIPI controller attributes are defined in the source file. If required, add the **deviceMatchAttr** information to **deviceNode** in the **device\_info** file and add the** mipicsi\_config.hcs** file.
**device\_info.hcs** configuration reference:
```
root {
device_info {
match_attr = "hdf_manager";
platform :: host {
hostName = "platform_host";
priority = 50;
device_mipi_csi:: device {
device0 :: deviceNode {
policy = 0;
priority = 160;
permission = 0644;
moduleName = "HDF_MIPI_RX"; // (Mandatory) Driver name, which must be the same as the moduleName in the driver entry.
serviceName = "HDF_MIPI_RX";// (Mandatory) Unique name of the service published by the driver.
}
}
}
}
}
```
2. Instantiate the driver entry. The driver entry must be a global variable of the **HdfDriverEntry** type \(defined in **hdf\_device\_desc.h**\), and the value of **moduleName** must be the same as that in **device\_info.hcs**. The function pointer members of the **HdfDriverEntry** structure are filled by the vendors' operation functions. In the HDF, the start address of each **HdfDriverEntry** object of all loaded drivers is collected to form a segment address space similar to an array for the upper layer to invoke.
Generally, the HDF calls the **Bind** function and then the **Init** function to load a driver. If **Init** fails to be called, the HDF calls **Release** to release driver resources and exit.
MIPI CSI driver entry reference:
```
struct HdfDriverEntry g_mipiCsiDriverEntry = {
.moduleVersion = 1,
.Init = Hi35xxMipiCsiInit, // See the Init function.
.Release = Hi35xxMipiCsiRelease, //See the Release function.
.moduleName = "HDF_MIPI_RX", // (Mandatory) The value must be the same as that in the device_info.hcs file.
};
HDF_INIT(g_mipiCsiDriverEntry); // Call HDF_INIT to register the driver entry with the HDF.
```
3. Initialize the **MipiCsiCntlr** object at the core layer, including initializing the vendor custom structure \(passing parameters and data\), instantiating **MipiCsiCntlrMethod** \(used to call underlying functions of the driver\) in **MipiCsiCntlr**, and implementing the **HdfDriverEntry** member functions \(**Bind**, **Init**, and **Release**\).
- Custom structure reference:
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>To the driver, the custom structure carries parameters and data. The values in the **config** file are used to initialize the structure members. In this example, the MIPI CSI attributes are defined in the source file. Therefore, the basic member structure is similar to that of **MipiCsiCntlr**.
```
typedef struct {
/** Data type: 8-bit, 10-bit, 12-bit, 14-bit, or 16-bit */
DataType inputDataType;
/** MIPI WDM mode */
MipiWdrMode wdrMode;
/** laneId: -1 - disabled */
short laneId[MIPI_LANE_NUM];
union {
/** Used for HI_MIPI_WDR_MODE_DT */
short dataType[WDR_VC_NUM];
};
} MipiDevAttr;
typedef struct {
/** Device number. */
uint8_t devno;
/** Input mode, which can be MIPI, LVDS, sub-LVDS, HiSPi, or DC. */
InputMode inputMode;
MipiDataRate dataRate;
/** Crop area of the MIPI RX device (same as the size of the input image of the sensor). */
ImgRect imgRect;
union {
MipiDevAttr mipiAttr;
LvdsDevAttr lvdsAttr;
};
} ComboDevAttr;
// MipiCsiCntlr is the core layer controller structure. Its members are assigned with values by using the Init function.
struct MipiCsiCntlr {
/** Send the service provided by this controller when the driver is bound to the HDF. */
struct IDeviceIoService service;
/** Pass the pointer to the device when the driver is bound to the HDF. */
struct HdfDeviceObject *device;
/** Device number */
unsigned int devNo;
/** All APIs provided by the controller */
struct MipiCsiCntlrMethod *ops;
/** All APIs for controller debugging. Set it to null if the driver is not implemented. */
struct MipiCsiCntlrDebugMethod *debugs;
/** Controller context variable. */
MipiDevCtx ctx;
/** Spinlock used when the controller context variable is accessed. */
OsalSpinlock ctxLock;
/** Lock method when the controller is managed */
struct OsalMutex lock;
/** Pointer to anonymous data, which is used to store the CSI device structure */
void *priv;
};
```
- **\(Important\)** Instantiate the callback function structure **MipiCsiCntlrMethod** in **MipiCsiCntlr**. Other members are initialized by using the **Init** function.
```
static struct MipiCsiCntlrMethod g_method = {
.setComboDevAttr = Hi35xxSetComboDevAttr,
.setPhyCmvmode = Hi35xxSetPhyCmvmode,
.setExtDataType = Hi35xxSetExtDataType,
.setHsMode = Hi35xxSetHsMode,
.enableClock = Hi35xxEnableClock,
.disableClock = Hi35xxDisableClock,
.resetRx = Hi35xxResetRx,
.unresetRx = Hi35xxUnresetRx,
.enableSensorClock = Hi35xxEnableSensorClock,
.disableSensorClock = Hi35xxDisableSensorClock,
.resetSensor = Hi35xxResetSensor,
.unresetSensor = Hi35xxUnresetSensor
};
```
- Init function
Input parameters:
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration file information.
Return values:
HDF\_STATUS \(The following table lists some status. For details about other status, see **HDF\_STATUS** in the **/drivers/framework/include/utils/hdf\_base.h** file.\)
<a name="table683892652170128"></a>
<table><thead align="left"><tr id="row466801181170128"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="entry433041536170128p0"><a name="entry433041536170128p0"></a><a name="entry433041536170128p0"></a>Status (Value)</p>
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="entry1260647143170128p0"><a name="entry1260647143170128p0"></a><a name="entry1260647143170128p0"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row2053721693170128"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="entry772353853170128p0"><a name="entry772353853170128p0"></a><a name="entry772353853170128p0"></a>HDF_ERR_INVALID_OBJECT</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="entry891453569170128p0"><a name="entry891453569170128p0"></a><a name="entry891453569170128p0"></a>Invalid object</p>
</td>
</tr>
<tr id="row1654561941170128"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="entry1037876509170128p0"><a name="entry1037876509170128p0"></a><a name="entry1037876509170128p0"></a>HDF_ERR_MALLOC_FAIL</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="entry1354763041170128p0"><a name="entry1354763041170128p0"></a><a name="entry1354763041170128p0"></a>Failed to allocate memory</p>
</td>
</tr>
<tr id="row515913237170128"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="entry1517991694170128p0"><a name="entry1517991694170128p0"></a><a name="entry1517991694170128p0"></a>HDF_ERR_INVALID_PARAM</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="entry784824354170128p0"><a name="entry784824354170128p0"></a><a name="entry784824354170128p0"></a>Invalid parameter</p>
</td>
</tr>
<tr id="row1055228061170128"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="entry771111180170128p0"><a name="entry771111180170128p0"></a><a name="entry771111180170128p0"></a>HDF_ERR_IO</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="entry1302592910170128p0"><a name="entry1302592910170128p0"></a><a name="entry1302592910170128p0"></a>I/O error</p>
</td>
</tr>
<tr id="row1131544928170128"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="entry1360197988170128p0"><a name="entry1360197988170128p0"></a><a name="entry1360197988170128p0"></a>HDF_SUCCESS</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="entry1609403118170128p0"><a name="entry1609403118170128p0"></a><a name="entry1609403118170128p0"></a>Operation successful</p>
</td>
</tr>
<tr id="row1247344727170128"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="entry816278864170128p0"><a name="entry816278864170128p0"></a><a name="entry816278864170128p0"></a>HDF_FAILURE</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="entry814861870170128p0"><a name="entry814861870170128p0"></a><a name="entry814861870170128p0"></a>Operation failed</p>
</td>
</tr>
</tbody>
</table>
Function description:
Connects to the **MipiCsiCntlrMethod** instance, calls **MipiCsiRegisterCntlr**, and performs other vendor-defined initialization operations.
```
static int32_t Hi35xxMipiCsiInit(struct HdfDeviceObject *device)
{
int32_t ret;
HDF_LOGI("%s: enter!", __func__);
g_mipiCsi.priv = NULL; // g_mipiTx is a global variable defined.
//static struct MipiCsiCntlr g_mipiCsi = {
//.devNo = 0
//};
g_mipiCsi.ops = &g_method; // Connect to the MipiCsiCntlrMethod instance.
#ifdef CONFIG_HI_PROC_SHOW_SUPPORT
g_mipiCsi.debugs = &g_debugMethod;
#endif
ret = MipiCsiRegisterCntlr(&g_mipiCsi, device); // (Mandatory) Call the function at the core layer and g_mipiTx to initialize global variables at the core layer.
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: [MipiCsiRegisterCntlr] failed!", __func__);
return ret;
}
ret = MipiRxDrvInit(); // (Mandatory) Device initialization customized by the vendor.
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: [MipiRxDrvInit] failed.", __func__);
return ret;
}
#ifdef MIPICSI_VFS_SUPPORT
ret = MipiCsiDevModuleInit(g_mipiCsi.devNo);
if (ret != HDF_SUCCESS) {
HDF_LOGE("%s: [MipiCsiDevModuleInit] failed!", __func__);
return ret;
}
#endif
OsalSpinInit(&g_mipiCsi.ctxLock);
HDF_LOGI("%s: load mipi csi driver success!", __func__);
return ret;
}
// mipi_csi_core.c, core layer file.
int32_t MipiCsiRegisterCntlr(struct MipiCsiCntlr *cntlr, struct HdfDeviceObject *device)
{
...
// Define the global variable static struct MipiCsiHandle g_mipiCsihandle[MAX_CNTLR_CNT];
if (g_mipiCsihandle[cntlr->devNo].cntlr == NULL) {
(void)OsalMutexInit(&g_mipiCsihandle[cntlr->devNo].lock);
(void)OsalMutexInit(&(cntlr->lock));
g_mipiCsihandle[cntlr->devNo].cntlr = cntlr; // Initialize MipiCsiHandle.
g_mipiCsihandle[cntlr->devNo].priv = NULL;
cntlr->device = device; // Enable conversion between HdfDeviceObject and MipiCsiHandle.
device->service = &(cntlr->service); // Enable conversion between HdfDeviceObject and MipiCsiHandle.
cntlr->priv = NULL;
HDF_LOGI("%s: success.", __func__);
return HDF_SUCCESS;
}
HDF_LOGE("%s: cntlr already exists.", __func__);
return HDF_FAILURE;
}
```
- Release function
Input parameters:
**HdfDeviceObject**, an interface parameter exposed by the driver, contains the .hcs configuration file information.
Return values:
Function description:
Releases the memory and deletes the controller. This function assigns a value to the **Release** API in the driver entry structure. When the HDF fails to call the **Init** function to initialize the driver, the **Release** function can be called to release driver resources. All forced conversion operations for obtaining the corresponding object can be successful only when the **Init** function has the corresponding value assignment operations.
```
static void Hi35xxMipiCsiRelease(struct HdfDeviceObject *device)
{
struct MipiCsiCntlr *cntlr = NULL;
...
cntlr = MipiCsiCntlrFromDevice(device); // A forced conversion from HdfDeviceObject to MipiCsiCntlr is involved.
//return (device == NULL) ? NULL : (struct MipiCsiCntlr *)device->service;
...
OsalSpinDestroy(&cntlr->ctxLock);
#ifdef MIPICSI_VFS_SUPPORT
MipiCsiDevModuleExit(cntlr->devNo);
#endif
MipiRxDrvExit(); // (Mandatory) Release the resources occupied by the vendor's devices.
MipiCsiUnregisterCntlr(&g_mipiCsi); // Null function
g_mipiCsi.priv = NULL;
HDF_LOGI("%s: unload mipi csi driver success!", __func__);
}
```
......@@ -96,4 +96,5 @@
- [R&D Tools](subsys-toolchain.md)
- [bytrace Usage Guidelines](subsys-toolchain-bytrace-guide.md)
- [hdc\_std Usage Guidelines](subsys-toolchain-hdc-guide.md)
- [hiperf Usage Guidelines](subsys-toolchain-hiperf.md)
- [XTS](subsys-xts-guide.md)
\ No newline at end of file
# hiperf<a name="EN-US_TOPIC_0000001186476620"></a>
hiperf is a performance sampling and analysis tool provided for developers. It extends the user-mode capabilities based on the kernel perf mechanism and can conduct performance sampling of the specified application or the entire system.
You can run the **hiperf -h** command to display the commands supported by hiperf.
The following describes the common commands \(**list**, **stat**, **record**, and **report**\) supported by hiperf.
## list<a name="section121805449461"></a>
### Parameters<a name="section42124492494"></a>
The **list** command lists all the perf events supported by the device. The event names are used for the **-e** and **-g** parameters of the **stat** and **record** commands.
```
hiperf list [event type]
```
<a name="table054835774714"></a>
<table><thead align="left"><tr id="row125483575471"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p269191018489"><a name="p269191018489"></a><a name="p269191018489"></a>Parameter</p>
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p186911610174814"><a name="p186911610174814"></a><a name="p186911610174814"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row944214284815"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p44371223487"><a name="p44371223487"></a><a name="p44371223487"></a>hw</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p343715244814"><a name="p343715244814"></a><a name="p343715244814"></a>Lists the hardware events supported by the performance monitoring unit (PMU).</p>
</td>
</tr>
<tr id="row64421627484"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1743715294812"><a name="p1743715294812"></a><a name="p1743715294812"></a>sw</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p843752174819"><a name="p843752174819"></a><a name="p843752174819"></a>Lists the software events supported.</p>
</td>
</tr>
<tr id="row1544215254810"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p124375234814"><a name="p124375234814"></a><a name="p124375234814"></a>tp</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p18437202124820"><a name="p18437202124820"></a><a name="p18437202124820"></a>Lists the tracepotint events supported.</p>
</td>
</tr>
<tr id="row844232124811"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p12437124484"><a name="p12437124484"></a><a name="p12437124484"></a>cache</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p84377213482"><a name="p84377213482"></a><a name="p84377213482"></a>Lists the cache events supported by the PMU.</p>
</td>
</tr>
<tr id="row16442132104817"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1343716224819"><a name="p1343716224819"></a><a name="p1343716224819"></a>raw</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p44372274819"><a name="p44372274819"></a><a name="p44372274819"></a>Lists the raw PMU events supported.</p>
</td>
</tr>
</tbody>
</table>
### Example<a name="section122129443486"></a>
List the hardware events supported by the PMU. The command also lists the events that are not supported by the PMU.
```
hiperf list hw
event not support hw-stalled-cycles-backend
event not support hw-stalled-cycles-frontend
event not support hw-ref-cpu-cycles
Supported events for hardware:
hw-cpu-cycles
hw-instructions
hw-cache-references
hw-cache-misses
hw-branch-instructions
hw-branch-misses
hw-bus-cycles
```
## stat<a name="section12940163061016"></a>
### Parameters<a name="section36541920145018"></a>
The **stat** command monitors the specified application and periodically prints the values of performance counters.
```
hiperf stat [options]
Collect performance counter information.
```
<a name="table181891426171117"></a>
<table><thead align="left"><tr id="row618932661119"><th class="cellrowborder" valign="top" width="49.94%" id="mcps1.1.3.1.1"><p id="p107231837131118"><a name="p107231837131118"></a><a name="p107231837131118"></a>Parameter</p>
</th>
<th class="cellrowborder" valign="top" width="50.06%" id="mcps1.1.3.1.2"><p id="p12723143721114"><a name="p12723143721114"></a><a name="p12723143721114"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row271743271111"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p37071332131112"><a name="p37071332131112"></a><a name="p37071332131112"></a>-a</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p36451134216"><a name="p36451134216"></a><a name="p36451134216"></a>Collects the values of all threads and default performance counters of the system.</p>
</td>
</tr>
<tr id="row071733271113"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p1870773214115"><a name="p1870773214115"></a><a name="p1870773214115"></a>-c</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p147074321111"><a name="p147074321111"></a><a name="p147074321111"></a>Specifies the IDs of the CPUs to monitor. Use commas (,) to separate multiple CPU IDs, for example <strong id="b88710447518"><a name="b88710447518"></a><a name="b88710447518"></a>0,1,2</strong>.</p>
</td>
</tr>
<tr id="row13717103217111"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p15707153214114"><a name="p15707153214114"></a><a name="p15707153214114"></a>-d &lt;<em id="i49311018174719"><a name="i49311018174719"></a><a name="i49311018174719"></a>sec</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p117073321117"><a name="p117073321117"></a><a name="p117073321117"></a>Specifies the monitoring period, in seconds.</p>
</td>
</tr>
<tr id="row207174327118"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p147074320115"><a name="p147074320115"></a><a name="p147074320115"></a>-i &lt;<em id="i1889952124717"><a name="i1889952124717"></a><a name="i1889952124717"></a>ms</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p13707173261112"><a name="p13707173261112"></a><a name="p13707173261112"></a>Specifies the interval for printing the monitored events, in milliseconds.</p>
</td>
</tr>
<tr id="row12717132161112"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p157071532161119"><a name="p157071532161119"></a><a name="p157071532161119"></a>-e</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p16443201119320"><a name="p16443201119320"></a><a name="p16443201119320"></a>Specifies the events to monitor. You can run the <strong id="b9161172815551"><a name="b9161172815551"></a><a name="b9161172815551"></a>list</strong> command to list all the events supported. <strong id="b111611225613"><a name="b111611225613"></a><a name="b111611225613"></a>event:u</strong> indicates an event in the user space, and <strong id="b2282748195610"><a name="b2282748195610"></a><a name="b2282748195610"></a>event:k</strong> indicates an event in the kernel space.</p>
</td>
</tr>
<tr id="row15717143220113"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p7707203221119"><a name="p7707203221119"></a><a name="p7707203221119"></a>-g</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p20870204817311"><a name="p20870204817311"></a><a name="p20870204817311"></a>Specifies a group of events to monitor. The events in the same group are monitored by the same PMU.</p>
</td>
</tr>
<tr id="row1071703213119"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p87071432101115"><a name="p87071432101115"></a><a name="p87071432101115"></a>--no-inherit</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p13323958634"><a name="p13323958634"></a><a name="p13323958634"></a>Leaves the sub-threads of the target thread or process not monitored.</p>
</td>
</tr>
<tr id="row18717113261118"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p17708123215111"><a name="p17708123215111"></a><a name="p17708123215111"></a>-p</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p1270803261116"><a name="p1270803261116"></a><a name="p1270803261116"></a>Specifies the process IDs (PIDs) to monitor.</p>
</td>
</tr>
<tr id="row471793281116"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p0708532191110"><a name="p0708532191110"></a><a name="p0708532191110"></a>-t</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p47081632101118"><a name="p47081632101118"></a><a name="p47081632101118"></a>Specifies the thread IDs (TIDs) to monitor.</p>
</td>
</tr>
<tr id="row1471616324115"><td class="cellrowborder" valign="top" width="49.94%" headers="mcps1.1.3.1.1 "><p id="p870883210110"><a name="p870883210110"></a><a name="p870883210110"></a>--verbose</p>
</td>
<td class="cellrowborder" valign="top" width="50.06%" headers="mcps1.1.3.1.2 "><p id="p137083323111"><a name="p137083323111"></a><a name="p137083323111"></a>Displays detailed report, including raw time data.</p>
</td>
</tr>
</tbody>
</table>
### Example<a name="section1132495515502"></a>
Monitor the entire system for 3 seconds.
```
hiperf stat -d 3 -a
this is root mode, perfEventParanoid assume as -1
Start Profiling...
Timeout exit (total 3009 ms)
count name | comment | coverage
132523 hw-branch-instructions | 15.750 M/sec | (100%)
62554 hw-branch-misses | 47.202372% miss rate | (100%)
6994768 hw-cpu-cycles | 0.832068 GHz | (100%)
1237627 hw-instructions | 5.651758 cycles per instruction | (100%)
248 sw-context-switches | 29.959 K/sec | (100%)
0 sw-page-faults | 0.000 /sec | (100%)
9402580 sw-task-clock | 0.002758 cpus used | (100%)
```
### Field Description<a name="section1958985055118"></a>
<a name="table6123145517124"></a>
<table><thead align="left"><tr id="row2123755101216"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p75490001315"><a name="p75490001315"></a><a name="p75490001315"></a>Field</p>
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p4549600137"><a name="p4549600137"></a><a name="p4549600137"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row127291156151218"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p672420567127"><a name="p672420567127"></a><a name="p672420567127"></a>count</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p47259563126"><a name="p47259563126"></a><a name="p47259563126"></a>Indicates the times that an event occurred.</p>
</td>
</tr>
<tr id="row20729165611219"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p97258561122"><a name="p97258561122"></a><a name="p97258561122"></a>name</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p10725756151210"><a name="p10725756151210"></a><a name="p10725756151210"></a>Indicates the event name. You can run the <strong id="b1275144172219"><a name="b1275144172219"></a><a name="b1275144172219"></a>list</strong> command to list all the supported events. <strong id="b146319013236"><a name="b146319013236"></a><a name="b146319013236"></a>hw</strong> stands for hardware, and <strong id="b21781210132315"><a name="b21781210132315"></a><a name="b21781210132315"></a>sw</strong> stands for software.</p>
</td>
</tr>
<tr id="row4729056121212"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1572511564124"><a name="p1572511564124"></a><a name="p1572511564124"></a>comment</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p972514566125"><a name="p972514566125"></a><a name="p972514566125"></a>Provides values calculated from those in the <strong id="b3976203310251"><a name="b3976203310251"></a><a name="b3976203310251"></a>Count</strong> column for easy understanding. For example, the CPU frequency (<strong id="b17911439162616"><a name="b17911439162616"></a><a name="b17911439162616"></a>hw-cpu-cycles</strong>) is converted to <strong id="b415132419274"><a name="b415132419274"></a><a name="b415132419274"></a>0.832068</strong> GHz from <strong id="b1471832922712"><a name="b1471832922712"></a><a name="b1471832922712"></a>6994768</strong>.</p>
</td>
</tr>
<tr id="row1772855651216"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1372575617129"><a name="p1372575617129"></a><a name="p1372575617129"></a>coverage</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p3725105621211"><a name="p3725105621211"></a><a name="p3725105621211"></a>Indicates the percentage of PMU resources occupied by the event. The number of events to be monitored by a PMU varies depending on the number of PMUs.</p>
</td>
</tr>
</tbody>
</table>
## record<a name="section168751927524"></a>
### Parameters<a name="section113617912522"></a>
The **record** command samples the specified application and saves the sampling data to a file \(**perf.data** by default\).
```
hiperf record [options]
Collect performance sampling information.
```
<a name="table1567661165313"></a>
<table><thead align="left"><tr id="row196764115319"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p139171022105315"><a name="p139171022105315"></a><a name="p139171022105315"></a>Parameter</p>
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p10917152255310"><a name="p10917152255310"></a><a name="p10917152255310"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row2374121795310"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p935011178536"><a name="p935011178536"></a><a name="p935011178536"></a>-a</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p835041795311"><a name="p835041795311"></a><a name="p835041795311"></a>Samples all processes and threads in the system.</p>
</td>
</tr>
<tr id="row19374181715539"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p19350517105316"><a name="p19350517105316"></a><a name="p19350517105316"></a>--exclude-hiperf</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p2035071717539"><a name="p2035071717539"></a><a name="p2035071717539"></a>Leaves the hiperf process not sampled.</p>
</td>
</tr>
<tr id="row6374181711530"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p193501717185315"><a name="p193501717185315"></a><a name="p193501717185315"></a>-c</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p8350117145310"><a name="p8350117145310"></a><a name="p8350117145310"></a>Specifies the IDs of the CPUs to sample.</p>
</td>
</tr>
<tr id="row33741417105318"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1635011765316"><a name="p1635011765316"></a><a name="p1635011765316"></a>--cpu-limit &lt;<em id="i429116498571"><a name="i429116498571"></a><a name="i429116498571"></a>percent</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p0350171719531"><a name="p0350171719531"></a><a name="p0350171719531"></a>Specifies the maximum percentage of CPU resources occupied by the sampling.</p>
</td>
</tr>
<tr id="row123746177535"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p83505174536"><a name="p83505174536"></a><a name="p83505174536"></a>-d &lt;sec&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p73502017145313"><a name="p73502017145313"></a><a name="p73502017145313"></a>Specifies the sampling duration, in seconds.</p>
</td>
</tr>
<tr id="row1137461711531"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p33501817145317"><a name="p33501817145317"></a><a name="p33501817145317"></a>-f &lt;freq&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p144811511083"><a name="p144811511083"></a><a name="p144811511083"></a>Specifies how often a sampling event is triggered. The default value is 4000 times/second.</p>
<p id="p1035001711532"><a name="p1035001711532"></a><a name="p1035001711532"></a>Note: A higher value indicates heavier CPU load but more sampling data.</p>
</td>
</tr>
<tr id="row133741117145317"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p43505177537"><a name="p43505177537"></a><a name="p43505177537"></a>--period &lt;<em id="i993545255714"><a name="i993545255714"></a><a name="i993545255714"></a>num</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p5350131725316"><a name="p5350131725316"></a><a name="p5350131725316"></a>Specifies the number of occurrence times of an event that triggers a sampling. That is, a sampling is performed once when the event occurs the specified number of times.</p>
</td>
</tr>
<tr id="row837331711539"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1635110175534"><a name="p1635110175534"></a><a name="p1635110175534"></a>-e</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p20351171713531"><a name="p20351171713531"></a><a name="p20351171713531"></a>Specifies the events to monitor. You can run the <strong id="b176932255522"><a name="b176932255522"></a><a name="b176932255522"></a>list</strong> command to list all the events supported. <strong id="b2693625205220"><a name="b2693625205220"></a><a name="b2693625205220"></a>event:u</strong> indicates an event in the user space, and <strong id="b14693225145212"><a name="b14693225145212"></a><a name="b14693225145212"></a>event:k</strong> indicates an event in the kernel space.</p>
</td>
</tr>
<tr id="row3373517175310"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p2035151715533"><a name="p2035151715533"></a><a name="p2035151715533"></a>-g</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p335181718535"><a name="p335181718535"></a><a name="p335181718535"></a>Specifies a group of events to monitor. The events in the same group are monitored by the same PMU.</p>
</td>
</tr>
<tr id="row16373151725318"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1735141745318"><a name="p1735141745318"></a><a name="p1735141745318"></a>--no-inherit</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p17351121712533"><a name="p17351121712533"></a><a name="p17351121712533"></a>Leaves the sub-threads of the target thread or process not monitored.</p>
</td>
</tr>
<tr id="row837312172537"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p163511178534"><a name="p163511178534"></a><a name="p163511178534"></a>-p</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p535119176531"><a name="p535119176531"></a><a name="p535119176531"></a>Specifies the processes to monitor.</p>
</td>
</tr>
<tr id="row11373181711531"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p4351017195310"><a name="p4351017195310"></a><a name="p4351017195310"></a>-t</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1735111716534"><a name="p1735111716534"></a><a name="p1735111716534"></a>Specifies the threads to monitor.</p>
</td>
</tr>
<tr id="row193733174531"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p635171735314"><a name="p635171735314"></a><a name="p635171735314"></a>--offcpu</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p23511017135310"><a name="p23511017135310"></a><a name="p23511017135310"></a>Monitors the CPU scheduling event, which is equivalent to the <strong id="b83471327125516"><a name="b83471327125516"></a><a name="b83471327125516"></a>--period 1 -e sched:sched_switch</strong> event.</p>
</td>
</tr>
<tr id="row7373151705310"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p13351111735313"><a name="p13351111735313"></a><a name="p13351111735313"></a>-j &lt;<em id="i193621459165712"><a name="i193621459165712"></a><a name="i193621459165712"></a>branch_filter1</em>&gt;[,<em id="i153235212585"><a name="i153235212585"></a><a name="i153235212585"></a>branch_filter2</em>]...</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p15351217125317"><a name="p15351217125317"></a><a name="p15351217125317"></a>Monitors the branch prediction events. Branch prediction tries to predict the next instruction to be executed if there are multiple <strong id="b1515010251521"><a name="b1515010251521"></a><a name="b1515010251521"></a>if else</strong> conditions.</p>
</td>
</tr>
<tr id="row337311178535"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p635151711536"><a name="p635151711536"></a><a name="p635151711536"></a>-s / --call-stack <span>&lt;</span><em id="i8524129115816"><a name="i8524129115816"></a><a name="i8524129115816"></a>fp \| dwarf[,size]</em><span>&gt;</span></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p14351111735316"><a name="p14351111735316"></a><a name="p14351111735316"></a>Sets the user stack unwinding mode, which can be <strong id="b99242538156"><a name="b99242538156"></a><a name="b99242538156"></a>fp</strong> or <strong id="b18703165914151"><a name="b18703165914151"></a><a name="b18703165914151"></a>dwarf</strong>. If <strong id="b293334361618"><a name="b293334361618"></a><a name="b293334361618"></a>dwarf</strong> is used, you can specify the size of the user stack to be sampled. The default value is <strong id="b162942143188"><a name="b162942143188"></a><a name="b162942143188"></a>65528</strong>.</p>
</td>
</tr>
<tr id="row73731817145318"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p13351171714534"><a name="p13351171714534"></a><a name="p13351171714534"></a>--delay-unwind</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1135112171532"><a name="p1135112171532"></a><a name="p1135112171532"></a>Delays the stack unwinding till the sampling is complete.</p>
</td>
</tr>
<tr id="row12373151717534"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p6351161714534"><a name="p6351161714534"></a><a name="p6351161714534"></a>--disable-unwind</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p17351717115317"><a name="p17351717115317"></a><a name="p17351717115317"></a>Disables stack unwinding. The user register and stack data is stored in <strong id="b628502918229"><a name="b628502918229"></a><a name="b628502918229"></a>perf.data</strong> for offline stack unwinding.</p>
</td>
</tr>
<tr id="row133738178538"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1935118178535"><a name="p1935118178535"></a><a name="p1935118178535"></a>--disable-callstack-expend</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p335171745314"><a name="p335171745314"></a><a name="p335171745314"></a>Disables the unwound call stack information from being combined or extended.</p>
</td>
</tr>
<tr id="row1237310179537"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p193511917175314"><a name="p193511917175314"></a><a name="p193511917175314"></a>--clockid &lt;<em id="i75341226145817"><a name="i75341226145817"></a><a name="i75341226145817"></a>clock type</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p7351717115312"><a name="p7351717115312"></a><a name="p7351717115312"></a>Sets the clock source for the sampling data. The options are <strong id="b11324454271"><a name="b11324454271"></a><a name="b11324454271"></a>monotonic</strong>, <strong id="b2095984822716"><a name="b2095984822716"></a><a name="b2095984822716"></a>boottime</strong>, and <strong id="b173918568274"><a name="b173918568274"></a><a name="b173918568274"></a>realtime</strong>.</p>
</td>
</tr>
<tr id="row23721173538"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p135131765311"><a name="p135131765311"></a><a name="p135131765311"></a>--symbol-dir <span>&lt;</span><em id="i1766243012586"><a name="i1766243012586"></a><a name="i1766243012586"></a>dir</em><span>&gt;</span></p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1351181716532"><a name="p1351181716532"></a><a name="p1351181716532"></a>Specifies the directory of the symbol table. The specified symbol table will be preferentially used in stack unwinding.</p>
</td>
</tr>
<tr id="row137221711533"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p63521317135315"><a name="p63521317135315"></a><a name="p63521317135315"></a>-m &lt;<em id="i164097384583"><a name="i164097384583"></a><a name="i164097384583"></a>mmap pages</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p33521617165316"><a name="p33521617165316"></a><a name="p33521617165316"></a>Specifies the cache size, in pages. The default value is <strong id="b1541914432911"><a name="b1541914432911"></a><a name="b1541914432911"></a>1024</strong>. The parameter value must be a power of <strong id="b1731417117306"><a name="b1731417117306"></a><a name="b1731417117306"></a>2</strong>. The value range is [2 - 1024].</p>
<p id="p18627133351018"><a name="p18627133351018"></a><a name="p18627133351018"></a>Note: A higher value indicates a lower event loss rate but higher memory usage.</p>
</td>
</tr>
<tr id="row1337251716532"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p153521617175310"><a name="p153521617175310"></a><a name="p153521617175310"></a>--app &lt;<em id="i45101646195814"><a name="i45101646195814"></a><a name="i45101646195814"></a>package name</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1035251755316"><a name="p1035251755316"></a><a name="p1035251755316"></a>Specifies the bundle name of the target application to be sampled. The default timeout interval is 10 seconds. If the specified application does not exist, the hiperf process exits after 10 seconds.</p>
</td>
</tr>
<tr id="row037212176539"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p935251710537"><a name="p935251710537"></a><a name="p935251710537"></a>--data-limit &lt;<em id="i64491950175817"><a name="i64491950175817"></a><a name="i64491950175817"></a>SIZE[K|M|G]</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p135211718536"><a name="p135211718536"></a><a name="p135211718536"></a>Specifies the maximum size of the sampling result, in KB, MB, or GB. By default, there is no limit on the size.</p>
</td>
</tr>
<tr id="row8372517155320"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p43520171536"><a name="p43520171536"></a><a name="p43520171536"></a>-o &lt;<em id="i1953785410587"><a name="i1953785410587"></a><a name="i1953785410587"></a>output file name</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p935241711539"><a name="p935241711539"></a><a name="p935241711539"></a>Specifies the name of the sampling result file. It is <strong id="b1714216402339"><a name="b1714216402339"></a><a name="b1714216402339"></a>/data/local/tmp/perf.data</strong> by default.</p>
</td>
</tr>
<tr id="row113721417105317"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p335251714534"><a name="p335251714534"></a><a name="p335251714534"></a>-z</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p10352117175319"><a name="p10352117175319"></a><a name="p10352117175319"></a>Saves the output file in .gzip format.</p>
</td>
</tr>
<tr id="row12372111735310"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p335211755313"><a name="p335211755313"></a><a name="p335211755313"></a>--verbose</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p63529178537"><a name="p63529178537"></a><a name="p63529178537"></a>Displays detailed log information during sampling.</p>
</td>
</tr>
</tbody>
</table>
### Example<a name="section15998181516549"></a>
- Sample all processes in the system for 3 seconds and display detailed log information during the sampling process.
```
hiperf record -d 3 -a --verbose
```
- Enable stack unwinding in fp mode.
```
hiperf record -s fp -d 3 -a
```
- Enable stack unwinding in dwarf mode.
```
hiperf record -s dwarf -d 3 -a
```
- Sample offcpu events.
```
hiperf record --offcpu -s dwarf -d 3 -a
```
- Delay stack unwinding.
```
hiperf record -d 3 -s dwarf --delay-unwind -a
```
- Disable stack unwinding. In this case, the stack data is saved to the **perf.data** file.
```
hiperf record -d 3 -s dwarf --disable-unwind -a
```
- Monitor the **com.ohos.launch** application. The hiperf process exits after 10 seconds if the process corresponding to the specified bundle name does not exist.
```
hiperf record -d 3 -s dwarf --app com.ohos.launch
```
- Compress the sampling results.
```
hiperf record -z -s dwarf -d 3 -a
```
## report<a name="section16327635174818"></a>
The **report** command displays the sampling data that is captured by using **record**.
```
hiperf report [option]
Report sampling information from perf.data.
```
<a name="table1243113226513"></a>
<table><thead align="left"><tr id="row1843211222514"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p1448719421464"><a name="p1448719421464"></a><a name="p1448719421464"></a>Parameter</p>
</th>
<th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p194878425612"><a name="p194878425612"></a><a name="p194878425612"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row0432622150"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p11487154216619"><a name="p11487154216619"></a><a name="p11487154216619"></a>--symbol-dir &lt;<em id="i102111819165910"><a name="i102111819165910"></a><a name="i102111819165910"></a>dir</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p174873421063"><a name="p174873421063"></a><a name="p174873421063"></a>Specifies the directory of the symbol table.</p>
</td>
</tr>
<tr id="row9432132216517"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p144878421961"><a name="p144878421961"></a><a name="p144878421961"></a>--limit-percent &lt;<em id="i250122135915"><a name="i250122135915"></a><a name="i250122135915"></a>number</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p14487184216619"><a name="p14487184216619"></a><a name="p14487184216619"></a>Specifies the minimum percentage of the result to display. The result that is lower than the minimum percentage is not displayed.</p>
</td>
</tr>
<tr id="row1443213226513"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p848717421064"><a name="p848717421064"></a><a name="p848717421064"></a>-s / --call-stack</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p17487042965"><a name="p17487042965"></a><a name="p17487042965"></a>Displays detailed call stack information.</p>
</td>
</tr>
<tr id="row13432622458"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p6487164214611"><a name="p6487164214611"></a><a name="p6487164214611"></a>--call-stack-limit-percent &lt;<em id="i1900525135916"><a name="i1900525135916"></a><a name="i1900525135916"></a>number</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p194879426610"><a name="p194879426610"></a><a name="p194879426610"></a>Specifies the minimum percentage of the call stack to display. The call stack that is lower than the minimum percentage is not displayed.</p>
</td>
</tr>
<tr id="row243210221517"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1248754220618"><a name="p1248754220618"></a><a name="p1248754220618"></a>--proto</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p174877426611"><a name="p174877426611"></a><a name="p174877426611"></a>Converts the <strong id="b7360121984613"><a name="b7360121984613"></a><a name="b7360121984613"></a>perf.data</strong> file into the proto format. The default file name is <strong id="b255114336468"><a name="b255114336468"></a><a name="b255114336468"></a>perf.proto</strong>.</p>
</td>
</tr>
<tr id="row1432122152"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p24878421618"><a name="p24878421618"></a><a name="p24878421618"></a>--json</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p048720421068"><a name="p048720421068"></a><a name="p048720421068"></a>Converts the <strong id="b10736748154614"><a name="b10736748154614"></a><a name="b10736748154614"></a>perf.data</strong> file into the JSON format. The default file name is <strong id="b12526557144615"><a name="b12526557144615"></a><a name="b12526557144615"></a>perf.json</strong>.</p>
</td>
</tr>
<tr id="row3432322251"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p3487142164"><a name="p3487142164"></a><a name="p3487142164"></a>--branch</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p13487942561"><a name="p13487942561"></a><a name="p13487942561"></a>Displays the report based on the branch prediction result address instead of the IP address of the call stack.</p>
</td>
</tr>
<tr id="row3428154963"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p64875421869"><a name="p64875421869"></a><a name="p64875421869"></a>--&lt;<em id="i2792933155916"><a name="i2792933155916"></a><a name="i2792933155916"></a>keys</em>&gt; &lt;<em id="i49299369598"><a name="i49299369598"></a><a name="i49299369598"></a>keyname1</em>&gt;[,<em id="i22921440185914"><a name="i22921440185914"></a><a name="i22921440185914"></a>keyname2</em>][,...]</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p14871342165"><a name="p14871342165"></a><a name="p14871342165"></a>Filters and displays reports based on the given keywords. <strong id="b1718471815494"><a name="b1718471815494"></a><a name="b1718471815494"></a>keys</strong> can be <strong id="b652162620493"><a name="b652162620493"></a><a name="b652162620493"></a>comms</strong>, <strong id="b1926582944916"><a name="b1926582944916"></a><a name="b1926582944916"></a>pids</strong>, and <strong id="b12471434134911"><a name="b12471434134911"></a><a name="b12471434134911"></a>tids</strong>. For example, <strong id="b1794418482490"><a name="b1794418482490"></a><a name="b1794418482490"></a>--comms hiperf,hilog</strong> displays only the records whose process or thread name is <strong id="b195761830195014"><a name="b195761830195014"></a><a name="b195761830195014"></a>hiperf</strong> or <strong id="b2036334115014"><a name="b2036334115014"></a><a name="b2036334115014"></a>hilog</strong>.</p>
</td>
</tr>
<tr id="row16770181015614"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p144875424619"><a name="p144875424619"></a><a name="p144875424619"></a>--sort &lt;<em id="i3355743195911"><a name="i3355743195911"></a><a name="i3355743195911"></a>key1</em>&gt;[,<em id="i13850184612590"><a name="i13850184612590"></a><a name="i13850184612590"></a>key2</em>][,...]</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p94870428610"><a name="p94870428610"></a><a name="p94870428610"></a>Sorts and displays information based on specified keywords, such as <strong id="b114664210512"><a name="b114664210512"></a><a name="b114664210512"></a>pid</strong>, <strong id="b319919248518"><a name="b319919248518"></a><a name="b319919248518"></a>tid</strong>, and <strong id="b1140053135118"><a name="b1140053135118"></a><a name="b1140053135118"></a>comm</strong>. Multiple keywords can be specified.</p>
</td>
</tr>
<tr id="row3442413567"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p14487174219619"><a name="p14487174219619"></a><a name="p14487174219619"></a>-i &lt;<em id="i1398985011592"><a name="i1398985011592"></a><a name="i1398985011592"></a>filename</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p948816422618"><a name="p948816422618"></a><a name="p948816422618"></a>Specifies the sampling data (<strong id="b165437587515"><a name="b165437587515"></a><a name="b165437587515"></a>perf.data</strong> by default).</p>
</td>
</tr>
<tr id="row112915190611"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p114885426613"><a name="p114885426613"></a><a name="p114885426613"></a>-o &lt;<em id="i2284165415591"><a name="i2284165415591"></a><a name="i2284165415591"></a>filename</em>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p74882421167"><a name="p74882421167"></a><a name="p74882421167"></a>Specifies the name of the report to output.</p>
</td>
</tr>
</tbody>
</table>
## Example<a name="section1197655116513"></a>
- Output the report of the sampling data \(**perf.data** by default\).
```
hiperf report
```
Output \(example\):
```
Heating count comm pid tid dso func
5.68% 15073949 hiperf_example_ 1085 1091 /system/lib/ld-musl-arm.so.1 malloc
2.57% 6834119 hiperf_example_ 1085 1091 [kernel.kallsyms] vector_swi
2.27% 6013910 hiperf_example_ 1085 1087 /system/lib/ld-musl-arm.so.1 malloc
2.19% 5805738 hiperf_example_ 1085 1091 /system/lib/ld-musl-arm.so.1 vfprintf
2.09% 5543362 hiperf_example_ 1085 1091 [kernel.kallsyms] ktime_get_ts64
report done
```
- Output the call stack report of the sampling data.
```
hiperf report -s
```
- Set the symbol table directory.
```
hiperf report -s --symbol-dir /data/local/tmp
```
- Display only the information containing **libutils.z.so**.
```
hiperf report --dsos libuitls.z.so
```
- Sort the result by **dso**.
```
hiperf report --sort dso
```
# 环境搭建常见问题
## 轻量和小型系统
### hb安装过程中出现乱码、段错误
- **现象描述**
执行“python3 -m pip install --user ohos-build”出现乱码、段错误(segmentation fault)。
- **可能原因**
pip版本过低。
- **解决办法**
执行如下命令升级pip。
```
python3 -m pip install -U pip
```
### hb安装过程中提示"cannot import 'sysconfig' from 'distutils'"
- **现象描述**
执行“python3 -m pip install --user ohos-build”提示"cannot import 'sysconfig' from 'distutils'"
- **可能原因**
缺少distutils模块。
- **解决办法**
执行如下命令安装。
```
sudo apt-get install python3.8-distutils
```
### hb安装过程中提示"module 'platform' has no attribute 'linux_distribution'"
- **现象描述**
执行“python3 -m pip install --user ohos-build”提示"module 'platform' has no attribute 'linux_distribution'"
- **可能原因**
python3 pip安装兼容性问题。
- **解决办法**
执行如下命令重新安装pip。
```
sudo apt remove python3-pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```
### hb安装过程中提示"Could not find a version that satisfies the requirement ohos-build"
- **现象描述**
执行“python3 -m pip install --user ohos-build”提示"Could not find a version that satisfies the requirement ohos-build"
- **可能原因**
可能是网络环境较差导致的安装失败。
- **解决办法**
1. 请检查网络连接是否正常。如果网络有问题,请修复网络问题后重新安装。
2. 若网络正常,请尝试指定临时pypi源的方式安装:
```
python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ohos-build
```
### 安装python3过程中,提示“configure: error: no acceptable C compiler found in $PATH”
- **现象描述**
安装python3过程中出现以下错误:
```
configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
```
- **可能原因**
环境中未安装“gcc”。
- **解决办法**
1. 通过命令“apt-get install gcc”在线安装。
2. 完成后,重新安装python3。
### 安装python3过程中,提示“-bash: make: command not found”
- **现象描述**
安装python3过程中出现以下错误:
```
-bash: make: command not found
```
- **可能原因**
环境中未安装“make”。
- **解决办法**
1. 通过命令“apt-get install make”在线安装。
2. 完成后,重新安装python3。
### 安装python3过程中,提示“zlib not available”
- **现象描述**
安装python3过程中出现以下错误:
```
zipimport.ZipImportError: can't decompress data; zlib not available
```
- **可能原因**
环境中未安装“zlib”。
- **解决办法**
方法1:通过命令“apt-get install zlib”在线安装。
方法2:如果软件源中没有该软件,请从“www.zlib.net”下载版本代码,并离线安装。
![zh-cn_image_0000001198001086](figures/zh-cn_image_0000001198001086.png)
完成下载后,通过以下命令安装:
```
# tar xvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
```
完成后,重新安装python3。
### 编译构建过程中,提示“No module named 'Crypto'”
- **现象描述**
编译构建过程中出现以下错误:
```
ModuleNotFoundError: No module named 'Crypto'
```
- **可能原因**
环境中未安装“Crypto”。
- **解决办法**
方法1:通过命令“pip3 install Crypto”,在线安装。
方法2:离线安装。
通过网页[https://pypi.org/project/pycrypto/#files](https://pypi.org/project/pycrypto/#files),下载源码。
![zh-cn_image_0000001251196005](figures/zh-cn_image_0000001251196005.png)
将源码放置在Linux服务器中,解压,并安装“python3 setup.py install”。
完成上述安装后,重新构建。
### 安装kconfiglib时,遇到lsb_release错误
- **现象描述**
安装kconfiglib过程中遇到如下错误打印:
```
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
```
- **可能原因**
lsb_release模块基于的python版本与现有python版本不一致。
- **解决办法**
执行"find / -name lsb_release",找到lsb_release位置并删除,如:"sudo rm -rf /usr/bin/lsb_release"。
### Linux编译服务器终端输入不识别的命令时提示“ImportError: No module named apt_pkg”
- **现象描述**
Linux编译服务器终端输入不识别的命令时,提示"ImportError: No module named apt_pkg"
- **可能原因**
python3 apt安装兼容性问题。
- **解决办法**
执行如下命令重新安装python3-apt。
```
sudo apt-get remove python3-apt
sudo apt-get install python3-apt
```
# 移植常见问题<a name="ZH-CN_TOPIC_0000001215769367"></a>
- [如何将用户的堆内存挂载进内核](#section21471536184914)
## 如何将用户的堆内存挂载进内核<a name="section21471536184914"></a>
- 内核堆内存配置的相关宏如下,用户可根据实际情况,在target\_config.h中配置:
**表 1** 内核堆内存配置相关宏
<a name="zh-cn_topic_0000001153683024_table04172020563"></a>
<table><thead align="left"><tr id="zh-cn_topic_0000001153683024_row5462035616"><th class="cellrowborder" valign="top" width="39.12%" id="mcps1.2.3.1.1"><p id="zh-cn_topic_0000001153683024_p1456204569"><a name="zh-cn_topic_0000001153683024_p1456204569"></a><a name="zh-cn_topic_0000001153683024_p1456204569"></a>宏名称</p>
</th>
<th class="cellrowborder" valign="top" width="60.88%" id="mcps1.2.3.1.2"><p id="zh-cn_topic_0000001153683024_p19502005618"><a name="zh-cn_topic_0000001153683024_p19502005618"></a><a name="zh-cn_topic_0000001153683024_p19502005618"></a>描述</p>
</th>
</tr>
</thead>
<tbody><tr id="zh-cn_topic_0000001153683024_row14522018560"><td class="cellrowborder" valign="top" width="39.12%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001153683024_p35112025620"><a name="zh-cn_topic_0000001153683024_p35112025620"></a><a name="zh-cn_topic_0000001153683024_p35112025620"></a>LOSCFG_SYS_EXTERNAL_HEAP</p>
</td>
<td class="cellrowborder" valign="top" width="60.88%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001153683024_p5127138175710"><a name="zh-cn_topic_0000001153683024_p5127138175710"></a><a name="zh-cn_topic_0000001153683024_p5127138175710"></a>这个宏决定系统是使用内核的内部堆内存还是用户的堆内存,默认为0(即使用内部的堆内存),大小为0x10000;如果用户需要基于外部的堆内存,那么可以将该宏设置为1。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001153683024_row20514209567"><td class="cellrowborder" valign="top" width="39.12%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001153683024_p5532017563"><a name="zh-cn_topic_0000001153683024_p5532017563"></a><a name="zh-cn_topic_0000001153683024_p5532017563"></a>LOSCFG_SYS_HEAP_ADDR</p>
</td>
<td class="cellrowborder" valign="top" width="60.88%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001153683024_p65520125619"><a name="zh-cn_topic_0000001153683024_p65520125619"></a><a name="zh-cn_topic_0000001153683024_p65520125619"></a>内核堆内存的起始地址。</p>
</td>
</tr>
<tr id="zh-cn_topic_0000001153683024_row15302929115615"><td class="cellrowborder" valign="top" width="39.12%" headers="mcps1.2.3.1.1 "><p id="zh-cn_topic_0000001153683024_p113021529145612"><a name="zh-cn_topic_0000001153683024_p113021529145612"></a><a name="zh-cn_topic_0000001153683024_p113021529145612"></a>LOSCFG_SYS_HEAP_SIZE</p>
</td>
<td class="cellrowborder" valign="top" width="60.88%" headers="mcps1.2.3.1.2 "><p id="zh-cn_topic_0000001153683024_p1030252965619"><a name="zh-cn_topic_0000001153683024_p1030252965619"></a><a name="zh-cn_topic_0000001153683024_p1030252965619"></a>内核堆内存的大小,即LOSCFG_SYS_HEAP_ADDR指定的内存块大小。</p>
</td>
</tr>
</tbody>
</table>
- 注意事项:
指定的堆内存范围务必保证没有其他模块使用,避免踩内存,破坏堆内存功能。
# 启动恢复常见问题<a name="ZH-CN_TOPIC_0000001215449321"></a>
- [系统启动过程中打印“parse failed!”错误后停止启动](#section835662214302)
- [系统启动过程未结束就自动重启,如此反复持续](#section3857921143117)
- [参数正确的情况下调用SetParameter/GetParameter返回失败](#section548818116328)
## 系统启动过程中打印“parse failed!”错误后停止启动<a name="section835662214302"></a>
**现象描述**
系统启动过程中,打印“\[Init\] InitReadCfg, parse failed! please check file /etc/init.cfg format.”错误,启动过程停止,如下图所示:
**图 1** 运行报错图<a name="zh-cn_topic_0000001063231870_fig15217111545118"></a>
![](figures/运行报错图.png "运行报错图")
**可能原因**
修改init.cfg文件时,漏掉或多加了逗号或括号等,导致init.cfg文件的json格式被破坏。
**解决办法**
仔细检查init.cfg文件,确保其格式符合json格式要求。
## 系统启动过程未结束就自动重启,如此反复持续<a name="section3857921143117"></a>
**现象描述**
镜像烧写完成后系统启动,启动过程未完成即自动重新启动,如此反复持续。
**可能原因**
被init启动的服务都有一个叫做“importance”的属性(详见[第2章表3](../subsystems/subsys-boot-init.md)描述)。
- 当该属性为0时,表示若当前服务进程退出,init不需要重启单板。
- 当该属性为1时,表示若当前服务进程退出,init需要重启单板。
因此出现上述现象的可能原因:有“importance”属性为1的服务在每次启动的过程中都会退出(可能是进程崩溃或出错自动退出),导致init进程自动重启单板。
**解决办法**
1. 需要通过日志确认崩溃或报错退出的服务,并解决其崩溃/报错的问题,然后重新烧写镜像即可。
2. 也可以将崩溃/报错退出的服务的“importance”属性改为0,然后重新烧写镜像,这样即使其退出,init也不会重启单板。
## 参数正确的情况下调用SetParameter/GetParameter返回失败<a name="section548818116328"></a>
**现象描述**
在各参数正确的情况下调用SetParameter/GetParameter返回失败。
**可能原因**
程序对SetParameter/GetParameter这两个接口做了权限校验,在各参数正确的情况下调用SetParameter/GetParameter返回操作失败,很有可能是调用者的uid大于1000,没有调用权限。
**解决办法**
无需处理
# 系统应用常见问题<a name="ZH-CN_TOPIC_0000001169690992"></a>
- [公共基础库常见问题](#section639433461512)
- [1.LiteOS-A内核\(Hi3516、Hi3518平台\)KV存储路径设置错误,导致KV存储运行失败](#section16520347131511)
- [视觉应用常见问题](#section787718474161)
- [是否存在一个全局变量,所有的页面都可以访问?](#section187297991718)
- [如何获取dom中的元素](#section1833493719175)
- [如何在页面间传值?](#section184283812183)
- [list如何滚动到某个item?](#section11897734131811)
- [text支持多行吗?](#section5872656121814)
- [为什么控件不显示?](#section7397125317107)
- [如何实现页面滑动?](#section338794422010)
- [Left、Top为什么不生效?](#section2597193611217)
- [动态绑定为什么不生效?](#section6939050172115)
- [如何实现相对定位和绝对定位?](#section5547311192215)
- [如何控制控件的显示与隐藏?](#section16107113352213)
- [使用Margin时,有什么注意事项?](#section1524910142314)
- [使用事件订阅时,有什么注意事项?](#section1537132012231)
- [使用动态绑定时,有什么注意事项?](#section96561452236)
- [swiper loop属性如何生效?](#section690166112414)
- [使用数组时,有什么注意事项?](#section1554552822414)
- [hdc类问题](#section412357182518)
- [hdc\_std连接不到设备](#section1965012223257)
- [hdc\_std运行不了](#section1157575212515)
## 公共基础库常见问题<a name="section639433461512"></a>
### 1.LiteOS-A内核\(Hi3516、Hi3518平台\)KV存储路径设置错误,导致KV存储运行失败<a name="section16520347131511"></a>
**现象描述**
LiteOS-A内核\(Hi3516、Hi3518平台\)直接调用KV存储提供的接口,各参数正常的情况下,编译可执行程序运行失败。
**可能原因**
直接运行编译出的可执行文件,没有将程序基于AbilityKit转换成应用,不能由BMS在应用安装时正确设置应用数据存储路径,导致KV存储运行失败。
**解决办法**
显示调用KV存储的UtilsSetEnv接口,设置数据存储路径。
```
UtilsSetEnv("/storage/com.example.kv");
```
## 视觉应用常见问题<a name="section787718474161"></a>
### 是否存在一个全局变量,所有的页面都可以访问?<a name="section187297991718"></a>
当前框架中不存在所有Page都可以访问的全局变量。
### 如何获取dom中的元素<a name="section1833493719175"></a>
如何获取dom中的元素?
通过ref属性获取dom中的元素,详细示例如下图所示;获取的元素只能使用它的方法,不能改变属性。
```
<!--index.hml-->
<div class="container">
<!--指定组件的ref属性为animator-->
<image-animator class="image-player" ref="ainmator" images="{{images}}" duration="1s" onclick="handleClick"></image-animator>
</div>
/* index.js */
export default {
data: {
images:[
{src:"common/frame1.png"},
{src:"common/frame2.png"},
{src:"common/frame3.png"}
]
},
handleClick(){
//通过$refs属性获取对应的组件,在hml中,组件的ref属性要设置为animator
const animator = this.$refs.animator;
const state = animator.getState();
if(state == "paused"){
animator.resume();
}else if(state == "stopped"){
animator.start();
}else{
animator.pause();
}
}
}
```
### 如何在页面间传值?<a name="section184283812183"></a>
通过router.replace方法中的params参数来传递,参考代码如下:
第一个页面传递数据:
```
router.replace({
uri:'pages/detail/detail', //要跳转的页面uri
params:{transferData:this.data} //传递的数据,数据个数和名称开发者自己定义,
});
```
第二个界面接受数据:
```
onInit(){
const data = this.transferData; //在onInit函数中接受传递的数据
}
```
### list如何滚动到某个item?<a name="section11897734131811"></a>
通过list的scrollTo方法滚动到指定的item,参数是目标item的index。Index参数可以通过scrollend事件获取或者开发者指定。
### text支持多行吗?<a name="section5872656121814"></a>
text支持多行。通过回车键换行或者是不设置text的高度属性,由控件自动根据内容换行。
### 为什么控件不显示?<a name="section7397125317107"></a>
**现象描述**
开发者在hml文件中添加的控件无法显示
**可能原因**
- 未设置width和height值;
- 样式设置错误。
**处理步骤**
\(1\)检查是否设置width和height值,组件必须显式设置width和height值;
\(2\)检查组件的样式设置是否正确。
### 如何实现页面滑动?<a name="section338794422010"></a>
实现页面滑动目前有三种方式:scroll(根组件大小超过屏幕的大小即自动实现scroll效果)、list、swiper。开发者可以参考开发文档查看三者的区别,并加以使用。
### Left、Top为什么不生效?<a name="section2597193611217"></a>
除根节点外,Left、Top配合Stack组件使用才有效果。
### 动态绑定为什么不生效?<a name="section6939050172115"></a>
在进行绑定时,必须先将要绑定的对象或者对象的属性进行定义,不能先绑定后定义
### 如何实现相对定位和绝对定位?<a name="section5547311192215"></a>
使用div、stack(top left属性)来实现相对和绝对定位。
### 如何控制控件的显示与隐藏?<a name="section16107113352213"></a>
通过display、show和if来控制控件的显示与隐藏。区别在于:if为false时,组件会从VDOM中移除,而show仅是渲染时不可见,组件依然存在于VDOM中。
### 使用Margin时,有什么注意事项?<a name="section1524910142314"></a>
Stack组件不支持其子组件设置margin属性。
### 使用事件订阅时,有什么注意事项?<a name="section1537132012231"></a>
在应用运行期间只存在一个page,所以router.replace跳转是先销毁前一个页面,然后在新创建一个界面。因此,如果涉及到事件订阅的页面,每次页面创建时要进行事件订阅,跳转离开界面前取消事件订阅。
### 使用动态绑定时,有什么注意事项?<a name="section96561452236"></a>
过多的动态绑定会消耗较多的内存,若非业务需要,尽量不要使用太多的动态绑定。
### swiper loop属性如何生效?<a name="section690166112414"></a>
去掉第一个组件或者去掉最后一个组件,剩余的长度大于swiper长度,loop生效。
### 使用数组时,有什么注意事项?<a name="section1554552822414"></a>
数组元素不宜过多,尽量避免对大数组进行频繁操作。
## hdc类问题<a name="section412357182518"></a>
### hdc\_std连接不到设备<a name="section1965012223257"></a>
- **现象描述**
执行 "hdc\_std list targets"命令后结果为:\[Empty\]
- **解决方法**
1. 设备没有被识别:
在设备管理器中查看是否有hdc设备,在通用串行总线设备中会有“HDC Device”信息。如果没有,hdc无法连接。此时需要插拔设备,或者烧写最新的镜像。
2. hdc\_std工作异常:
可以执行"hdc kill"或者"hdc start -r"杀掉hdc服务或者重启hdc服务,然后再执行hdc list targets查看是否已经可以获取设备信息。
3. hdc\_std与设备不匹配:
如果设备烧写的是最新镜像,hdc\_std也需要使用最新版本。由于hdc\_std会持续更新,请从开源仓developtools\_hdc\_standard中获取,具体位置在该开源仓的prebuilt目录。
### hdc\_std运行不了<a name="section1157575212515"></a>
- **现象描述**
点击hdc\_std.exe文件无法运行。
- **解决方法**
hdc\_std.exe不需要安装,直接放到磁盘上就能使用,也可以添加到环境变量中。通过打开cmd执行hdc\_std命令直接使用。
# FAQ
- **[常见问题概述](faqs-overview.md)**
- **[环境搭建常见问题](faqs-environment-building.md)**
- **[编译构建子系统常见问题](faqs-building.md)**
- **[烧录常见问题](faqs-burning.md)**
- **[内核常见问题](faqs-kernel.md)**
- **[移植常见问题](faqs-transplant.md)**
- **[启动恢复常见问题](faqs-init.md)**
- **[系统应用常见问题](faqs-system-using.md)**
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册