parent
99c01f46b7
commit
aa43a7ec88
@ -0,0 +1,53 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2013-2019. All rights reserved.
|
||||
* Description: Cpp Support HeadFile
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2013-01-01
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _LOS_CPPSUPPORT_PRI_H
|
||||
#define _LOS_CPPSUPPORT_PRI_H //防止多次包含同一个头文件//
|
||||
|
||||
#include "los_cppsupport.h"
|
||||
|
||||
#ifdef __cplusplus //根据编译器是否为C++//
|
||||
#if __cplusplus //来使用“extern 'C'”//
|
||||
extern "C" { //对以下代码块内容进行//
|
||||
#endif /* __cplusplus */ //正确处理函数名//
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern CHAR __fast_end; //声明一个_fast_end的CHAR类型变量//
|
||||
|
||||
#ifdef LOSCFG_AARCH64 //条件编译//
|
||||
extern UINT8 __EH_FRAME_BEGIN__[]; //声明一个UINT8类型的数组//
|
||||
VOID __register_frame(VOID *begin);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */ //关闭extern'C'作用域//
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_CPPSUPPORT_PRI_H */
|
@ -0,0 +1,150 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
|
||||
* Description: LiteOS Trace Module Private HeadFile
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2019-08-30
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _LOS_TRACE_PRI_H
|
||||
#define _LOS_TRACE_PRI_H
|
||||
|
||||
#include "los_trace.h"
|
||||
#include "los_task_pri.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef LOSCFG_TRACE_CONTROL_AGENT
|
||||
#define TRACE_CMD_END_CHAR 0xD
|
||||
#endif
|
||||
|
||||
#define TRACE_ERROR PRINT_ERR
|
||||
#define TRACE_MODE_OFFLINE 0
|
||||
#define TRACE_MODE_ONLINE 1
|
||||
|
||||
/* just task and hwi were traced */
|
||||
#define TRACE_DEFAULT_MASK (TRACE_HWI_FLAG | TRACE_TASK_FLAG)
|
||||
#define TRACE_CTL_MAGIC_NUM 0xDEADBEEF
|
||||
#define TRACE_BIGLITTLE_WORD 0x12345678
|
||||
#define TRACE_VERSION(MODE) (0xFFFFFFFF & (MODE))
|
||||
#define TRACE_MASK_COMBINE(c1, c2, c3, c4) (((c1) << 24) | ((c2) << 16) | ((c3) << 8) | (c4))
|
||||
|
||||
#define TRACE_GET_MODE_FLAG(type) ((type) & 0xFFFFFFF0)
|
||||
|
||||
extern SPIN_LOCK_S g_traceSpin;
|
||||
#define TRACE_LOCK(state) LOS_SpinLockSave(&g_traceSpin, &(state))
|
||||
#define TRACE_UNLOCK(state) LOS_SpinUnlockRestore(&g_traceSpin, (state))
|
||||
|
||||
typedef VOID (*TRACE_DUMP_HOOK)(BOOL toClient);
|
||||
extern TRACE_DUMP_HOOK g_traceDumpHook;
|
||||
|
||||
enum TraceCmd {
|
||||
TRACE_CMD_START = 1,
|
||||
TRACE_CMD_STOP,
|
||||
TRACE_CMD_SET_EVENT_MASK,
|
||||
TRACE_CMD_RECODE_DUMP,
|
||||
TRACE_CMD_MAX_CODE,
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup los_trace
|
||||
* struct to store the trace cmd from traceClient.
|
||||
*/
|
||||
typedef struct {
|
||||
UINT8 cmd;
|
||||
UINT8 param1;
|
||||
UINT8 param2;
|
||||
UINT8 param3;
|
||||
UINT8 param4;
|
||||
UINT8 param5;
|
||||
UINT8 end;
|
||||
} TraceClientCmd;
|
||||
|
||||
/**
|
||||
* @ingroup los_trace
|
||||
* struct to store the event infomation
|
||||
*/
|
||||
typedef struct {
|
||||
UINT32 cmd; /* trace start or stop cmd */
|
||||
UINT32 param; /* magic numb stand for notify msg */
|
||||
} TraceNotifyFrame;
|
||||
|
||||
/**
|
||||
* @ingroup los_trace
|
||||
* struct to store the trace config information.
|
||||
*/
|
||||
typedef struct {
|
||||
struct WriteCtrl {
|
||||
UINT16 curIndex; /* The current record index */
|
||||
UINT16 maxRecordCount; /* The max num of track items */
|
||||
UINT16 curObjIndex; /* The current obj index */
|
||||
UINT16 maxObjCount; /* The max num of obj index */
|
||||
ObjData *objBuf; /* Pointer to obj info data */
|
||||
TraceEventFrame *frameBuf; /* Pointer to the track items */
|
||||
} ctrl;
|
||||
OfflineHead *head;
|
||||
} TraceOfflineHeaderInfo;
|
||||
|
||||
extern UINT32 OsTraceGetMaskTid(UINT32 taskId);
|
||||
extern VOID OsTraceSetObj(ObjData *obj, const LosTaskCB *tcb);
|
||||
extern VOID OsTraceWriteOrSendEvent(const TraceEventFrame *frame);
|
||||
extern UINT32 OsTraceBufInit(VOID *buf, UINT32 size);
|
||||
extern VOID OsTraceObjAdd(UINT32 eventType, UINT32 taskId);
|
||||
extern BOOL OsTraceIsEnable(VOID);
|
||||
extern OfflineHead *OsTraceRecordGet(VOID);
|
||||
|
||||
#ifdef LOSCFG_RECORDER_MODE_ONLINE
|
||||
extern VOID OsTraceSendHead(VOID);
|
||||
extern VOID OsTraceSendObjTable(VOID);
|
||||
extern VOID OsTraceSendNotify(UINT32 type, UINT32 value);
|
||||
|
||||
#define OsTraceNotifyStart() do { \
|
||||
OsTraceSendNotify(SYS_START, TRACE_CTL_MAGIC_NUM); \
|
||||
OsTraceSendHead(); \
|
||||
OsTraceSendObjTable(); \
|
||||
} while (0)
|
||||
|
||||
#define OsTraceNotifyStop() do { \
|
||||
OsTraceSendNotify(SYS_STOP, TRACE_CTL_MAGIC_NUM); \
|
||||
} while (0)
|
||||
|
||||
#define OsTraceReset()
|
||||
#define OsTraceRecordDump(toClient)
|
||||
#else
|
||||
extern VOID OsTraceReset(VOID);
|
||||
extern VOID OsTraceRecordDump(BOOL toClient);
|
||||
#define OsTraceNotifyStart()
|
||||
#define OsTraceNotifyStop()
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _LOS_TRACE_PRI_H */
|
@ -0,0 +1,424 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2019-2020. All rights reserved.
|
||||
* Description: LiteOS Trace Implementation
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2019-08-31
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
#include "uart.h"
|
||||
#include "los_trace_pri.h"
|
||||
#include "trace_pipeline.h"
|
||||
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
#include "los_mp_pri.h"
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_SHELL
|
||||
#include "shcmd.h"
|
||||
#include "shell.h"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef LOSCFG_KERNEL_TRACE
|
||||
LITE_OS_SEC_BSS STATIC UINT32 g_traceEventCount; //追踪事件计数//
|
||||
LITE_OS_SEC_BSS STATIC volatile enum TraceState g_traceState = TRACE_UNINIT; //追踪状态//
|
||||
LITE_OS_SEC_DATA_INIT STATIC volatile BOOL g_enableTrace = FALSE; //是否启用追踪功能//
|
||||
LITE_OS_SEC_BSS STATIC UINT32 g_traceMask = TRACE_DEFAULT_MASK; //追踪掩码,用于过滤追踪事件//
|
||||
|
||||
#ifdef LOSCFG_TRACE_CONTROL_AGENT
|
||||
LITE_OS_SEC_BSS STATIC UINT32 g_traceTaskId; //追踪任务的ID//
|
||||
#endif
|
||||
|
||||
#define EVENT_MASK 0xFFFFFFF0
|
||||
#define MIN(x, y) ((x) < (y) ? (x) : (y))
|
||||
|
||||
LITE_OS_SEC_BSS STATIC TRACE_HWI_FILTER_HOOK g_traceHwiFliterHook = NULL;
|
||||
|
||||
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_traceSpin);
|
||||
|
||||
STATIC_INLINE BOOL OsTraceHwiFilter(UINT32 hwiNum) //用于判断是否需要过滤某个硬件中断//
|
||||
{
|
||||
BOOL ret = ((hwiNum == NUM_HAL_INTERRUPT_UART) || (hwiNum == OS_TICK_INT_NUM));
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
ret |= (hwiNum == LOS_MP_IPI_SCHEDULE);
|
||||
#endif
|
||||
if (g_traceHwiFliterHook != NULL) {
|
||||
ret |= g_traceHwiFliterHook(hwiNum);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
//用于设置追踪事件的帧信息//
|
||||
STATIC VOID OsTraceSetFrame(TraceEventFrame *frame, UINT32 eventType, UINTPTR identity, const UINTPTR *params,
|
||||
UINT16 paramCount)
|
||||
{
|
||||
INT32 i;
|
||||
UINT32 intSave;
|
||||
|
||||
(VOID)memset_s(frame, sizeof(TraceEventFrame), 0, sizeof(TraceEventFrame));
|
||||
|
||||
if (paramCount > LOSCFG_TRACE_FRAME_MAX_PARAMS) {
|
||||
paramCount = LOSCFG_TRACE_FRAME_MAX_PARAMS;
|
||||
}
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
frame->curTask = OsTraceGetMaskTid(OsCurrTaskGet()->taskId);
|
||||
frame->identity = identity;
|
||||
frame->curTime = HalClockGetCycles();
|
||||
frame->eventType = eventType;
|
||||
|
||||
#ifdef LOSCFG_TRACE_FRAME_CORE_MSG
|
||||
frame->core.cpuId = ArchCurrCpuid(); //CPU的ID//
|
||||
frame->core.hwiActive = OS_INT_ACTIVE ? TRUE : FALSE; //硬件中断活动状态//
|
||||
frame->core.taskLockCnt = MIN(OsPercpuGet()->taskLockCnt, 0xF); /* taskLockCnt is 4 bits, max vaule = 0xF */ //任务锁计数//
|
||||
frame->core.paramCount = paramCount; //参数数目//
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_TRACE_FRAME_EVENT_COUNT
|
||||
frame->eventCount = g_traceEventCount; //追踪事件的计数//
|
||||
g_traceEventCount++;
|
||||
#endif
|
||||
TRACE_UNLOCK(intSave);
|
||||
|
||||
for (i = 0; i < paramCount; i++) {
|
||||
frame->params[i] = params[i];
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsTraceSetObj(ObjData *obj, const LosTaskCB *tcb) //设置对象的追踪信息//
|
||||
{
|
||||
errno_t ret;
|
||||
(VOID)memset_s(obj, sizeof(ObjData), 0, sizeof(ObjData));
|
||||
|
||||
obj->id = OsTraceGetMaskTid(tcb->taskId); //获取任务ID//
|
||||
obj->prio = tcb->priority; //获取任务优先级//
|
||||
|
||||
ret = strncpy_s(obj->name, LOSCFG_TRACE_OBJ_MAX_NAME_SIZE, tcb->taskName, LOSCFG_TRACE_OBJ_MAX_NAME_SIZE - 1);
|
||||
if (ret != EOK) {
|
||||
TRACE_ERROR("Task name copy failed!\n");
|
||||
}
|
||||
}
|
||||
|
||||
//处理追踪事件钩子//
|
||||
VOID OsTraceHook(UINT32 eventType, UINTPTR identity, const UINTPTR *params, UINT16 paramCount)
|
||||
{
|
||||
if ((eventType == TASK_CREATE) || (eventType == TASK_PRIOSET)) {
|
||||
OsTraceObjAdd(eventType, identity); /* handle important obj info, these can not be filtered */
|
||||
}
|
||||
|
||||
if ((g_enableTrace == TRUE) && (eventType & g_traceMask)) {
|
||||
UINTPTR id = identity;
|
||||
if (TRACE_GET_MODE_FLAG(eventType) == TRACE_HWI_FLAG) {
|
||||
if (OsTraceHwiFilter(identity)) {
|
||||
return;
|
||||
}
|
||||
} else if (TRACE_GET_MODE_FLAG(eventType) == TRACE_TASK_FLAG) {
|
||||
id = OsTraceGetMaskTid(identity);
|
||||
} else if (eventType == MEM_INFO_REQ) {
|
||||
LOS_MEM_POOL_STATUS status;
|
||||
LOS_MemInfoGet((VOID *)identity, &status);
|
||||
LOS_TRACE(MEM_INFO, identity, status.uwTotalUsedSize, status.uwTotalFreeSize);
|
||||
return;
|
||||
}
|
||||
|
||||
TraceEventFrame frame;
|
||||
OsTraceSetFrame(&frame, eventType, id, params, paramCount);
|
||||
|
||||
OsTraceWriteOrSendEvent(&frame); //将追踪事件信息写入或发送出去//
|
||||
}
|
||||
}
|
||||
|
||||
BOOL OsTraceIsEnable(VOID) //判断追踪是否处于启用状态//
|
||||
{
|
||||
return g_enableTrace == TRUE;
|
||||
}
|
||||
|
||||
STATIC VOID OsTraceHookInstall(VOID) //安装追踪钩子//
|
||||
{
|
||||
g_traceEventHook = OsTraceHook;
|
||||
#ifdef LOSCFG_RECORDER_MODE_OFFLINE
|
||||
g_traceDumpHook = OsTraceRecordDump; //在离线记录模式下设置追踪转储钩子//
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_TRACE_CONTROL_AGENT
|
||||
STATIC BOOL OsTraceCmdIsValid(const TraceClientCmd *msg) //判断传入的TraceClientCmd结构体是否有效//
|
||||
{
|
||||
return ((msg->end == TRACE_CMD_END_CHAR) && (msg->cmd < TRACE_CMD_MAX_CODE));
|
||||
}
|
||||
|
||||
STATIC VOID OsTraceCmdHandle(const TraceClientCmd *msg) //处理传入的TraceClientCmd结构体//
|
||||
{
|
||||
if (!OsTraceCmdIsValid(msg)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (msg->cmd) {
|
||||
case TRACE_CMD_START: //启动追踪//
|
||||
LOS_TraceStart();
|
||||
break;
|
||||
case TRACE_CMD_STOP: //停止追踪//
|
||||
LOS_TraceStop();
|
||||
break;
|
||||
case TRACE_CMD_SET_EVENT_MASK: //设置事件掩码//
|
||||
/* 4 params(UINT8) composition the mask(UINT32) */
|
||||
LOS_TraceEventMaskSet(TRACE_MASK_COMBINE(msg->param1, msg->param2, msg->param3, msg->param4));
|
||||
break;
|
||||
case TRACE_CMD_RECODE_DUMP: //追踪记录转储//
|
||||
LOS_TraceRecordDump(TRUE);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
VOID TraceAgent(VOID) //不断等待追踪数据的到达,并处理接收到的追踪命令//
|
||||
{
|
||||
UINT32 ret;
|
||||
TraceClientCmd msg;
|
||||
|
||||
while (1) {
|
||||
(VOID)memset_s(&msg, sizeof(TraceClientCmd), 0, sizeof(TraceClientCmd));
|
||||
ret = OsTraceDataWait();
|
||||
if (ret == LOS_OK) {
|
||||
OsTraceDataRecv((UINT8 *)&msg, sizeof(TraceClientCmd), 0);
|
||||
OsTraceCmdHandle(&msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
STATIC UINT32 OsCreateTraceAgentTask(VOID) //创建一个追踪代理任务,用于执行追踪逻辑//
|
||||
{
|
||||
UINT32 ret;
|
||||
TSK_INIT_PARAM_S taskInitParam;
|
||||
|
||||
(VOID)memset_s((VOID *)(&taskInitParam), sizeof(TSK_INIT_PARAM_S), 0, sizeof(TSK_INIT_PARAM_S));
|
||||
taskInitParam.pfnTaskEntry = (TSK_ENTRY_FUNC)TraceAgent;
|
||||
taskInitParam.usTaskPrio = LOSCFG_TRACE_TASK_PRIORITY;
|
||||
taskInitParam.pcName = "TraceAgent";
|
||||
taskInitParam.uwStackSize = LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE;
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
taskInitParam.usCpuAffiMask = CPUID_TO_AFFI_MASK(ArchCurrCpuid());
|
||||
#endif
|
||||
ret = LOS_TaskCreate(&g_traceTaskId, &taskInitParam);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
UINT32 LOS_TraceInit(VOID *buf, UINT32 size) //初始化追踪功能//
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT32 ret;
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
if (g_traceState != TRACE_UNINIT) {
|
||||
TRACE_ERROR("trace has been initialized already, the current state is :%d\n", g_traceState);
|
||||
ret = LOS_ERRNO_TRACE_ERROR_STATUS;
|
||||
goto LOS_ERREND;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_TRACE_CLIENT_INTERACT //判断是否需要初始化追踪管道//
|
||||
ret = OsTracePipelineInit();
|
||||
if (ret != LOS_OK) {
|
||||
goto LOS_ERREND;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef LOSCFG_TRACE_CONTROL_AGENT //判断是否需要创建追踪代理任务//
|
||||
ret = OsCreateTraceAgentTask();
|
||||
if (ret != LOS_OK) {
|
||||
TRACE_ERROR("trace init create agentTask error :0x%x\n", ret);
|
||||
goto LOS_ERREND;
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = OsTraceBufInit(buf, size); //初始化追踪缓冲区//
|
||||
if (ret != LOS_OK) {
|
||||
goto LOS_RELEASE;
|
||||
}
|
||||
|
||||
OsTraceHookInstall(); //安装追踪钩子//
|
||||
|
||||
g_traceEventCount = 0;
|
||||
|
||||
/*判断是否需要等待追踪客户端启动追踪*/
|
||||
#ifdef LOSCFG_RECORDER_MODE_ONLINE /* Wait trace client to start trace */
|
||||
g_enableTrace = FALSE;
|
||||
g_traceState = TRACE_INITED;
|
||||
#else
|
||||
g_enableTrace = TRUE;
|
||||
g_traceState = TRACE_STARTED;
|
||||
#endif
|
||||
TRACE_UNLOCK(intSave);
|
||||
return LOS_OK;
|
||||
LOS_RELEASE:
|
||||
#ifdef LOSCFG_TRACE_CONTROL_AGENT //判断是否需要删除追踪代理任务//
|
||||
LOS_TaskDelete(g_traceTaskId);
|
||||
#endif
|
||||
LOS_ERREND:
|
||||
TRACE_UNLOCK(intSave);
|
||||
return ret;
|
||||
}
|
||||
|
||||
UINT32 LOS_TraceStart(VOID) //用于启动追踪功能//
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT32 ret = LOS_OK;
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
if (g_traceState == TRACE_STARTED) {
|
||||
goto START_END;
|
||||
}
|
||||
|
||||
if (g_traceState == TRACE_UNINIT) {
|
||||
TRACE_ERROR("trace not inited, be sure LOS_TraceInit excute success\n");
|
||||
ret = LOS_ERRNO_TRACE_ERROR_STATUS;
|
||||
goto START_END;
|
||||
}
|
||||
|
||||
OsTraceNotifyStart(); //通知追踪功能开始工作//
|
||||
|
||||
g_enableTrace = TRUE;
|
||||
g_traceState = TRACE_STARTED;
|
||||
|
||||
TRACE_UNLOCK(intSave);
|
||||
LOS_TRACE(MEM_INFO_REQ, m_aucSysMem0); //发送追踪信息//
|
||||
return ret;
|
||||
START_END:
|
||||
TRACE_UNLOCK(intSave);
|
||||
return ret;
|
||||
}
|
||||
|
||||
VOID LOS_TraceStop(VOID) //用于停止追踪功能//
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
if (g_traceState != TRACE_STARTED) {
|
||||
goto STOP_END;
|
||||
}
|
||||
|
||||
g_enableTrace = FALSE;
|
||||
g_traceState = TRACE_STOPED;
|
||||
OsTraceNotifyStop(); //通知追踪功能停止工作//
|
||||
STOP_END:
|
||||
TRACE_UNLOCK(intSave);
|
||||
}
|
||||
|
||||
VOID LOS_TraceEventMaskSet(UINT32 mask) //设置追踪事件掩码//
|
||||
{
|
||||
g_traceMask = mask & EVENT_MASK;
|
||||
}
|
||||
|
||||
VOID LOS_TraceRecordDump(BOOL toClient) //转储追踪记录//
|
||||
{
|
||||
if (g_traceState != TRACE_STOPED) {
|
||||
TRACE_ERROR("trace dump must after trace stopped , the current state is : %d\n", g_traceState);
|
||||
return;
|
||||
}
|
||||
OsTraceRecordDump(toClient);
|
||||
}
|
||||
|
||||
OfflineHead *LOS_TraceRecordGet(VOID) //获取追踪记录//
|
||||
{
|
||||
return OsTraceRecordGet();
|
||||
}
|
||||
|
||||
VOID LOS_TraceReset(VOID) //重置追踪功能//
|
||||
{
|
||||
if (g_traceState == TRACE_UNINIT) {
|
||||
TRACE_ERROR("trace not inited, be sure LOS_TraceInit excute success\n");
|
||||
return;
|
||||
}
|
||||
|
||||
OsTraceReset();
|
||||
}
|
||||
|
||||
VOID LOS_TraceHwiFilterHookReg(TRACE_HWI_FILTER_HOOK hook) //注册中断过滤钩子//
|
||||
{
|
||||
UINT32 intSave;
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
g_traceHwiFliterHook = hook;
|
||||
TRACE_UNLOCK(intSave);
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_SHELL
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdTraceSetMask(INT32 argc, const CHAR **argv) //设置追踪事件掩码//
|
||||
{
|
||||
size_t mask;
|
||||
CHAR *endPtr = NULL;
|
||||
|
||||
if (argc >= 2) { /* 2:Just as number of parameters */
|
||||
PRINTK("\nUsage: trace_mask or trace_mask ID\n");
|
||||
return OS_ERROR;
|
||||
}
|
||||
|
||||
if (argc == 0) {
|
||||
mask = TRACE_DEFAULT_MASK;
|
||||
} else {
|
||||
mask = strtoul(argv[0], &endPtr, 0);
|
||||
}
|
||||
LOS_TraceEventMaskSet((UINT32)mask);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdTraceDump(INT32 argc, const CHAR **argv) //进行追踪记录的转储//
|
||||
{
|
||||
BOOL toClient;
|
||||
CHAR *endPtr = NULL;
|
||||
|
||||
if (argc >= 2) { /* 2:Just as number of parameters */
|
||||
PRINTK("\nUsage: trace_dump or trace_dump [1/0]\n");
|
||||
return OS_ERROR;
|
||||
}
|
||||
|
||||
if (argc == 0) {
|
||||
toClient = FALSE;
|
||||
} else {
|
||||
toClient = strtoul(argv[0], &endPtr, 0) != 0 ? TRUE : FALSE;
|
||||
}
|
||||
LOS_TraceRecordDump(toClient);
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
/*命令行函数的注册*/
|
||||
SHELLCMD_ENTRY(tracestart_shellcmd, CMD_TYPE_EX, "trace_start", 0, (CmdCallBackFunc)LOS_TraceStart); //追踪功能的启动//
|
||||
SHELLCMD_ENTRY(tracestop_shellcmd, CMD_TYPE_EX, "trace_stop", 0, (CmdCallBackFunc)LOS_TraceStop); //追踪功能的停止//
|
||||
SHELLCMD_ENTRY(tracesetmask_shellcmd, CMD_TYPE_EX, "trace_mask", 1, (CmdCallBackFunc)OsShellCmdTraceSetMask); //设置追踪事件掩码//
|
||||
SHELLCMD_ENTRY(tracereset_shellcmd, CMD_TYPE_EX, "trace_reset", 0, (CmdCallBackFunc)LOS_TraceReset); //重置追踪记录//
|
||||
SHELLCMD_ENTRY(tracedump_shellcmd, CMD_TYPE_EX, "trace_dump", 1, (CmdCallBackFunc)OsShellCmdTraceDump); //转储追踪记录//
|
||||
#endif
|
||||
|
||||
#endif /* LOSCFG_KERNEL_TRACE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
@ -0,0 +1,50 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
||||
* Description: LiteOS Trace Pipeline of Serial Implementation HeadFile
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2020-03-16
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _TRACE_PIPELINE_SERIAL_H
|
||||
#define _TRACE_PIPELINE_SERIAL_H
|
||||
|
||||
#include "los_typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
extern INT32 uart_putc(CHAR c); //用于向串口发送一个字符//
|
||||
|
||||
#define UART_PUTC(c) uart_putc((c)) //调用uart_putc函数//
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _TRACE_PIPELINE_SERIAL_H */
|
@ -0,0 +1,156 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
||||
* Description: LiteOS Trace Pipeline Implementation
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2020-03-31
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
#include "trace_pipeline.h"
|
||||
#include "trace_tlv.h"
|
||||
#include "los_trace_pri.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
//防止缓冲区溢出//
|
||||
LITE_OS_SEC_BSS SPIN_LOCK_INIT(g_pipeSpin); //初始化一个自旋锁//
|
||||
#define PIPE_LOCK(state) LOS_SpinLockSave(&g_pipeSpin, &(state)) //对自旋锁加锁操作//
|
||||
#define PIPE_UNLOCK(state) LOS_SpinUnlockRestore(&g_pipeSpin, (state)) //对自旋锁解锁操作//
|
||||
|
||||
STATIC TlvTable g_traceTlvTblNotify[] = { //定义结构体的成员变量类型和大小//
|
||||
{ CMD, LOS_OFF_SET_OF(TraceNotifyFrame, cmd), sizeof(UINT32) },
|
||||
{ PARAMS, LOS_OFF_SET_OF(TraceNotifyFrame, param), sizeof(UINT32) },
|
||||
{ TRACE_TLV_TYPE_NULL, 0, 0 },
|
||||
};
|
||||
|
||||
STATIC TlvTable g_traceTlvTblHead[] = { //定义结构体的成员变量类型和大小//
|
||||
{ ENDIAN, LOS_OFF_SET_OF(TraceBaseHeaderInfo, bigLittleEndian), sizeof(UINT32) },
|
||||
{ VERSION, LOS_OFF_SET_OF(TraceBaseHeaderInfo, version), sizeof(UINT32) },
|
||||
{ CLOCK_FREQ, LOS_OFF_SET_OF(TraceBaseHeaderInfo, clockFreq), sizeof(UINT32) },
|
||||
{ TRACE_TLV_TYPE_NULL, 0, 0 },
|
||||
};
|
||||
|
||||
STATIC TlvTable g_traceTlvTblObj[] = { //定义结构体的成员变量类型、偏移位置和大小//
|
||||
{ ADDR, LOS_OFF_SET_OF(ObjData, id), sizeof(UINT32) },
|
||||
{ PRIO, LOS_OFF_SET_OF(ObjData, prio), sizeof(UINT32) },
|
||||
{ NAME, LOS_OFF_SET_OF(ObjData, name), sizeof(CHAR) * LOSCFG_TRACE_OBJ_MAX_NAME_SIZE },
|
||||
{ TRACE_TLV_TYPE_NULL, 0, 0 },
|
||||
};
|
||||
|
||||
STATIC TlvTable g_traceTlvTblEvent[] = { //定义结构体的成员变量类型和大小//
|
||||
#ifdef LOSCFG_TRACE_FRAME_CORE_MSG
|
||||
{ CORE, LOS_OFF_SET_OF(TraceEventFrame, core), sizeof(UINT32) },
|
||||
#endif
|
||||
{ EVENT_CODE, LOS_OFF_SET_OF(TraceEventFrame, eventType), sizeof(UINT32) },
|
||||
{ CUR_TIME, LOS_OFF_SET_OF(TraceEventFrame, curTime), sizeof(UINT64) },
|
||||
|
||||
#ifdef LOSCFG_TRACE_FRAME_EVENT_COUNT
|
||||
{ EVENT_COUNT, LOS_OFF_SET_OF(TraceEventFrame, eventCount), sizeof(UINT32) },
|
||||
#endif
|
||||
{ CUR_TASK, LOS_OFF_SET_OF(TraceEventFrame, curTask), sizeof(UINT32) },
|
||||
{ IDENTITY, LOS_OFF_SET_OF(TraceEventFrame, identity), sizeof(UINTPTR) },
|
||||
{ EVENT_PARAMS, LOS_OFF_SET_OF(TraceEventFrame, params), sizeof(UINTPTR) * LOSCFG_TRACE_FRAME_MAX_PARAMS },
|
||||
{ TRACE_TLV_TYPE_NULL, 0, 0 },
|
||||
};
|
||||
|
||||
STATIC TlvTable *g_traceTlvTbl[] = {
|
||||
g_traceTlvTblNotify,
|
||||
g_traceTlvTblHead,
|
||||
g_traceTlvTblObj,
|
||||
g_traceTlvTblEvent
|
||||
};
|
||||
|
||||
STATIC UINT32 DefaultPipelineInit(VOID)
|
||||
{
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC VOID DefaultDataSend(UINT16 len, UINT8 *data)
|
||||
{ //将len和data参数标记为"未使用"//
|
||||
(VOID)len; //避免编译器产生警告//
|
||||
(VOID)data;
|
||||
}
|
||||
|
||||
STATIC UINT32 DefaultDataReceive(UINT8 *data, UINT32 size, UINT32 timeout)
|
||||
{
|
||||
(VOID)data; //将data、size和timeout参数标记为"未使用"//
|
||||
(VOID)size;
|
||||
(VOID)timeout;
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC UINT32 DefaultWait(VOID)
|
||||
{
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
STATIC TracePipelineOps g_defaultOps = {
|
||||
.init = DefaultPipelineInit,
|
||||
.dataSend = DefaultDataSend,
|
||||
.dataRecv = DefaultDataReceive,
|
||||
.wait = DefaultWait,
|
||||
};
|
||||
|
||||
STATIC const TracePipelineOps *g_tracePipelineOps = &g_defaultOps;
|
||||
|
||||
VOID OsTracePipelineReg(const TracePipelineOps *ops)
|
||||
{
|
||||
g_tracePipelineOps = ops; //用于注册一个TracePipelineOps结构体指针//
|
||||
}
|
||||
|
||||
VOID OsTraceDataSend(UINT8 type, UINT16 len, UINT8 *data) //用于发送追踪数据//
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT8 outBuf[LOSCFG_TRACE_TLV_BUF_SIZE] = {0};
|
||||
|
||||
if ((type > TRACE_MSG_MAX) || (len > LOSCFG_TRACE_TLV_BUF_SIZE)) { //输入参数的合法性检查//
|
||||
return;
|
||||
}
|
||||
|
||||
//对数据进行编码//
|
||||
len = OsTraceDataEncode(type, g_traceTlvTbl[type], data, &outBuf[0], sizeof(outBuf));
|
||||
|
||||
PIPE_LOCK(intSave); //获取管道锁,防止多线程并发访问//
|
||||
g_tracePipelineOps->dataSend(len, &outBuf[0]); //发送编码后的数据//
|
||||
PIPE_UNLOCK(intSave); //释放管道锁//
|
||||
}
|
||||
|
||||
UINT32 OsTraceDataRecv(UINT8 *data, UINT32 size, UINT32 timeout) //用于接收追踪数据//
|
||||
{
|
||||
return g_tracePipelineOps->dataRecv(data, size, timeout);
|
||||
}
|
||||
|
||||
UINT32 OsTraceDataWait(VOID) //用于等待追踪数据//
|
||||
{
|
||||
return g_tracePipelineOps->wait();
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
@ -0,0 +1,104 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
||||
* Description: LiteOS Trace Pipeline Implementation HeadFile
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2020-03-16
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
#ifndef _TRACE_PIPELINE_H
|
||||
#define _TRACE_PIPELINE_H
|
||||
|
||||
#include "los_typedef.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*用于实现追踪流水线的功能*/
|
||||
typedef struct {
|
||||
UINT32 (*init)(VOID); //用于初始化//
|
||||
VOID (*dataSend)(UINT16 len, UINT8 *data); //用于发送数据//
|
||||
UINT32 (*dataRecv)(UINT8 *data, UINT32 size, UINT32 timeout); //用于接收数据//
|
||||
UINT32 (*wait)(VOID); //用于等待操作//
|
||||
} TracePipelineOps;
|
||||
|
||||
/* used as tlv's tag */
|
||||
enum TraceMsgType { //用于表示追踪消息的类型//
|
||||
//类型如下//
|
||||
NOTIFY, //通知//
|
||||
HEAD, //头部//
|
||||
OBJ, //对象//
|
||||
EVENT, //事件//
|
||||
|
||||
TRACE_MSG_MAX, //最大值//
|
||||
};
|
||||
|
||||
enum TraceNotifySubType { //用于表示通知消息的子类型//
|
||||
CMD = 0x1,
|
||||
PARAMS,
|
||||
};
|
||||
|
||||
enum TraceHeadSubType { //用于表示追踪头部信息的子类型//
|
||||
ENDIAN = 0x1, //字节序//
|
||||
VERSION, //版本//
|
||||
OBJ_SIZE, //对象大小//
|
||||
OBJ_COUNT, //对象计数//
|
||||
CUR_INDEX, //当前索引//
|
||||
MAX_RECODE,
|
||||
CUR_OBJ_INDEX,
|
||||
CLOCK_FREQ,
|
||||
};
|
||||
|
||||
enum TraceObjSubType { //用于表示追踪对象的子类型//
|
||||
ADDR = 0x1, //地址//
|
||||
PRIO, //优先级/
|
||||
NAME, //名称//
|
||||
};
|
||||
|
||||
enum TraceEvtSubType { //用于表示追踪事件的子类型//
|
||||
CORE = 0x1, //核心编号//
|
||||
EVENT_CODE, //事件码//
|
||||
CUR_TIME, //当前时间//
|
||||
EVENT_COUNT, //事件计数//
|
||||
CUR_TASK, //当前任务//
|
||||
IDENTITY, //身份信息//
|
||||
EVENT_PARAMS, //事件参数//
|
||||
};
|
||||
|
||||
extern VOID OsTracePipelineReg(const TracePipelineOps *ops); //用于注册追踪管道操作//
|
||||
extern UINT32 OsTracePipelineInit(VOID); //用于初始化追踪管道//
|
||||
|
||||
extern VOID OsTraceDataSend(UINT8 type, UINT16 len, UINT8 *data); //用于发送追踪数据//
|
||||
extern UINT32 OsTraceDataRecv(UINT8 *data, UINT32 size, UINT32 timeout); //用于接收追踪数据//
|
||||
extern UINT32 OsTraceDataWait(VOID); //用于等待追踪数据//
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* _TRACE_PIPELINE_H */
|
@ -0,0 +1,264 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
||||
* Description: LiteOS Trace Offline Mode Implementation
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2020-03-31
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
#include "los_trace_pri.h"
|
||||
#include "trace_pipeline.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef LOSCFG_RECORDER_MODE_OFFLINE
|
||||
#define BITS_NUM_FOR_TASK_ID 16 //指定了任务ID的位数//
|
||||
|
||||
LITE_OS_SEC_BSS STATIC TraceOfflineHeaderInfo g_traceRecoder; //用来记录离线跟踪记录的相关信息//
|
||||
LITE_OS_SEC_BSS STATIC UINT32 g_tidMask[LOSCFG_BASE_CORE_TSK_LIMIT] = {0}; //用于存储任务ID的掩码//
|
||||
|
||||
UINT32 OsTraceGetMaskTid(UINT32 tid) //用于获取掩码后的任务ID//
|
||||
{
|
||||
return tid | ((tid < LOSCFG_BASE_CORE_TSK_LIMIT) ? g_tidMask[tid] << BITS_NUM_FOR_TASK_ID : 0); /* tid < 65535 */
|
||||
}
|
||||
|
||||
UINT32 OsTraceBufInit(VOID *buf, UINT32 size) //用于初始化离线跟踪缓冲区//
|
||||
{
|
||||
UINT32 headSize;
|
||||
|
||||
headSize = sizeof(OfflineHead) + sizeof(ObjData) * LOSCFG_TRACE_OBJ_MAX_NUM; //用于存储离线跟踪记录头部信息//
|
||||
if (size <= headSize) {
|
||||
TRACE_ERROR("trace buf size not enough than 0x%x\n", headSize);
|
||||
return LOS_ERRNO_TRACE_BUF_TOO_SMALL;
|
||||
}
|
||||
|
||||
if (buf == NULL) {
|
||||
buf = LOS_MemAlloc(m_aucSysMem1, size);
|
||||
if (buf == NULL) {
|
||||
return LOS_ERRNO_TRACE_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
(VOID)memset_s(buf, size, 0, size);
|
||||
g_traceRecoder.head = (OfflineHead *)buf;
|
||||
g_traceRecoder.head->baseInfo.bigLittleEndian = TRACE_BIGLITTLE_WORD;
|
||||
g_traceRecoder.head->baseInfo.version = TRACE_VERSION(TRACE_MODE_OFFLINE);
|
||||
g_traceRecoder.head->baseInfo.clockFreq = GET_SYS_CLOCK();
|
||||
g_traceRecoder.head->objSize = sizeof(ObjData);
|
||||
g_traceRecoder.head->frameSize = sizeof(TraceEventFrame);
|
||||
g_traceRecoder.head->objOffset = sizeof(OfflineHead);
|
||||
g_traceRecoder.head->frameOffset = headSize;
|
||||
g_traceRecoder.head->totalLen = size;
|
||||
|
||||
g_traceRecoder.ctrl.curIndex = 0;
|
||||
g_traceRecoder.ctrl.curObjIndex = 0;
|
||||
g_traceRecoder.ctrl.maxObjCount = LOSCFG_TRACE_OBJ_MAX_NUM;
|
||||
g_traceRecoder.ctrl.maxRecordCount = (size - headSize) / sizeof(TraceEventFrame);
|
||||
g_traceRecoder.ctrl.objBuf = (ObjData *)((UINTPTR)buf + g_traceRecoder.head->objOffset);
|
||||
g_traceRecoder.ctrl.frameBuf = (TraceEventFrame *)((UINTPTR)buf + g_traceRecoder.head->frameOffset);
|
||||
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID OsTraceObjAdd(UINT32 eventType, UINT32 taskId) //用于向离线跟踪缓冲区中添加对象数据//
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT32 index;
|
||||
ObjData *obj = NULL;
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
/* add obj begin */
|
||||
index = g_traceRecoder.ctrl.curObjIndex;
|
||||
if (index >= LOSCFG_TRACE_OBJ_MAX_NUM) { /* do nothing when config LOSCFG_TRACE_OBJ_MAX_NUM = 0 */
|
||||
TRACE_UNLOCK(intSave);
|
||||
return;
|
||||
}
|
||||
obj = &g_traceRecoder.ctrl.objBuf[index];
|
||||
|
||||
if (taskId < LOSCFG_BASE_CORE_TSK_LIMIT) {
|
||||
g_tidMask[taskId]++;
|
||||
}
|
||||
|
||||
OsTraceSetObj(obj, OS_TCB_FROM_TID(taskId));
|
||||
|
||||
g_traceRecoder.ctrl.curObjIndex++;
|
||||
if (g_traceRecoder.ctrl.curObjIndex >= g_traceRecoder.ctrl.maxObjCount) {
|
||||
g_traceRecoder.ctrl.curObjIndex = 0; /* turn around */
|
||||
}
|
||||
/* add obj end */
|
||||
TRACE_UNLOCK(intSave);
|
||||
}
|
||||
|
||||
VOID OsTraceWriteOrSendEvent(const TraceEventFrame *frame) //用于向离线跟踪缓冲区中写入或发送事件帧数据//
|
||||
{
|
||||
UINT16 index;
|
||||
UINT32 intSave;
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
index = g_traceRecoder.ctrl.curIndex;
|
||||
(VOID)memcpy_s(&g_traceRecoder.ctrl.frameBuf[index], sizeof(TraceEventFrame), frame, sizeof(TraceEventFrame));
|
||||
|
||||
g_traceRecoder.ctrl.curIndex++;
|
||||
if (g_traceRecoder.ctrl.curIndex >= g_traceRecoder.ctrl.maxRecordCount) {
|
||||
g_traceRecoder.ctrl.curIndex = 0;
|
||||
}
|
||||
TRACE_UNLOCK(intSave);
|
||||
}
|
||||
|
||||
VOID OsTraceReset(VOID) //用于重置离线跟踪缓冲区//
|
||||
{
|
||||
UINT32 intSave;
|
||||
UINT32 bufLen;
|
||||
|
||||
TRACE_LOCK(intSave);
|
||||
bufLen = sizeof(TraceEventFrame) * g_traceRecoder.ctrl.maxRecordCount;
|
||||
(VOID)memset_s(g_traceRecoder.ctrl.frameBuf, bufLen, 0, bufLen);
|
||||
g_traceRecoder.ctrl.curIndex = 0;
|
||||
TRACE_UNLOCK(intSave);
|
||||
}
|
||||
|
||||
STATIC VOID OsTraceInfoObj(VOID) //用于打印离线跟踪对象信息//
|
||||
{
|
||||
UINT32 i;
|
||||
ObjData *obj = &g_traceRecoder.ctrl.objBuf[0];
|
||||
|
||||
if (g_traceRecoder.ctrl.maxObjCount > 0) {
|
||||
PRINTK("CurObjIndex = %u\n", g_traceRecoder.ctrl.curObjIndex);
|
||||
PRINTK("Index TaskID TaskPrio TaskName \n");
|
||||
for (i = 0; i < g_traceRecoder.ctrl.maxObjCount; i++, obj++) {
|
||||
PRINTK("%-7u 0x%-6x %-10u %s\n", i, obj->id, obj->prio, obj->name);
|
||||
}
|
||||
PRINTK("\n");
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID OsTraceInfoEventTitle(VOID) //用于打印离线跟踪事件标题//
|
||||
{
|
||||
PRINTK("CurEvtIndex = %u\n", g_traceRecoder.ctrl.curIndex);
|
||||
|
||||
PRINTK("Index Time(cycles) EventType CurTask Identity ");
|
||||
#ifdef LOSCFG_TRACE_FRAME_CORE_MSG
|
||||
PRINTK("cpuId hwiActive taskLockCnt ");
|
||||
#endif
|
||||
#ifdef LOSCFG_TRACE_FRAME_EVENT_COUNT
|
||||
PRINTK("eventCount ");
|
||||
#endif
|
||||
if (LOSCFG_TRACE_FRAME_MAX_PARAMS > 0) {
|
||||
PRINTK("params ");
|
||||
}
|
||||
PRINTK("\n");
|
||||
}
|
||||
|
||||
STATIC VOID OsTraceInfoEventData(VOID) //用于打印离线跟踪事件数据//
|
||||
{
|
||||
UINT32 i, j;
|
||||
TraceEventFrame *frame = &g_traceRecoder.ctrl.frameBuf[0];
|
||||
|
||||
for (i = 0; i < g_traceRecoder.ctrl.maxRecordCount; i++, frame++) {
|
||||
PRINTK("%-7u 0x%-15llx 0x%-12x 0x%-7x 0x%-11x ", i, frame->curTime, frame->eventType,
|
||||
frame->curTask, frame->identity);
|
||||
#ifdef LOSCFG_TRACE_FRAME_CORE_MSG
|
||||
UINT32 taskLockCnt = frame->core.taskLockCnt;
|
||||
#ifdef LOSCFG_KERNEL_SMP
|
||||
/*
|
||||
* For smp systems, TRACE_LOCK will requst taskLock, and this counter
|
||||
* will increase by 1 in that case.
|
||||
*/
|
||||
taskLockCnt -= 1;
|
||||
#endif
|
||||
PRINTK("%-11u %-11u %-11u", frame->core.cpuId, frame->core.hwiActive, taskLockCnt);
|
||||
#endif
|
||||
#ifdef LOSCFG_TRACE_FRAME_EVENT_COUNT
|
||||
PRINTK("%-11u", frame->eventCount);
|
||||
#endif
|
||||
for (j = 0; j < LOSCFG_TRACE_FRAME_MAX_PARAMS; j++) {
|
||||
PRINTK("0x%-11x", frame->params[j]);
|
||||
}
|
||||
PRINTK("\n");
|
||||
}
|
||||
}
|
||||
|
||||
STATIC VOID OsTraceInfoDisplay(VOID) //用于显示离线跟踪信息//
|
||||
{
|
||||
OfflineHead *head = g_traceRecoder.head;
|
||||
|
||||
PRINTK("*******TraceInfo begin*******\n");
|
||||
PRINTK("clockFreq = %u\n", head->baseInfo.clockFreq);
|
||||
|
||||
OsTraceInfoObj();
|
||||
|
||||
OsTraceInfoEventTitle();
|
||||
OsTraceInfoEventData();
|
||||
|
||||
PRINTK("*******TraceInfo end*******\n");
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_TRACE_CLIENT_INTERACT
|
||||
STATIC VOID OsTraceSendInfo(VOID) //用于发送离线跟踪信息//
|
||||
{
|
||||
UINT32 i;
|
||||
ObjData *obj = NULL;
|
||||
TraceEventFrame *frame = NULL;
|
||||
|
||||
OsTraceDataSend(HEAD, sizeof(OfflineHead), (UINT8 *)g_traceRecoder.head);
|
||||
|
||||
obj = &g_traceRecoder.ctrl.objBuf[0];
|
||||
for (i = 0; i < g_traceRecoder.ctrl.maxObjCount; i++) {
|
||||
OsTraceDataSend(OBJ, sizeof(ObjData), (UINT8 *)(obj + i));
|
||||
}
|
||||
|
||||
frame = &g_traceRecoder.ctrl.frameBuf[0];
|
||||
for (i = 0; i < g_traceRecoder.ctrl.maxRecordCount; i++) {
|
||||
OsTraceDataSend(EVENT, sizeof(TraceEventFrame), (UINT8 *)(frame + i));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
VOID OsTraceRecordDump(BOOL toClient) //用于输出或发送离线跟踪信息//
|
||||
{
|
||||
if (!toClient) { //用于指示是输出还是发送离线跟踪信息//
|
||||
OsTraceInfoDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef LOSCFG_TRACE_CLIENT_INTERACT
|
||||
OsTraceSendInfo();
|
||||
#endif
|
||||
}
|
||||
|
||||
OfflineHead *OsTraceRecordGet(VOID) //用于获取离线跟踪记录的头信息//
|
||||
{
|
||||
return g_traceRecoder.head;
|
||||
}
|
||||
|
||||
#endif /* LOSCFG_RECORDER_MODE_OFFLINE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
@ -0,0 +1,117 @@
|
||||
/* ----------------------------------------------------------------------------
|
||||
* Copyright (c) Huawei Technologies Co., Ltd. 2020-2020. All rights reserved.
|
||||
* Description: LiteOS Trace Online Mode Implementation
|
||||
* Author: Huawei LiteOS Team
|
||||
* Create: 2020-03-31
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this list of
|
||||
* conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
|
||||
* of conditions and the following disclaimer in the documentation and/or other materials
|
||||
* provided with the distribution.
|
||||
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
|
||||
* to endorse or promote products derived from this software without specific prior written
|
||||
* permission.
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
||||
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
* --------------------------------------------------------------------------- */
|
||||
|
||||
#include "los_trace_pri.h"
|
||||
#include "trace_pipeline.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef LOSCFG_RECORDER_MODE_ONLINE
|
||||
UINT32 OsTraceGetMaskTid(UINT32 taskId) //用于获取任务ID的掩码//
|
||||
{
|
||||
return taskId;
|
||||
}
|
||||
|
||||
UINT32 OsTraceBufInit(VOID *buf, UINT32 size) //初始化跟踪缓冲区//
|
||||
{
|
||||
(VOID)buf;
|
||||
(VOID)size;
|
||||
return LOS_OK;
|
||||
}
|
||||
|
||||
VOID OsTraceSendHead(VOID) //发送跟踪数据的头信息//
|
||||
{
|
||||
TraceBaseHeaderInfo head = {
|
||||
.bigLittleEndian = TRACE_BIGLITTLE_WORD,
|
||||
.version = TRACE_VERSION(TRACE_MODE_ONLINE),
|
||||
.clockFreq = GET_SYS_CLOCK(),
|
||||
};
|
||||
|
||||
OsTraceDataSend(HEAD, sizeof(TraceBaseHeaderInfo), (UINT8 *)&head);
|
||||
}
|
||||
|
||||
VOID OsTraceSendNotify(UINT32 type, UINT32 value) //发送通知类型的跟踪数据//
|
||||
{
|
||||
TraceNotifyFrame frame = {
|
||||
.cmd = type,
|
||||
.param = value,
|
||||
};
|
||||
|
||||
OsTraceDataSend(NOTIFY, sizeof(TraceNotifyFrame), (UINT8 *)&frame);
|
||||
}
|
||||
|
||||
STATIC VOID OsTraceSendObj(const LosTaskCB *tcb) //发送对象类型为obj的跟踪数据//
|
||||
{
|
||||
ObjData obj;
|
||||
|
||||
OsTraceSetObj(&obj, tcb);
|
||||
OsTraceDataSend(OBJ, sizeof(ObjData), (UINT8 *)&obj);
|
||||
}
|
||||
|
||||
VOID OsTraceSendObjTable(VOID) //发送对象表类型的跟踪数据//
|
||||
{
|
||||
UINT32 loop;
|
||||
LosTaskCB *tcb = NULL;
|
||||
|
||||
for (loop = 0; loop < g_taskMaxNum; ++loop) {
|
||||
tcb = g_taskCBArray + loop;
|
||||
if (tcb->taskStatus & OS_TASK_STATUS_UNUSED) {
|
||||
continue;
|
||||
}
|
||||
OsTraceSendObj(tcb);
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsTraceObjAdd(UINT32 eventType, UINT32 taskId) //向跟踪记录中添加对象//
|
||||
{
|
||||
if (OsTraceIsEnable()) {
|
||||
OsTraceSendObj(OS_TCB_FROM_TID(taskId));
|
||||
}
|
||||
}
|
||||
|
||||
VOID OsTraceWriteOrSendEvent(const TraceEventFrame *frame) //发送事件数据//
|
||||
{
|
||||
OsTraceDataSend(EVENT, sizeof(TraceEventFrame), (UINT8 *)frame);
|
||||
}
|
||||
|
||||
OfflineHead *OsTraceRecordGet(VOID) //获取离线跟踪记录头//
|
||||
{
|
||||
return NULL; //表示没有离线跟踪记录可用//
|
||||
}
|
||||
|
||||
#endif /* LOSCFG_RECORDER_MODE_ONLINE */
|
||||
|
||||
#ifdef __cplusplus
|
||||
#if __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* __cplusplus */
|
Loading…
Reference in new issue