!348 fix: 删除LOS_TRACE 记录SWTMR_START中的无效字段

Merge pull request !348 from LiteOS/trace
This commit is contained in:
openharmony_ci 2021-10-14 09:06:25 +00:00 committed by Gitee
commit c313c189b5
7 changed files with 18 additions and 52 deletions

View File

@ -218,7 +218,7 @@ STATIC VOID LOS_TraceSwtmrExpired(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)

View File

@ -240,7 +240,7 @@ STATIC UINT32 OsCreateTraceAgentTask(VOID)
}
#endif
UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
UINT32 OsTraceInit(VOID)
{
UINT32 intSave;
UINT32 ret;
@ -267,10 +267,15 @@ UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
}
#endif
ret = OsTraceBufInit(buf, size);
#if (LOSCFG_RECORDER_MODE_OFFLINE == 1)
ret = OsTraceBufInit(LOSCFG_TRACE_BUFFER_SIZE);
if (ret != LOS_OK) {
goto LOS_RELEASE;
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
(VOID)LOS_TaskDelete(g_traceTaskId);
#endif
goto LOS_ERREND;
}
#endif
OsTraceHookInstall();
OsTraceCnvInit();
@ -286,10 +291,6 @@ UINT32 LOS_TraceInit(VOID *buf, UINT32 size)
#endif
TRACE_UNLOCK(intSave);
return LOS_OK;
LOS_RELEASE:
#if (LOSCFG_TRACE_CONTROL_AGENT == 1)
LOS_TaskDelete(g_traceTaskId);
#endif
LOS_ERREND:
TRACE_UNLOCK(intSave);
return ret;

View File

@ -320,7 +320,7 @@ extern TRACE_EVENT_HOOK g_traceEventHook;
#define TASK_RESUME_PARAMS(taskId, taskStatus, prio) taskId, taskStatus, prio
#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_EXPIRED_PARAMS(swtmrId) swtmrId
#define SWTMR_STOP_PARAMS(swtmrId) swtmrId
@ -434,33 +434,6 @@ extern TRACE_EVENT_HOOK g_traceEventHook;
#define LOS_TRACE_EASY(...)
#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
* @brief Start trace.

View File

@ -119,10 +119,10 @@ typedef struct {
OfflineHead *head;
} TraceOfflineHeaderInfo;
extern UINT32 OsTraceInit(VOID);
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);
@ -145,6 +145,7 @@ extern VOID OsTraceSendNotify(UINT32 type, UINT32 value);
#define OsTraceReset()
#define OsTraceRecordDump(toClient)
#else
extern UINT32 OsTraceBufInit(UINT32 size);
extern VOID OsTraceReset(VOID);
extern VOID OsTraceRecordDump(BOOL toClient);
#define OsTraceNotifyStart()

View File

@ -49,21 +49,19 @@ UINT32 OsTraceGetMaskTid(UINT32 tid)
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;
VOID *buf = NULL;
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;
}
buf = LOS_MemAlloc(m_aucSysMem0, size);
if (buf == NULL) {
buf = LOS_MemAlloc(m_aucSysMem0, size);
if (buf == NULL) {
return LOS_ERRNO_TRACE_NO_MEMORY;
}
return LOS_ERRNO_TRACE_NO_MEMORY;
}
(VOID)memset_s(buf, size, 0, size);

View File

@ -44,13 +44,6 @@ UINT32 OsTraceGetMaskTid(UINT32 taskId)
return taskId;
}
UINT32 OsTraceBufInit(VOID *buf, UINT32 size)
{
(VOID)buf;
(VOID)size;
return LOS_OK;
}
VOID OsTraceSendHead(VOID)
{
TraceBaseHeaderInfo head = {

View File

@ -187,9 +187,9 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
}
#if (LOSCFG_KERNEL_TRACE == 1)
ret = LOS_TraceInit(NULL, LOSCFG_TRACE_BUFFER_SIZE);
ret = OsTraceInit(LOSCFG_TRACE_BUFFER_SIZE);
if (ret != LOS_OK) {
PRINT_ERR("LOS_TraceInit error\n");
PRINT_ERR("OsTraceInit error\n");
return ret;
}
#endif