更新日期: 2022/06/01 来源: https://gitee.com/weharmony/kernel_liteos_a_note
los_perf.c 文件参考

浏览源代码.

函数

LITE_OS_SEC_BSS SPIN_LOCK_INIT (g_perfSpin)
 
STATIC INLINE UINT64 OsPerfGetCurrTime (VOID)
 
STATIC UINT32 OsPmuInit (VOID)
 
STATIC UINT32 OsPerfConfig (PerfEventConfig *eventsCfg)
 
STATIC VOID OsPerfPrintCount (VOID)
 
STATIC INLINE VOID OsPerfPrintTs (VOID)
 
STATIC VOID OsPerfStart (VOID)
 
STATIC VOID OsPerfStop (VOID)
 
STATIC INLINE UINT32 OsPerfSaveIpInfo (CHAR *buf, IpInfo *info)
 
STATIC UINT32 OsPerfBackTrace (PerfBackTrace *callChain, UINT32 maxDepth, PerfRegs *regs)
 
STATIC INLINE UINT32 OsPerfSaveBackTrace (CHAR *buf, PerfBackTrace *callChain, UINT32 count)
 
STATIC UINT32 OsPerfCollectData (Event *event, PerfSampleData *data, PerfRegs *regs)
 
STATIC INLINE BOOL OsFilterId (UINT32 id, UINT32 *ids, UINT8 idsNr)
 
STATIC INLINE BOOL OsPerfFilter (UINT32 taskId, UINT32 processId)
 
STATIC INLINE UINT32 OsPerfParamValid (VOID)
 
STATIC UINT32 OsPerfHdrInit (UINT32 id)
 
VOID OsPerfUpdateEventCount (Event *event, UINT32 value)
 
VOID OsPerfHandleOverFlow (Event *event, PerfRegs *regs)
 
STATIC UINT32 OsPerfInit (VOID)
 
STATIC VOID PerfInfoDump (VOID)
 
STATIC INLINE VOID OsPerfSetFilterIds (UINT32 *dstIds, UINT8 *dstIdsNr, UINT32 *ids, UINT32 idsNr)
 
UINT32 LOS_PerfConfig (PerfConfigAttr *attr)
 Config perf parameters. 更多...
 
VOID LOS_PerfStart (UINT32 sectionId)
 Start perf sampling. 更多...
 
VOID LOS_PerfStop (VOID)
 Stop perf sampling. 更多...
 
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. 更多...
 
VOID OsPerfSetIrqRegs (UINTPTR pc, UINTPTR fp)
 
 LOS_MODULE_INIT (OsPerfInit, LOS_INIT_LEVEL_KMOD_EXTENDED)
 

变量

STATIC Pmug_pmu = NULL
 
STATIC PerfCB g_perfCb = {0}
 

函数说明

◆ LOS_MODULE_INIT()

LOS_MODULE_INIT ( OsPerfInit  ,
LOS_INIT_LEVEL_KMOD_EXTENDED   
)

◆ OsFilterId()

STATIC INLINE BOOL OsFilterId ( UINT32  id,
UINT32 ids,
UINT8  idsNr 
)

在文件 los_perf.c292 行定义.

293{
294 UINT32 i;
295 if (!idsNr) {
296 return TRUE;
297 }
298
299 for (i = 0; i < idsNr; i++) {
300 if (ids[i] == id) {
301 return TRUE;
302 }
303 }
304 return FALSE;
305}
unsigned int UINT32
Definition: los_typedef.h:57
这是这个函数的调用关系图:

◆ OsPerfBackTrace()

STATIC UINT32 OsPerfBackTrace ( PerfBackTrace callChain,
UINT32  maxDepth,
PerfRegs regs 
)

在文件 los_perf.c217 行定义.

218{
219 UINT32 count = BackTraceGet(regs->fp, (IpInfo *)(callChain->ip), maxDepth);
220 PRINT_DEBUG("backtrace depth = %u, fp = 0x%x\n", count, regs->fp);
221 return count;
222}
UINT32 BackTraceGet(UINTPTR regFP, IpInfo *callChain, UINT32 maxDepth)
Definition: los_exc.c:850
IpInfo ip[PERF_MAX_CALLCHAIN_DEPTH]
Definition: los_perf_pri.h:65
UINTPTR fp
Definition: los_perf_pri.h:60
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfCollectData()

STATIC UINT32 OsPerfCollectData ( Event event,
PerfSampleData data,
PerfRegs regs 
)

在文件 los_perf.c235 行定义.

236{
237 UINT32 size = 0;
238 UINT32 depth;
239 IpInfo pc = {0};
240 PerfBackTrace callChain = {0};
241 UINT32 sampleType = g_perfCb.sampleType;
242 CHAR *p = (CHAR *)data;
243
244 if (sampleType & PERF_RECORD_CPU) {
245 *(UINT32 *)(p + size) = ArchCurrCpuid();
246 size += sizeof(data->cpuid);
247 }
248
249 if (sampleType & PERF_RECORD_TID) {
250 *(UINT32 *)(p + size) = LOS_CurTaskIDGet();
251 size += sizeof(data->taskId);
252 }
253
254 if (sampleType & PERF_RECORD_PID) {
255 *(UINT32 *)(p + size) = LOS_GetCurrProcessID();
256 size += sizeof(data->processId);
257 }
258
259 if (sampleType & PERF_RECORD_TYPE) {
260 *(UINT32 *)(p + size) = event->eventId;
261 size += sizeof(data->eventId);
262 }
263
264 if (sampleType & PERF_RECORD_PERIOD) {
265 *(UINT32 *)(p + size) = event->period;
266 size += sizeof(data->period);
267 }
268
269 if (sampleType & PERF_RECORD_TIMESTAMP) {
270 *(UINT64 *)(p + size) = OsPerfGetCurrTime();
271 size += sizeof(data->time);
272 }
273
274 if (sampleType & PERF_RECORD_IP) {
275 OsGetUsrIpInfo(regs->pc, &pc);
276 size += OsPerfSaveIpInfo(p + size, &pc);
277 }
278
279 if (sampleType & PERF_RECORD_CALLCHAIN) {
280 depth = OsPerfBackTrace(&callChain, PERF_MAX_CALLCHAIN_DEPTH, regs);
281 size += OsPerfSaveBackTrace(p + size, &callChain, depth);
282 }
283
284 return size;
285}
@ PERF_RECORD_CALLCHAIN
Definition: perf.h:111
@ PERF_RECORD_TIMESTAMP
Definition: perf.h:109
@ PERF_RECORD_TYPE
Definition: perf.h:107
@ PERF_RECORD_TID
Definition: perf.h:106
@ PERF_RECORD_PID
Definition: perf.h:112
@ PERF_RECORD_CPU
Definition: perf.h:105
@ PERF_RECORD_IP
Definition: perf.h:110
@ PERF_RECORD_PERIOD
Definition: perf.h:108
LITE_OS_SEC_TEXT UINT32 LOS_CurTaskIDGet(VOID)
Obtain current running task ID.
Definition: los_task.c:331
BOOL OsGetUsrIpInfo(UINTPTR ip, IpInfo *info)
Definition: los_exc.c:804
STATIC INLINE UINT32 ArchCurrCpuid(VOID)
Definition: los_hw_cpu.h:168
STATIC INLINE UINT32 OsPerfSaveIpInfo(CHAR *buf, IpInfo *info)
Definition: los_perf.c:194
STATIC INLINE UINT64 OsPerfGetCurrTime(VOID)
Definition: los_perf.c:50
STATIC UINT32 OsPerfBackTrace(PerfBackTrace *callChain, UINT32 maxDepth, PerfRegs *regs)
Definition: los_perf.c:217
STATIC INLINE UINT32 OsPerfSaveBackTrace(CHAR *buf, PerfBackTrace *callChain, UINT32 count)
Definition: los_perf.c:224
STATIC PerfCB g_perfCb
Definition: los_perf.c:42
LITE_OS_SEC_TEXT UINT32 LOS_GetCurrProcessID(VOID)
获取当前进程的进程ID
Definition: los_process.c:2161
long unsigned int UINT64
Definition: los_typedef.h:66
char CHAR
Definition: los_typedef.h:63
UINT32 sampleType
Definition: los_perf_pri.h:119
UINTPTR pc
Definition: los_perf_pri.h:59
UINT32 processId
Definition: los_perf_pri.h:71
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfConfig()

STATIC UINT32 OsPerfConfig ( PerfEventConfig eventsCfg)

在文件 los_perf.c81 行定义.

82{
83 UINT32 i;
84 UINT32 ret;
85
86 g_pmu = OsPerfPmuGet(eventsCfg->type);
87 if (g_pmu == NULL) {
88 PRINT_ERR("perf config type error %u!\n", eventsCfg->type);
89 return LOS_ERRNO_PERF_INVALID_PMU;
90 }
91
92 UINT32 eventNum = MIN(eventsCfg->eventsNr, PERF_MAX_EVENT);
93
94 (VOID)memset_s(&g_pmu->events, sizeof(PerfEvent), 0, sizeof(PerfEvent));
95
96 for (i = 0; i < eventNum; i++) {
97 g_pmu->events.per[i].eventId = eventsCfg->events[i].eventId;
98 g_pmu->events.per[i].period = eventsCfg->events[i].period;
99 }
100 g_pmu->events.nr = i;
101 g_pmu->events.cntDivided = eventsCfg->predivided;
102 g_pmu->type = eventsCfg->type;
103
104 ret = g_pmu->config();
105 if (ret != LOS_OK) {
106 PRINT_ERR("perf config failed!\n");
107 (VOID)memset_s(&g_pmu->events, sizeof(PerfEvent), 0, sizeof(PerfEvent));
108 return LOS_ERRNO_PERF_PMU_CONFIG_ERROR;
109 }
110 return LOS_OK;
111}
STATIC Pmu * g_pmu
Definition: los_perf.c:41
Pmu * OsPerfPmuGet(UINT32 type)
Definition: perf_pmu.c:52
UINT32 period
Definition: los_perf_pri.h:90
UINT32 eventId
Definition: los_perf_pri.h:89
unsigned int period
Definition: perf.h:124
unsigned int eventsNr
Definition: perf.h:127
unsigned int eventId
Definition: perf.h:123
unsigned int type
Definition: perf.h:121
size_t predivided
Definition: perf.h:128
struct PerfEventConfig::@0 events[PERF_MAX_EVENT]
UINT8 nr
Definition: los_perf_pri.h:96
Event per[PERF_MAX_EVENT]
Definition: los_perf_pri.h:95
UINT8 cntDivided
Definition: los_perf_pri.h:97
PerfEvent events
Definition: los_perf_pri.h:102
UINT32(* config)(VOID)
Definition: los_perf_pri.h:103
enum PerfEventType type
Definition: los_perf_pri.h:101
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfFilter()

STATIC INLINE BOOL OsPerfFilter ( UINT32  taskId,
UINT32  processId 
)

在文件 los_perf.c307 行定义.

308{
309 return OsFilterId(taskId, g_perfCb.taskIds, g_perfCb.taskIdsNr) &&
311}
STATIC INLINE BOOL OsFilterId(UINT32 id, UINT32 *ids, UINT8 idsNr)
Definition: los_perf.c:292
UINT8 taskIdsNr
Definition: los_perf_pri.h:121
UINT32 taskIds[PERF_MAX_FILTER_TSKS]
Definition: los_perf_pri.h:120
UINT8 processIdsNr
Definition: los_perf_pri.h:123
UINT32 processIds[PERF_MAX_FILTER_TSKS]
Definition: los_perf_pri.h:122
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfGetCurrTime()

STATIC INLINE UINT64 OsPerfGetCurrTime ( VOID  )

在文件 los_perf.c50 行定义.

51{
52#ifdef LOSCFG_PERF_CALC_TIME_BY_TICK
53 return LOS_TickCountGet();
54#else
55 return HalClockGetCycles();
56#endif
57}
LITE_OS_SEC_TEXT_MINOR UINT64 LOS_TickCountGet(VOID)
获取自系统启动以来的Tick数
Definition: los_sys.c:82
UINT64 HalClockGetCycles(VOID)
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfHandleOverFlow()

VOID OsPerfHandleOverFlow ( Event event,
PerfRegs regs 
)

在文件 los_perf.c350 行定义.

351{
352 PerfSampleData data;
353 UINT32 len;
354
355 (VOID)memset_s(&data, sizeof(PerfSampleData), 0, sizeof(PerfSampleData));
357 len = OsPerfCollectData(event, &data, regs);
358 OsPerfOutputWrite((CHAR *)&data, len);
359 }
360}
STATIC UINT32 OsPerfCollectData(Event *event, PerfSampleData *data, PerfRegs *regs)
Definition: los_perf.c:235
STATIC INLINE BOOL OsPerfFilter(UINT32 taskId, UINT32 processId)
Definition: los_perf.c:307
UINT32 OsPerfOutputWrite(CHAR *data, UINT32 size)
Definition: perf_output.c:101
UINT8 needSample
Definition: los_perf_pri.h:124
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfHdrInit()

STATIC UINT32 OsPerfHdrInit ( UINT32  id)

在文件 los_perf.c330 行定义.

331{
332 PerfDataHdr head = {
333 .magic = PERF_DATA_MAGIC_WORD,
334 .sampleType = g_perfCb.sampleType,
335 .sectionId = id,
336 .eventType = g_pmu->type,
337 .len = sizeof(PerfDataHdr),
338 };
339 return OsPerfOutputWrite((CHAR *)&head, head.len);
340}
UINT32 magic
Definition: los_perf_pri.h:80
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfInit()

STATIC UINT32 OsPerfInit ( VOID  )

在文件 los_perf.c362 行定义.

363{
364 UINT32 ret;
365 if (g_perfCb.status != PERF_UNINIT) {
366 ret = LOS_ERRNO_PERF_STATUS_INVALID;
367 goto PERF_INIT_ERROR;
368 }
369
370 ret = OsPmuInit();
371 if (ret != LOS_OK) {
372 goto PERF_INIT_ERROR;
373 }
374
375 ret = OsPerfOutputInit(NULL, LOSCFG_PERF_BUFFER_SIZE);
376 if (ret != LOS_OK) {
377 ret = LOS_ERRNO_PERF_BUF_ERROR;
378 goto PERF_INIT_ERROR;
379 }
381PERF_INIT_ERROR:
382 return ret;
383}
@ PERF_UNINIT
Definition: los_perf.h:77
@ PERF_STOPPED
Definition: los_perf.h:79
STATIC UINT32 OsPmuInit(VOID)
Definition: los_perf.c:59
UINT32 OsPerfOutputInit(VOID *buf, UINT32 size)
Definition: perf_output.c:43
enum PerfStatus status
Definition: los_perf_pri.h:115
函数调用图:

◆ OsPerfParamValid()

STATIC INLINE UINT32 OsPerfParamValid ( VOID  )

在文件 los_perf.c313 行定义.

314{
315 UINT32 index;
316 UINT32 res = 0;
317
318 if (g_pmu == NULL) {
319 return 0;
320 }
321 PerfEvent *events = &g_pmu->events;
322 UINT32 eventNum = events->nr;
323
324 for (index = 0; index < eventNum; index++) {
325 res |= events->per[index].period;
326 }
327 return res;
328}
这是这个函数的调用关系图:

◆ OsPerfPrintCount()

STATIC VOID OsPerfPrintCount ( VOID  )

在文件 los_perf.c113 行定义.

114{
115 UINT32 index;
116 UINT32 intSave;
117 UINT32 cpuid = ArchCurrCpuid();
118
119 PerfEvent *events = &g_pmu->events;
120 UINT32 eventNum = events->nr;
121
122 PERF_LOCK(intSave);
123 for (index = 0; index < eventNum; index++) {
124 Event *event = &(events->per[index]);
125
126 /* filter out event counter with no event binded. */
127 if (event->period == 0) {
128 continue;
129 }
130 PRINT_EMG("[%s] eventType: 0x%x [core %u]: %llu\n", g_pmu->getName(event), event->eventId, cpuid,
131 event->count[cpuid]);
132 }
133 PERF_UNLOCK(intSave);
134}
CHAR *(* getName)(Event *event)
Definition: los_perf_pri.h:106
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfPrintTs()

STATIC INLINE VOID OsPerfPrintTs ( VOID  )

在文件 los_perf.c136 行定义.

137{
138#ifdef LOSCFG_PERF_CALC_TIME_BY_TICK
139 DOUBLE time = (g_perfCb.endTime - g_perfCb.startTime) * 1.0 / LOSCFG_BASE_CORE_TICK_PER_SECOND;
140#else
141 DOUBLE time = (g_perfCb.endTime - g_perfCb.startTime) * 1.0 / OS_SYS_CLOCK;
142#endif
143 PRINT_EMG("time used: %.6f(s)\n", time);
144}
double DOUBLE
Definition: los_typedef.h:62
UINT64 endTime
Definition: los_perf_pri.h:112
UINT64 startTime
Definition: los_perf_pri.h:111
time_t time(time_t *t)
Definition: time.c:1224
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfSaveBackTrace()

STATIC INLINE UINT32 OsPerfSaveBackTrace ( CHAR buf,
PerfBackTrace callChain,
UINT32  count 
)

在文件 los_perf.c224 行定义.

225{
226 UINT32 i;
227 *(UINT32 *)buf = count;
228 UINT32 size = sizeof(UINT32);
229 for (i = 0; i < count; i++) {
230 size += OsPerfSaveIpInfo(buf + size, &(callChain->ip[i]));
231 }
232 return size;
233}
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfSaveIpInfo()

STATIC INLINE UINT32 OsPerfSaveIpInfo ( CHAR buf,
IpInfo info 
)

在文件 los_perf.c194 行定义.

195{
196 UINT32 size = 0;
197#ifdef LOSCFG_KERNEL_VM
198 UINT32 len = ALIGN(info->len, sizeof(size_t));
199
200 *(UINTPTR *)buf = info->ip; /* save ip */
201 size += sizeof(UINTPTR);
202
203 *(UINT32 *)(buf + size) = len; /* save f_path length */
204 size += sizeof(UINT32);
205
206 if (strncpy_s(buf + size, REGION_PATH_MAX, info->f_path, info->len) != EOK) { /* save f_path */
207 PRINT_ERR("copy f_path failed, %s\n", info->f_path);
208 }
209 size += len;
210#else
211 *(UINTPTR *)buf = info->ip; /* save ip */
212 size += sizeof(UINTPTR);
213#endif
214 return size;
215}
unsigned long UINTPTR
Definition: los_typedef.h:68
UINTPTR ip
Definition: los_exc_pri.h:51
UINT32 len
Definition: los_exc_pri.h:52
CHAR f_path[REGION_PATH_MAX]
Definition: los_exc_pri.h:53
这是这个函数的调用关系图:

◆ OsPerfSetFilterIds()

STATIC INLINE VOID OsPerfSetFilterIds ( UINT32 dstIds,
UINT8 dstIdsNr,
UINT32 ids,
UINT32  idsNr 
)

在文件 los_perf.c408 行定义.

409{
410 errno_t ret;
411 if (idsNr) {
412 ret = memcpy_s(dstIds, PERF_MAX_FILTER_TSKS * sizeof(UINT32), ids, idsNr * sizeof(UINT32));
413 if (ret != EOK) {
414 PRINT_ERR("In %s At line:%d execute memcpy_s error\n", __FUNCTION__, __LINE__);
415 *dstIdsNr = 0;
416 return;
417 }
418 *dstIdsNr = MIN(idsNr, PERF_MAX_FILTER_TSKS);
419 } else {
420 *dstIdsNr = 0;
421 }
422}
这是这个函数的调用关系图:

◆ OsPerfSetIrqRegs()

VOID OsPerfSetIrqRegs ( UINTPTR  pc,
UINTPTR  fp 
)

在文件 los_perf.c537 行定义.

538{
539 LosTaskCB *runTask = (LosTaskCB *)ArchCurrTaskGet();
540 runTask->pc = pc;
541 runTask->fp = fp;
542}
STATIC INLINE VOID * ArchCurrTaskGet(VOID)
获取当前task的地址
Definition: los_hw_cpu.h:150
UINTPTR fp
fp寄存器
UINTPTR pc
pc寄存器
函数调用图:

◆ OsPerfStart()

STATIC VOID OsPerfStart ( VOID  )

在文件 los_perf.c146 行定义.

147{
148 UINT32 cpuid = ArchCurrCpuid();
149
150 if (g_pmu == NULL) {
151 PRINT_ERR("pmu not registered!\n");
152 return;
153 }
154
156 UINT32 ret = g_pmu->start();
157 if (ret != LOS_OK) {
158 PRINT_ERR("perf start on core:%u failed, ret = 0x%x\n", cpuid, ret);
159 return;
160 }
161
163 } else {
164 PRINT_ERR("percpu status err %d\n", g_perfCb.pmuStatusPerCpu[cpuid]);
165 }
166}
@ PERF_PMU_STARTED
Definition: los_perf_pri.h:55
enum PmuStatus pmuStatusPerCpu[LOSCFG_KERNEL_CORE_NUM]
Definition: los_perf_pri.h:116
UINT32(* start)(VOID)
Definition: los_perf_pri.h:104
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfStop()

STATIC VOID OsPerfStop ( VOID  )

在文件 los_perf.c168 行定义.

169{
170 UINT32 cpuid = ArchCurrCpuid();
171
172 if (g_pmu == NULL) {
173 PRINT_ERR("pmu not registered!\n");
174 return;
175 }
176
178 UINT32 ret = g_pmu->stop();
179 if (ret != LOS_OK) {
180 PRINT_ERR("perf stop on core:%u failed, ret = 0x%x\n", cpuid, ret);
181 return;
182 }
183
184 if (!g_perfCb.needSample) {
186 }
187
189 } else {
190 PRINT_ERR("percpu status err %d\n", g_perfCb.pmuStatusPerCpu[cpuid]);
191 }
192}
STATIC VOID OsPerfPrintCount(VOID)
Definition: los_perf.c:113
@ PERF_PMU_STOPED
Definition: los_perf_pri.h:54
UINT32(* stop)(VOID)
Definition: los_perf_pri.h:105
函数调用图:
这是这个函数的调用关系图:

◆ OsPerfUpdateEventCount()

VOID OsPerfUpdateEventCount ( Event event,
UINT32  value 
)

在文件 los_perf.c342 行定义.

343{
344 if (event == NULL) {
345 return;
346 }
347 event->count[ArchCurrCpuid()] += (value & 0xFFFFFFFF); /* event->count is UINT64 */
348}
函数调用图:
这是这个函数的调用关系图:

◆ OsPmuInit()

STATIC UINT32 OsPmuInit ( VOID  )

在文件 los_perf.c59 行定义.

60{
61#ifdef LOSCFG_PERF_HW_PMU
62 if (OsHwPmuInit() != LOS_OK) {
63 return LOS_ERRNO_PERF_HW_INIT_ERROR;
64 }
65#endif
66
67#ifdef LOSCFG_PERF_TIMED_PMU
68 if (OsTimedPmuInit() != LOS_OK) {
69 return LOS_ERRNO_PERF_TIMED_INIT_ERROR;
70 }
71#endif
72
73#ifdef LOSCFG_PERF_SW_PMU
74 if (OsSwPmuInit() != LOS_OK) {
75 return LOS_ERRNO_PERF_SW_INIT_ERROR;
76 }
77#endif
78 return LOS_OK;
79}
UINT32 OsHwPmuInit(VOID)
Definition: armv7_pmu.c:356
UINT32 OsSwPmuInit(VOID)
Definition: perf_sw_pmu.c:153
UINT32 OsTimedPmuInit(VOID)
函数调用图:
这是这个函数的调用关系图:

◆ PerfInfoDump()

STATIC VOID PerfInfoDump ( VOID  )

在文件 los_perf.c385 行定义.

386{
387 UINT32 i;
388 if (g_pmu != NULL) {
389 PRINTK("type: %d\n", g_pmu->type);
390 for (i = 0; i < g_pmu->events.nr; i++) {
391 PRINTK("events[%d]: %d, 0x%x\n", i, g_pmu->events.per[i].eventId, g_pmu->events.per[i].period);
392 }
393 PRINTK("predivided: %d\n", g_pmu->events.cntDivided);
394 } else {
395 PRINTK("pmu is NULL\n");
396 }
397
398 PRINTK("sampleType: 0x%x\n", g_perfCb.sampleType);
399 for (i = 0; i < g_perfCb.taskIdsNr; i++) {
400 PRINTK("filter taskIds[%d]: %d\n", i, g_perfCb.taskIds[i]);
401 }
402 for (i = 0; i < g_perfCb.processIdsNr; i++) {
403 PRINTK("filter processIds[%d]: %d\n", i, g_perfCb.processIds[i]);
404 }
405 PRINTK("needSample: %d\n", g_perfCb.needSample);
406}
这是这个函数的调用关系图:

◆ SPIN_LOCK_INIT()

LITE_OS_SEC_BSS SPIN_LOCK_INIT ( g_perfSpin  )

变量说明

◆ g_perfCb

STATIC PerfCB g_perfCb = {0}

在文件 los_perf.c42 行定义.

◆ g_pmu

STATIC Pmu* g_pmu = NULL

在文件 los_perf.c41 行定义.