summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b460492)
raw | patch | inline | side by side (parent: b460492)
author | Lohith Kumar <l-kumar@ti.com> | |
Mon, 23 Jan 2023 09:38:56 +0000 (15:08 +0530) | ||
committer | Lohith Kumar <l-kumar@ti.com> | |
Mon, 23 Jan 2023 09:41:55 +0000 (15:11 +0530) |
- UDMA UT was using baremetal calculation instead of
using freeRTOS API's to profile CPU usage and
always prints 100% cpu usage. This commit uses freeRTOS
API's to profile UDMA UT.
Signed-off-by: Lohith Kumar <l-kumar@ti.com>
using freeRTOS API's to profile CPU usage and
always prints 100% cpu usage. This commit uses freeRTOS
API's to profile UDMA UT.
Signed-off-by: Lohith Kumar <l-kumar@ti.com>
diff --git a/packages/ti/drv/udma/unit_test/udma_ut/makefile b/packages/ti/drv/udma/unit_test/udma_ut/makefile
index 90a0806142b27ee2591a35a03986866f87838dee..d3582d37e49755f7783036183399264bf72a1a9b 100755 (executable)
endif
#
-# This file is common makefile for building UDMA unit test app for both TI-RTOS/baremetal
+# This file is common makefile for building UDMA unit test app for RTOS
#
-SRCDIR = . ./src ./src/soc/$(SOC) ./rtos ./baremetal
-INCDIR = . ./src ./src/soc/$(SOC) ./rtos ./baremetal
+SRCDIR = . ./src ./src/soc/$(SOC) ./rtos
+INCDIR = . ./src ./src/soc/$(SOC) ./rtos
# List all the external components/interfaces, whose interface header files
# need to be included for this component
INCLUDE_EXTERNAL_INTERFACES = pdk
-ifeq ($(BUILD_OS_TYPE), baremetal)
- COMP_LIST_COMMON = $(PDK_COMMON_BAREMETAL_COMP)
- SRCS_COMMON = main_baremetal.c
- ifeq ($(ISA),$(filter $(ISA), a53 a72))
- LNKFLAGS_LOCAL_$(CORE) += --entry Entry
- endif
-endif
-ifeq ($(BUILD_OS_TYPE), tirtos)
- INCLUDE_EXTERNAL_INTERFACES += xdc bios
- COMP_LIST_COMMON = $(PDK_COMMON_TIRTOS_COMP)
- SRCS_COMMON = main_rtos.c
- XDC_CFG_FILE_$(CORE) = $(PDK_INSTALL_PATH)/ti/build/$(SOC)/sysbios_$(ISA).cfg
-endif
-ifeq ($(BUILD_OS_TYPE), freertos)
- COMP_LIST_COMMON = $(PDK_COMMON_FREERTOS_COMP)
- INCLUDE_EXTERNAL_INTERFACES += freertos
- SRCS_COMMON = main_rtos.c
-endif
+COMP_LIST_COMMON = $(PDK_COMMON_FREERTOS_COMP)
+INCLUDE_EXTERNAL_INTERFACES += freertos
+SRCS_COMMON = main_rtos.c
ifeq ($(BUILD_OS_TYPE), safertos)
CFLAGS_OS_DEFINES = -DSAFERTOS
SRCS_COMMON += udma_test_event.c udma_test_flow.c
SRCS_COMMON += udma_test_bug.c udma_test_misc.c
SRCS_COMMON += udma_test_soc.c
-ifneq ($(SOC),$(filter $(SOC), am64x))
- SRCS_COMMON += udma_test_proxy.c udma_test_ring_monitor.c
-endif
SRCS_COMMON += utils_trace.c
-ifneq ($(BUILD_OS_TYPE), baremetal)
- SRCS_COMMON += utils_mem.c
- # Use baremetal utils_perf for FreeRTOS until Load OSAL is implemented
- ifeq ($(BUILD_OS_TYPE), tirtos)
- SRCS_COMMON += utils_prf.c
- else
- SRCS_COMMON += utils_prf_baremetal.c
- endif
-else
- SRCS_COMMON += utils_prf_baremetal.c utils_mem_baremetal.c
-endif
+SRCS_COMMON += utils_mem.c utils_prf.c
CFLAGS_LOCAL_COMMON = $(PDK_CFLAGS) $(UDMA_CFLAGS) $(UDMAUT_CFLAGS) $(CFLAGS_OS_DEFINES)
ifeq ($(UDMA_UT_MANUAL_ENTRY), yes)
ifeq ($(UDMA_UT_DYNAMIC_ANALYSIS), yes)
CFLAGS_LOCAL_COMMON += -DUDMA_UT_DYNAMIC_ANALYSIS -DUDMA_UT_BAREMETAL
endif
-ifeq ($(BUILD_OS_TYPE), baremetal)
- ifeq ($(ISA), c66)
- EXTERNAL_LNKCMD_FILE_LOCAL = baremetal/$(SOC)/linker_$(ISA).cmd
- else
- EXTERNAL_LNKCMD_FILE_LOCAL = baremetal/$(SOC)/linker_$(ISA).lds
- endif
-endif
-ifeq ($(BUILD_OS_TYPE), tirtos)
- EXTERNAL_LNKCMD_FILE_LOCAL = rtos/$(SOC)/linker_$(CORE).lds
-endif
ifeq ($(BUILD_OS_TYPE), freertos)
ifeq ($(SOC),$(filter $(SOC), j721s2))
APPEND_LNKCMD_FILE = rtos/j721s2/linker_append_$(ISA).cmd
diff --git a/packages/ti/drv/udma/unit_test/udma_ut/src/utils_prf.c b/packages/ti/drv/udma/unit_test/udma_ut/src/utils_prf.c
index c3f8beed09ef4476798fa840b2ec60b6d693191b..550dc6fffad6ab20b8be6f901f4fbbd1315d9067 100644 (file)
/*
- * Copyright (c) Texas Instruments Incorporated 2018
+ * Copyright (c) Texas Instruments Incorporated 2018-2023
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
/* ========================================================================== */
#include <string.h>
-#include <xdc/runtime/System.h>
-#include <xdc/runtime/Types.h>
-#include <xdc/runtime/Timestamp.h>
-#include <ti/sysbios/hal/Hwi.h>
-#include <ti/sysbios/utils/Load.h>
-#include <ti/sysbios/knl/Task.h>
-
+#include "ti/osal/osal.h"
+#include "ti/osal/TaskP.h"
+#include "ti/osal/LoadP.h"
#include "udma_test.h"
/* ========================================================================== */
/* ========================================================================== */
static Utils_PrfObj gUtils_prfObj;
-static Utils_AccPrfLoadObj gUtils_accPrfLoadObj;
-static uint32_t gUtils_startLoadCalc = 0;
/* ========================================================================== */
/* Function Definitions */
/* ========================================================================== */
-int32_t Utils_prfInit(void)
-{
- memset(&gUtils_prfObj, 0, sizeof (gUtils_prfObj));
- memset(&gUtils_accPrfLoadObj, 0, sizeof (Utils_AccPrfLoadObj));
-
- return (0);
-}
-
-int32_t Utils_prfDeInit(void)
-{
- return (0);
-}
-
Utils_PrfTsHndl *Utils_prfTsCreate(const char *name)
{
uint32_t hndlId;
uint32_t cookie;
Utils_PrfTsHndl *pHndl = NULL;
- cookie = Hwi_disable();
+ cookie = HwiP_disable();
for (hndlId = 0; hndlId < UTILS_PRF_MAX_HNDL; hndlId++)
{
}
}
- Hwi_restore(cookie);
+ HwiP_restore(cookie);
return (pHndl);
}
endTs = Utils_prfTsGet64();
- cookie = Hwi_disable();
+ cookie = HwiP_disable();
pHndl->totalTs += (endTs - pHndl->startTs);
pHndl->count++;
pHndl->numFrames += numFrames;
- Hwi_restore(cookie);
+ HwiP_restore(cookie);
return (endTs);
}
{
uint32_t cookie;
- cookie = Hwi_disable();
+ cookie = HwiP_disable();
pHndl->totalTs = 0;
pHndl->count = 0;
pHndl->numFrames = 0;
- Hwi_restore(cookie);
+ HwiP_restore(cookie);
return (0);
}
uint64_t Utils_prfTsGet64(void)
{
- uint64_t curTs;
- Types_Timestamp64 ts64;
-
- Timestamp_get64(&ts64);
-
- curTs = ((uint64_t) ts64.hi << 32) | ts64.lo;
-
+ uint64_t curTs = (uint64_t) AppUtils_getCurTimeInMsec();
return (curTs);
}
int32_t Utils_prfTsPrint(Utils_PrfTsHndl *pHndl, uint32_t resetAfterPrint, uint32_t trace)
{
- uint32_t cpuKhz;
uint32_t timeMs, fps, fpc;
- Types_FreqHz cpuHz;
- Timestamp_getFreq(&cpuHz);
- cpuKhz = cpuHz.lo / (uint32_t) 1000U; /* convert to Khz */
-
- timeMs = pHndl->totalTs / cpuKhz;
+ timeMs = pHndl->totalTs;
if(0U == timeMs)
{
int32_t status = CSL_EFAIL;
Utils_PrfLoadObj *pHndl;
- cookie = Hwi_disable();
+ cookie = HwiP_disable();
for (hndlId = 0; hndlId < UTILS_PRF_MAX_HNDL; hndlId++)
{
}
}
- Hwi_restore(cookie);
+ HwiP_restore(cookie);
return (status);
}
int32_t status = CSL_EFAIL;
Utils_PrfLoadObj *pHndl;
- cookie = Hwi_disable();
+ cookie = HwiP_disable();
for (hndlId = 0; hndlId < UTILS_PRF_MAX_HNDL; hndlId++)
{
}
}
- Hwi_restore(cookie);
+ HwiP_restore(cookie);
return (status);
}
int32_t Utils_prfLoadPrintAll(uint32_t printTskLoad, uint32_t trace)
{
- uint32_t hwiLoad, swiLoad, tskLoad, hndlId, cpuLoad;
+ uint32_t tskLoad, hndlId, cpuLoad;
Utils_PrfLoadObj *pHndl;
- hwiLoad = (uint32_t) ((gUtils_accPrfLoadObj.totalHwiThreadTime *
- (uint64_t) 100U) / gUtils_accPrfLoadObj.totalTime);
- swiLoad = (uint32_t) ((gUtils_accPrfLoadObj.totalSwiThreadTime *
- (uint64_t) 100U) / gUtils_accPrfLoadObj.totalTime);
- cpuLoad = (uint32_t) 100U -
- (uint32_t) ((gUtils_accPrfLoadObj.totalIdlTskTime *
- (uint64_t) 100U) /
- gUtils_accPrfLoadObj.totalTime);
+ LoadP_Status status = LoadP_OK;
+ LoadP_Stats loadStatsTask;
+
+ /* Query CPU Load */
+ cpuLoad = LoadP_getCPULoad();
GT_0trace(trace, GT_INFO, "\r\n");
- GT_4trace(trace, GT_INFO,
- " %d: LOAD: CPU: %d%%, HWI: %d%%, SWI:%d%% \r\n",
+ GT_2trace(trace, GT_INFO,
+ " %d: LOAD: CPU: %d%% \r\n",
AppUtils_getCurTimeInMsec(),
- cpuLoad,
- hwiLoad,
- swiLoad);
+ cpuLoad);
if(((uint32_t) TRUE) == printTskLoad)
{
if(TRUE == pHndl->isAlloc)
{
- tskLoad = (uint32_t) ((pHndl->totalTskThreadTime *
- (uint64_t) 100U) /
- gUtils_accPrfLoadObj.totalTime);
+ status += LoadP_getTaskLoad(pHndl->pTsk, &loadStatsTask);
+ tskLoad = loadStatsTask.percentLoad;
GT_3trace(trace, GT_INFO,
" %d: LOAD: TSK: %s: %d%% \r\n",
void Utils_prfLoadCalcStart(void)
{
- uint32_t cookie;
-
- cookie = Hwi_disable();
- gUtils_startLoadCalc = (uint32_t) TRUE;
- Hwi_restore(cookie);
+
+ LoadP_reset();
return;
}
void Utils_prfLoadCalcStop(void)
{
- uint32_t cookie;
-
- cookie = Hwi_disable();
- gUtils_startLoadCalc = FALSE;
- Hwi_restore(cookie);
-
return;
}
uint32_t hndlId;
Utils_PrfLoadObj *pHndl;
- gUtils_accPrfLoadObj.totalHwiThreadTime = 0;
- gUtils_accPrfLoadObj.totalSwiThreadTime = 0;
- gUtils_accPrfLoadObj.totalTime = 0;
- gUtils_accPrfLoadObj.totalIdlTskTime = 0;
-
/* Reset the performace loads accumulator */
for (hndlId = 0; hndlId < UTILS_PRF_MAX_HNDL; hndlId++)
{
/* Function called by Loadupdate for each update cycle */
void Utils_prfLoadUpdate(void)
{
- uint32_t hndlId;
- Load_Stat hwiLoadStat, swiLoadStat, tskLoadStat, idlTskLoadStat;
- TaskP_Handle idlTskHndl = NULL;
- Utils_PrfLoadObj *pHndl;
-
- if(((uint32_t) TRUE) == (uint32_t) gUtils_startLoadCalc)
- {
- idlTskHndl = Task_getIdleTask();
-
- /* Get the all loads first */
- Load_getGlobalHwiLoad(&hwiLoadStat);
- Load_getGlobalSwiLoad(&swiLoadStat);
- Load_getTaskLoad(idlTskHndl, &idlTskLoadStat);
-
- gUtils_accPrfLoadObj.totalHwiThreadTime += hwiLoadStat.threadTime;
- gUtils_accPrfLoadObj.totalSwiThreadTime += swiLoadStat.threadTime;
- gUtils_accPrfLoadObj.totalTime += hwiLoadStat.totalTime;
- gUtils_accPrfLoadObj.totalIdlTskTime += idlTskLoadStat.threadTime;
-
- /* Call the load updated function of each registered task one by one
- * along with the swiLoad, hwiLoad, and Task's own load */
- for (hndlId = 0; hndlId < UTILS_PRF_MAX_HNDL; hndlId++)
- {
- pHndl = &gUtils_prfObj.loadObj[hndlId];
-
- if(((uint32_t) TRUE == pHndl->isAlloc) &&
- (pHndl->pTsk != NULL))
- {
- Load_getTaskLoad(pHndl->pTsk, &tskLoadStat);
- pHndl->totalTskThreadTime += tskLoadStat.threadTime;
- }
- }
- }
-
return;
}
diff --git a/packages/ti/drv/udma/unit_test/udma_ut/src/utils_prf.h b/packages/ti/drv/udma/unit_test/udma_ut/src/utils_prf.h
index ce8c6bd5b605f68fce037d9399d044e679bb5eaf..6c722476644ebf59b533eb49b7ca34e721314ede 100644 (file)
/*
- * Copyright (c) Texas Instruments Incorporated 2018
+ * Copyright (c) Texas Instruments Incorporated 2018-2023
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
/* Function Declarations */
/* ========================================================================== */
-/**
- * \brief Initializes the profiling utility.
- *
- * This function must be called before using any peformance or Timestamp utils
- *
- * \return 0 on success, else failure
- */
-int32_t Utils_prfInit(void);
-
-/**
- * \brief De-initializes the profiling utility.
- *
- * \return 0 on success, else failure
- */
-int32_t Utils_prfDeInit(void);
/**
* \brief Creates the handle for the time stamp taking.