微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 手机设计讨论 > MTK手机平台交流 > heap peak分析的feature

heap peak分析的feature

时间:10-02 整理:3721RD 点击:
feature mtk_HEAP_SIZE_GUARD_ENABLE 可以用来by task统计heap peak状况。在使用时,需要user主动 call register, start 和dump APIs。当前只support GCC和KEIL版本,下面是一段example code:

/* in your file */
#include "FreeRTOS.h"
#include "task.h"
#include "mtk_HeapSizeGuard.h"
BaseType ret;
xTaskHandle myTaskHandle;
/* create your task */
xTaskCreate(...,&myTaskHanlde);
/* register heap size guard request */
ret = xHeapSizeGuard_Register(myTaskHanlde);
/* after registered, will default start profiling, if want to stop or restart profiling, two APIs areavailable calledxHeapSizeGuard_Stop() and xHeapSizeGuard_Restart(). but if restart the profiling, the history statistic data will be cleared */
/* run the scenario which you want to do heap usage profiling, and add the dump function to show the profiling result at the end of the scenario. */ vHeapSizeGuard_DumpInfo(myTaskHanlde);
/* then the heap usage of myTaskHandle will show at the log window */

如果想要统计系统中所有task heap peak状况,可以参考下面的codes:
/* in xTaskGenericCreate() under the path gva\kernel\rtos\FreeRTOS\Source\tasks.c,
after the task created success, add the register function. */
BaseType_t xTaskGenericCreate(...)
{
/* ... */
if( xReturn == pdPASS )
{
#ifdef MTK_HEAP_SIZE_GUARD_ENABLE
extern BaseType_t xHeapSizeGuard_Register(TaskHandle_t);
xHeapSizeGuard_Register(( TaskHandle_t ) pxNewTCB);
#endif
if( xSchedulerRunning != pdFALSE )
{
/* ... */
}
}
/* run the scenario which you want to do heap usage profiling, and add the dump
function at the end of the scenario to show the profiling result. */
/* input the parameter of xTaskHandle as NULL, thenwill dump all registered task heap
usage information.*/
vHeapSizeGuard_DumpInfo(NULL)

感谢分享

谢谢支持

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top