|
WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
|

结构体 | |
| struct | PerfEventConfig |
| struct | PerfConfigAttr |
宏定义 | |
| #define | PERF_MAX_FILTER_TSKS 32 |
| #define | PERF_MAX_EVENT 7 |
| #define | PERF_MAX_CALLCHAIN_DEPTH 10 |
| #define | PERF_BUFFER_WATERMARK_ONE_N 2 |
| #define | LOS_ERRNO_PERF_STATUS_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x00) |
| #define | LOS_ERRNO_PERF_HW_INIT_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x01) |
| #define | LOS_ERRNO_PERF_TIMED_INIT_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x02) |
| #define | LOS_ERRNO_PERF_SW_INIT_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x03) |
| #define | LOS_ERRNO_PERF_BUF_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x04) |
| #define | LOS_ERRNO_PERF_INVALID_PMU LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x05) |
| #define | LOS_ERRNO_PERF_PMU_CONFIG_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x06) |
| #define | LOS_ERRNO_PERF_CONFIG_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x07) |
| #define | LOS_ERRNO_PERF_CONFIG_TASK_FILTER_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x08) |
| #define | LOS_ERRNO_PERF_INIT_NO_MEMERY LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x09) |
类型定义 | |
| typedef void(* | PERF_BUF_NOTIFY_HOOK) (void) |
| typedef void(* | PERF_BUF_FLUSH_HOOK) (void *addr, UINT32 size) |
枚举 | |
| enum | PerfStatus { PERF_UNINIT , PERF_STARTING , PERF_STARTED , PERF_STOPPING , PERF_STOPED } |
| enum | PerfEventType { PERF_EVENT_TYPE_HW , PERF_EVENT_TYPE_TIMED , PERF_EVENT_TYPE_SW , PERF_EVENT_TYPE_RAW , PERF_EVENT_TYPE_MAX } |
| enum | PmuHwId { PERF_COUNT_HW_CPU_CYCLES = 0 , PERF_COUNT_HW_INSTRUCTIONS , PERF_COUNT_HW_DCACHE_REFERENCES , PERF_COUNT_HW_DCACHE_MISSES , PERF_COUNT_HW_ICACHE_REFERENCES , PERF_COUNT_HW_ICACHE_MISSES , PERF_COUNT_HW_BRANCH_INSTRUCTIONS , PERF_COUNT_HW_BRANCH_MISSES , PERF_COUNT_HW_MAX } |
| enum | PmuTimedId { PERF_COUNT_CPU_CLOCK = 0 } |
| enum | PmuSwId { PERF_COUNT_SW_TASK_SWITCH = 1 , PERF_COUNT_SW_IRQ_RESPONSE , PERF_COUNT_SW_MEM_ALLOC , PERF_COUNT_SW_MUX_PEND , PERF_COUNT_SW_MAX } |
| enum | PerfSampleType { PERF_RECORD_CPU = 1U << 0 , PERF_RECORD_TID = 1U << 1 , PERF_RECORD_TYPE = 1U << 2 , PERF_RECORD_PERIOD = 1U << 3 , PERF_RECORD_TIMESTAMP = 1U << 4 , PERF_RECORD_IP = 1U << 5 , PERF_RECORD_CALLCHAIN = 1U << 6 } |
函数 | |
| UINT32 | LOS_PerfInit (void *buf, UINT32 size) |
| Init perf. | |
| void | LOS_PerfStart (UINT32 sectionId) |
| Start perf sampling. | |
| void | LOS_PerfStop (void) |
| Stop perf sampling. | |
| UINT32 | LOS_PerfConfig (PerfConfigAttr *attr) |
| Config perf parameters. | |
| UINT32 | LOS_PerfDataRead (CHAR *dest, UINT32 size) |
| Read data from perf sample data buffer. | |
| void | LOS_PerfNotifyHookReg (const PERF_BUF_NOTIFY_HOOK func) |
| Register perf sample data buffer water mark hook function. | |
| void | LOS_PerfFlushHookReg (const PERF_BUF_FLUSH_HOOK func) |
| Register perf sample data buffer flush hook function. | |
| UINT32 | LOS_PerfDeinit (void) |
| Deinit perf. | |
| #define LOS_ERRNO_PERF_BUF_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x04) |
Perf error code: Perf buffer init failed.
Value: 0x02002004
Solution: Check the buffer init size.
| #define LOS_ERRNO_PERF_CONFIG_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x07) |
Perf error code: Perf pmu config attr is null.
Value: 0x02002007
Solution: Check if the input params of attr is null.
| #define LOS_ERRNO_PERF_CONFIG_TASK_FILTER_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x08) |
Perf error code: Perf pmu config memcpy_s failed.
Value: 0x02002008
Solution: Check the validity of the memcpy_s parameter.
| #define LOS_ERRNO_PERF_HW_INIT_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x01) |
Perf error code: Hardware pmu init failed.
Value: 0x02002001
Solution: Check the pmu hwi irq.
| #define LOS_ERRNO_PERF_INIT_NO_MEMERY LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x09) |
Perf error code: Perf init failed due to no memory.
Value: 0x02002009
Solution: Check system memory usage or disable perf per-task mode to reduce memory usage.
| #define LOS_ERRNO_PERF_INVALID_PMU LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x05) |
Perf error code: Perf pmu type error.
Value: 0x02002005
Solution: Check whether the corresponding pmu is enabled in the menuconfig.
| #define LOS_ERRNO_PERF_PMU_CONFIG_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x06) |
Perf error code: Perf pmu config error.
Value: 0x02002006
Solution: Check the config attr of event id and event period and event number.
| #define LOS_ERRNO_PERF_STATUS_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x00) |
Perf error code: Bad status.
Value: 0x02002000
Solution: Follow the perf state machine.
| #define LOS_ERRNO_PERF_SW_INIT_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x03) |
Perf error code: Software pmu init failed.
Value: 0x02002003
Solution: Check the Perf software events init.
| #define LOS_ERRNO_PERF_TIMED_INIT_ERROR LOS_ERRNO_OS_ERROR(LOS_MOD_PERF, 0x02) |
Perf error code: Hrtimer init failed for hrtimer timed pmu init.
Value: 0x02002002
Solution: Check the Hrtimer init.
| #define PERF_BUFFER_WATERMARK_ONE_N 2 |
Perf sample data buffer's water mark 1/N.
| #define PERF_MAX_CALLCHAIN_DEPTH 10 |
Perf max backtrace depth.
| #define PERF_MAX_EVENT 7 |
Perf max sample event counter's number.
| #define PERF_MAX_FILTER_TSKS 32 |
Perf max sample filter task number.
| typedef void(* PERF_BUF_FLUSH_HOOK) (void *addr, UINT32 size) |
Define the type of the perf sample data buffer flush hook function.
| typedef void(* PERF_BUF_NOTIFY_HOOK) (void) |
Define the type of the perf sample data buffer water mark hook function.
| enum PerfEventType |
| enum PerfSampleType |
perf sample data types Config it through PerfConfigAttr->sampleType.
| enum PerfStatus |
| enum PmuHwId |
Common hardware pmu events
| enum PmuSwId |
| enum PmuTimedId |
| UINT32 LOS_PerfConfig | ( | PerfConfigAttr * | attr | ) |
Config perf parameters.
| attr | [IN] Address of a perf event attr struct. |
| LOS_ERRNO_PERF_STATUS_INVALID | Perf in a wrong status. |
| LOS_ERRNO_PERF_CONFIG_NULL | Attr is null. |
| LOS_ERRNO_PERF_INVALID_PMU | Config perf pmu with error type. |
| LOS_ERRNO_PERF_PMU_CONFIG_ERROR | Config perf events fail with invalid event id, event period or event number. |
| LOS_ERRNO_PERF_CONFIG_TASK_FILTER_ERROR | Config perf task filter fail with parameters invalid. |
| LOS_OK | Config success. |
Read data from perf sample data buffer.
| dest | [IN] The destination address. |
| size | [IN] Read size. |
| UINT32 | The really read bytes. |
| UINT32 LOS_PerfDeinit | ( | void | ) |
Deinit perf.
| None. |
| LOS_ERRNO_PERF_STATUS_INVALID | Perf in a wrong status. |
| LOS_OK | Perf Deinit success. |
| void LOS_PerfFlushHookReg | ( | const PERF_BUF_FLUSH_HOOK | func | ) |
Register perf sample data buffer flush hook function.
| func | [IN] Buffer flush hook function. |
| None. |
Init perf.
| buf | [IN] Pointer of sample data buffer; The validity of the buffer is guaranteed by the user. |
| size | [IN] Length of sample data buffer; |
| LOS_ERRNO_PERF_STATUS_INVALID | Perf in a wrong status. |
| LOS_ERRNO_PERF_HW_INIT_ERROR | Perf hardware pmu init fail. |
| LOS_ERRNO_PERF_TIMED_INIT_ERROR | Perf timed pmu init fail. |
| LOS_ERRNO_PERF_SW_INIT_ERROR | Perf software pmu init fail. |
| LOS_ERRNO_PERF_BUF_ERROR | Perf buffer init fail. |
| LOS_OK | Perf init success. |
| void LOS_PerfNotifyHookReg | ( | const PERF_BUF_NOTIFY_HOOK | func | ) |
Register perf sample data buffer water mark hook function.
| func | [IN] Buffer water mark hook function. |
| None. |
| void LOS_PerfStart | ( | UINT32 | sectionId | ) |
Start perf sampling.
| sectionId | [IN] Set the section id for marking this piece of data in the perf sample data buffer. |
| None. |
| void LOS_PerfStop | ( | void | ) |
Stop perf sampling.
| None. |
| None. |