fix: 优化trace buffer初始化,删除swtmr 桩中的无效参数
close #I4DPR7 Signed-off-by: LiteOS2021 <dinglu@huawei.com>
This commit is contained in:
parent
badf1e9557
commit
afbc9a593b
|
@ -218,7 +218,7 @@ STATIC VOID LOS_TraceSwtmrExpired(const SWTMR_CTRL_S *swtmr)
|
||||||
|
|
||||||
STATIC VOID LOS_TraceSwtmrStart(const SWTMR_CTRL_S *swtmr)
|
STATIC VOID LOS_TraceSwtmrStart(const SWTMR_CTRL_S *swtmr)
|
||||||
{
|
{
|
||||||
LOS_TRACE(SWTMR_START, swtmr->usTimerID, swtmr->ucMode, swtmr->uwCount, swtmr->uwInterval, 0);
|
LOS_TRACE(SWTMR_START, swtmr->usTimerID, swtmr->ucMode, swtmr->uwInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC VOID LOS_TraceSwtmrStop(const SWTMR_CTRL_S *swtmr)
|
STATIC VOID LOS_TraceSwtmrStop(const SWTMR_CTRL_S *swtmr)
|
||||||
|
|
|
@ -240,7 +240,7 @@ STATIC UINT32 OsCreateTraceAgentTask(VOID)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
|
UINT32 OsTraceInit(VOID)
|
||||||
{
|
{
|
||||||
UINT32 intSave;
|
UINT32 intSave;
|
||||||
UINT32 ret;
|
UINT32 ret;
|
||||||
|
@ -267,10 +267,15 @@ UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = OsTraceBufInit(buf, size);
|
#if (LOSCFG_RECORDER_MODE_OFFLINE == 1)
|
||||||
|
ret = OsTraceBufInit(LOSCFG_TRACE_BUFFER_SIZE);
|
||||||
if (ret != LOS_OK) {
|
if (ret != LOS_OK) {
|
||||||
goto LOS_RELEASE;
|
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
|
||||||
|
(VOID)LOS_TaskDelete(g_traceTaskId);
|
||||||
|
#endif
|
||||||
|
goto LOS_ERREND;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
OsTraceHookInstall();
|
OsTraceHookInstall();
|
||||||
OsTraceCnvInit();
|
OsTraceCnvInit();
|
||||||
|
@ -286,10 +291,6 @@ UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
|
||||||
#endif
|
#endif
|
||||||
TRACE_UNLOCK(intSave);
|
TRACE_UNLOCK(intSave);
|
||||||
return LOS_OK;
|
return LOS_OK;
|
||||||
LOS_RELEASE:
|
|
||||||
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
|
|
||||||
LOS_TaskDelete(g_traceTaskId);
|
|
||||||
#endif
|
|
||||||
LOS_ERREND:
|
LOS_ERREND:
|
||||||
TRACE_UNLOCK(intSave);
|
TRACE_UNLOCK(intSave);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -320,7 +320,7 @@ extern TRACE_EVENT_HOOK g_traceEventHook;
|
||||||
#define TASK_RESUME_PARAMS(taskId, taskStatus, prio) taskId, taskStatus, prio
|
#define TASK_RESUME_PARAMS(taskId, taskStatus, prio) taskId, taskStatus, prio
|
||||||
#define TASK_SIGNAL_PARAMS(taskId, signal, schedFlag) // taskId, signal, schedFlag
|
#define TASK_SIGNAL_PARAMS(taskId, signal, schedFlag) // taskId, signal, schedFlag
|
||||||
|
|
||||||
#define SWTMR_START_PARAMS(swtmrId, mode, overrun, interval, expiry) swtmrId, mode, overrun, interval, expiry
|
#define SWTMR_START_PARAMS(swtmrId, mode, interval) swtmrId, mode, interval
|
||||||
#define SWTMR_DELETE_PARAMS(swtmrId) swtmrId
|
#define SWTMR_DELETE_PARAMS(swtmrId) swtmrId
|
||||||
#define SWTMR_EXPIRED_PARAMS(swtmrId) swtmrId
|
#define SWTMR_EXPIRED_PARAMS(swtmrId) swtmrId
|
||||||
#define SWTMR_STOP_PARAMS(swtmrId) swtmrId
|
#define SWTMR_STOP_PARAMS(swtmrId) swtmrId
|
||||||
|
@ -434,33 +434,6 @@ extern TRACE_EVENT_HOOK g_traceEventHook;
|
||||||
#define LOS_TRACE_EASY(...)
|
#define LOS_TRACE_EASY(...)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
|
||||||
* @ingroup los_trace
|
|
||||||
* @brief Intialize the trace when the system startup.
|
|
||||||
*
|
|
||||||
* @par Description:
|
|
||||||
* This API is used to intilize the trace for system level.
|
|
||||||
* @attention
|
|
||||||
* <ul>
|
|
||||||
* <li>This API can be called only after the memory is initialized. Otherwise, the Trace Init will be fail.</li>
|
|
||||||
* </ul>
|
|
||||||
*
|
|
||||||
* @param buf [IN] Type #VOID *. The ptr is trace buffer address, if ptr is NULL, system will malloc a new one in
|
|
||||||
* trace offline mode.
|
|
||||||
* @param size [IN] Type #UINT32. The trace buffer's size.
|
|
||||||
*
|
|
||||||
* @retval #LOS_ERRNO_TRACE_ERROR_STATUS 0x02001400: The trace status is not TRACE_UNINIT.
|
|
||||||
* @retval #LOS_ERRNO_TRACE_NO_MEMORY 0x02001401: The memory is not enough for initilize.
|
|
||||||
* @retval #LOS_ERRNO_TRACE_BUF_TOO_SMALL 0x02001402: Trace buf size not enough.
|
|
||||||
* @retval #LOS_ERRNO_TSK_TCB_UNAVAILABLE 0x02000211: No free task control block is available.
|
|
||||||
* @retval #LOS_ERRNO_TSK_MP_SYNC_RESOURCE 0x02000225: Mp sync resource create failed
|
|
||||||
* @retval #LOS_OK 0x00000000: The intialization is successful.
|
|
||||||
* @par Dependency:
|
|
||||||
* <ul><li>los_trace.h: the header file that contains the API declaration.</li></ul>
|
|
||||||
* @see LOS_TraceInit
|
|
||||||
*/
|
|
||||||
extern UINT32 LOS_TraceInit(VOID *buf, UINT32 size);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ingroup los_trace
|
* @ingroup los_trace
|
||||||
* @brief Start trace.
|
* @brief Start trace.
|
||||||
|
|
|
@ -119,10 +119,10 @@ typedef struct {
|
||||||
OfflineHead *head;
|
OfflineHead *head;
|
||||||
} TraceOfflineHeaderInfo;
|
} TraceOfflineHeaderInfo;
|
||||||
|
|
||||||
|
extern UINT32 OsTraceInit(VOID);
|
||||||
extern UINT32 OsTraceGetMaskTid(UINT32 taskId);
|
extern UINT32 OsTraceGetMaskTid(UINT32 taskId);
|
||||||
extern VOID OsTraceSetObj(ObjData *obj, const LosTaskCB *tcb);
|
extern VOID OsTraceSetObj(ObjData *obj, const LosTaskCB *tcb);
|
||||||
extern VOID OsTraceWriteOrSendEvent(const TraceEventFrame *frame);
|
extern VOID OsTraceWriteOrSendEvent(const TraceEventFrame *frame);
|
||||||
extern UINT32 OsTraceBufInit(VOID *buf, UINT32 size);
|
|
||||||
extern VOID OsTraceObjAdd(UINT32 eventType, UINT32 taskId);
|
extern VOID OsTraceObjAdd(UINT32 eventType, UINT32 taskId);
|
||||||
extern BOOL OsTraceIsEnable(VOID);
|
extern BOOL OsTraceIsEnable(VOID);
|
||||||
extern OfflineHead *OsTraceRecordGet(VOID);
|
extern OfflineHead *OsTraceRecordGet(VOID);
|
||||||
|
@ -145,6 +145,7 @@ extern VOID OsTraceSendNotify(UINT32 type, UINT32 value);
|
||||||
#define OsTraceReset()
|
#define OsTraceReset()
|
||||||
#define OsTraceRecordDump(toClient)
|
#define OsTraceRecordDump(toClient)
|
||||||
#else
|
#else
|
||||||
|
extern UINT32 OsTraceBufInit(UINT32 size);
|
||||||
extern VOID OsTraceReset(VOID);
|
extern VOID OsTraceReset(VOID);
|
||||||
extern VOID OsTraceRecordDump(BOOL toClient);
|
extern VOID OsTraceRecordDump(BOOL toClient);
|
||||||
#define OsTraceNotifyStart()
|
#define OsTraceNotifyStart()
|
||||||
|
|
|
@ -49,22 +49,20 @@ UINT32 OsTraceGetMaskTid(UINT32 tid)
|
||||||
return tid | ((tid < LOSCFG_BASE_CORE_TSK_LIMIT) ? g_tidMask[tid] << BITS_NUM_FOR_TASK_ID : 0); /* tid < 65535 */
|
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 OsTraceBufInit(UINT32 size)
|
||||||
{
|
{
|
||||||
UINT32 headSize;
|
UINT32 headSize;
|
||||||
|
VOID *buf = NULL;
|
||||||
headSize = sizeof(OfflineHead) + sizeof(ObjData) * LOSCFG_TRACE_OBJ_MAX_NUM;
|
headSize = sizeof(OfflineHead) + sizeof(ObjData) * LOSCFG_TRACE_OBJ_MAX_NUM;
|
||||||
if (size <= headSize) {
|
if (size <= headSize) {
|
||||||
TRACE_ERROR("trace buf size not enough than 0x%x\n", headSize);
|
TRACE_ERROR("trace buf size not enough than 0x%x\n", headSize);
|
||||||
return LOS_ERRNO_TRACE_BUF_TOO_SMALL;
|
return LOS_ERRNO_TRACE_BUF_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (buf == NULL) {
|
|
||||||
buf = LOS_MemAlloc(m_aucSysMem0, size);
|
buf = LOS_MemAlloc(m_aucSysMem0, size);
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
return LOS_ERRNO_TRACE_NO_MEMORY;
|
return LOS_ERRNO_TRACE_NO_MEMORY;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
(VOID)memset_s(buf, size, 0, size);
|
(VOID)memset_s(buf, size, 0, size);
|
||||||
g_traceRecoder.head = (OfflineHead *)buf;
|
g_traceRecoder.head = (OfflineHead *)buf;
|
||||||
|
|
|
@ -44,13 +44,6 @@ UINT32 OsTraceGetMaskTid(UINT32 taskId)
|
||||||
return taskId;
|
return taskId;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT32 OsTraceBufInit(VOID *buf, UINT32 size)
|
|
||||||
{
|
|
||||||
(VOID)buf;
|
|
||||||
(VOID)size;
|
|
||||||
return LOS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID OsTraceSendHead(VOID)
|
VOID OsTraceSendHead(VOID)
|
||||||
{
|
{
|
||||||
TraceBaseHeaderInfo head = {
|
TraceBaseHeaderInfo head = {
|
||||||
|
|
|
@ -187,9 +187,9 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (LOSCFG_KERNEL_TRACE == 1)
|
#if (LOSCFG_KERNEL_TRACE == 1)
|
||||||
ret = LOS_TraceInit(NULL, LOSCFG_TRACE_BUFFER_SIZE);
|
ret = OsTraceInit(LOSCFG_TRACE_BUFFER_SIZE);
|
||||||
if (ret != LOS_OK) {
|
if (ret != LOS_OK) {
|
||||||
PRINT_ERR("LOS_TraceInit error\n");
|
PRINT_ERR("OsTraceInit error\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue