|
|
@ -38,20 +38,21 @@ extern "C" {
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef LOSCFG_DEBUG_QUEUE
|
|
|
|
#ifdef LOSCFG_DEBUG_QUEUE //用于保存队列的调试信息//
|
|
|
|
typedef struct {
|
|
|
|
typedef struct {
|
|
|
|
TSK_ENTRY_FUNC creator; /* The task entry who created this queue */
|
|
|
|
TSK_ENTRY_FUNC creator; /* The task entry who created this queue */
|
|
|
|
UINT64 lastAccessTime; /* The last access time */
|
|
|
|
UINT64 lastAccessTime; /* The last access time */
|
|
|
|
} QueueDebugCB;
|
|
|
|
} QueueDebugCB;
|
|
|
|
STATIC QueueDebugCB *g_queueDebugArray = NULL;
|
|
|
|
STATIC QueueDebugCB *g_queueDebugArray = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//用于比较队列中的元素值//
|
|
|
|
STATIC BOOL QueueCompareValue(const SortParam *sortParam, UINT32 left, UINT32 right)
|
|
|
|
STATIC BOOL QueueCompareValue(const SortParam *sortParam, UINT32 left, UINT32 right)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return (*((UINT64 *)(VOID *)SORT_ELEM_ADDR(sortParam, left)) >
|
|
|
|
return (*((UINT64 *)(VOID *)SORT_ELEM_ADDR(sortParam, left)) >
|
|
|
|
*((UINT64 *)(VOID *)SORT_ELEM_ADDR(sortParam, right)));
|
|
|
|
*((UINT64 *)(VOID *)SORT_ELEM_ADDR(sortParam, right)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
UINT32 OsQueueDbgInit(VOID)
|
|
|
|
UINT32 OsQueueDbgInit(VOID) //用于初始化队列的调试信息//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
UINT32 size = LOSCFG_BASE_IPC_QUEUE_LIMIT * sizeof(QueueDebugCB);
|
|
|
|
UINT32 size = LOSCFG_BASE_IPC_QUEUE_LIMIT * sizeof(QueueDebugCB);
|
|
|
|
|
|
|
|
|
|
|
@ -65,14 +66,14 @@ UINT32 OsQueueDbgInit(VOID)
|
|
|
|
return LOS_OK;
|
|
|
|
return LOS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID OsQueueDbgTimeUpdate(UINT32 queueId)
|
|
|
|
VOID OsQueueDbgTimeUpdate(UINT32 queueId) //用于更新队列的最后访问时间//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QueueDebugCB *queueDebug = &g_queueDebugArray[GET_QUEUE_INDEX(queueId)];
|
|
|
|
QueueDebugCB *queueDebug = &g_queueDebugArray[GET_QUEUE_INDEX(queueId)];
|
|
|
|
queueDebug->lastAccessTime = LOS_TickCountGet();
|
|
|
|
queueDebug->lastAccessTime = LOS_TickCountGet();
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID OsQueueDbgUpdate(UINT32 queueId, TSK_ENTRY_FUNC entry)
|
|
|
|
VOID OsQueueDbgUpdate(UINT32 queueId, TSK_ENTRY_FUNC entry) //用于更新队列的调试信息//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QueueDebugCB *queueDebug = &g_queueDebugArray[GET_QUEUE_INDEX(queueId)];
|
|
|
|
QueueDebugCB *queueDebug = &g_queueDebugArray[GET_QUEUE_INDEX(queueId)];
|
|
|
|
queueDebug->creator = entry;
|
|
|
|
queueDebug->creator = entry;
|
|
|
@ -80,7 +81,7 @@ VOID OsQueueDbgUpdate(UINT32 queueId, TSK_ENTRY_FUNC entry)
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
STATIC INLINE VOID OsQueueInfoOutPut(const LosQueueCB *node)
|
|
|
|
STATIC INLINE VOID OsQueueInfoOutPut(const LosQueueCB *node) //用于输出队列的信息//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PRINTK("Queue ID <0x%x> may leak, queue len is 0x%x, "
|
|
|
|
PRINTK("Queue ID <0x%x> may leak, queue len is 0x%x, "
|
|
|
|
"readable cnt:0x%x, writeable cnt:0x%x, ",
|
|
|
|
"readable cnt:0x%x, writeable cnt:0x%x, ",
|
|
|
@ -90,13 +91,13 @@ STATIC INLINE VOID OsQueueInfoOutPut(const LosQueueCB *node)
|
|
|
|
node->readWriteableCnt[OS_QUEUE_WRITE]);
|
|
|
|
node->readWriteableCnt[OS_QUEUE_WRITE]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
STATIC INLINE VOID OsQueueOpsOutput(const QueueDebugCB *node)
|
|
|
|
STATIC INLINE VOID OsQueueOpsOutput(const QueueDebugCB *node) //用于输出队列操作的信息//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
PRINTK("TaskEntry of creator:0x%p, Latest operation time: 0x%llx\n",
|
|
|
|
PRINTK("TaskEntry of creator:0x%p, Latest operation time: 0x%llx\n",
|
|
|
|
node->creator, node->lastAccessTime);
|
|
|
|
node->creator, node->lastAccessTime);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
STATIC VOID SortQueueIndexArray(UINT32 *indexArray, UINT32 count)
|
|
|
|
STATIC VOID SortQueueIndexArray(UINT32 *indexArray, UINT32 count) //用于对队列索引数组进行排序并输出相应的队列信息//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LosQueueCB queueNode = {0};
|
|
|
|
LosQueueCB queueNode = {0};
|
|
|
|
QueueDebugCB queueDebugNode = {0};
|
|
|
|
QueueDebugCB queueDebugNode = {0};
|
|
|
@ -128,7 +129,7 @@ STATIC VOID SortQueueIndexArray(UINT32 *indexArray, UINT32 count)
|
|
|
|
(VOID)LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, indexArray);
|
|
|
|
(VOID)LOS_MemFree((VOID *)OS_SYS_MEM_ADDR, indexArray);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
VOID OsQueueCheck(VOID)
|
|
|
|
VOID OsQueueCheck(VOID) //用于检查队列的状态并输出相应信息//
|
|
|
|
{
|
|
|
|
{
|
|
|
|
LosQueueCB queueNode = {0};
|
|
|
|
LosQueueCB queueNode = {0};
|
|
|
|
QueueDebugCB queueDebugNode = {0};
|
|
|
|
QueueDebugCB queueDebugNode = {0};
|
|
|
@ -182,6 +183,7 @@ VOID OsQueueCheck(VOID)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef LOSCFG_SHELL
|
|
|
|
#ifdef LOSCFG_SHELL
|
|
|
|
|
|
|
|
//当用户输入 "queue" 命令时,会输出已使用队列的信息//
|
|
|
|
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdQueueInfoGet(UINT32 argc, const CHAR **argv)
|
|
|
|
LITE_OS_SEC_TEXT_MINOR UINT32 OsShellCmdQueueInfoGet(UINT32 argc, const CHAR **argv)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (argc > 0) {
|
|
|
|
if (argc > 0) {
|
|
|
|