From 3b9cea492f23d7dabb9ffa0e69631b858ba8e90a Mon Sep 17 00:00:00 2001 From: Karthik Ramanan Date: Mon, 20 Jun 2016 17:18:42 +0530 Subject: [PATCH 1/1] get_rproc_info: Introduce new API to query remoteproc This is the initial implementation of an extensible API that allows the user to query various remote core parameters. Currently, there are three query parameters that are supported: 1. CPU Load 2. Total configured heap size 3. Available heap size The intent of this API is to programmatically call the API and feed it in various other tools that can be developed on top of this (for example: soc performance visualization etc.) NOTE: This would require a corresponding change in the libdce as well. Signed-off-by: Karthik Ramanan --- src/ti/framework/dce/dce.c | 48 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/src/ti/framework/dce/dce.c b/src/ti/framework/dce/dce.c index 875b33e..957bf69 100644 --- a/src/ti/framework/dce/dce.c +++ b/src/ti/framework/dce/dce.c @@ -60,6 +60,7 @@ #include #include #include +#include #include "dce_priv.h" #include "dce_rpc.h" @@ -98,6 +99,7 @@ typedef void (*DeleteFxn)(void *); /* DCE Server static function declarations */ static Int32 engine_open(UInt32 size, UInt32 *data); static Int32 engine_close(UInt32 size, UInt32 *data); +static Int32 get_rproc_info(UInt32 size, UInt32 *data); /* VIDDEC2 Decoder Server static function declarations */ static VIDDEC2_Handle viddec2_create(Engine_Handle engine, String name, VIDDEC2_Params *params); @@ -400,6 +402,42 @@ static Int32 engine_close(UInt32 size, UInt32 *data) return (0); } +#define INFO_TYPE_CPU_LOAD 0 +#define INFO_TYPE_TOTAL_HEAP_SIZE 1 +#define INFO_TYPE_AVAILABLE_HEAP_SIZE 2 + +static Int32 get_rproc_info(UInt32 size, UInt32 *data) +{ + MmType_Param *payload = (MmType_Param *)data; + Uint32 info_type = (Uint32)payload[0].data; + Uint32 output = 0; + Memory_Stats stats; + + switch(info_type) + { + case INFO_TYPE_CPU_LOAD: + output = Load_getCPULoad(); + break; + + case INFO_TYPE_TOTAL_HEAP_SIZE: + Memory_getStats(NULL, &stats); + output = stats.totalSize; + break; + + case INFO_TYPE_AVAILABLE_HEAP_SIZE: + Memory_getStats(NULL, &stats); + output = stats.totalFreeSize; + break; + + default: + System_printf("\n ERROR: Invalid INFO TYPE chosen \n"); + break; + } + + return output; +} + + /* * codec_create */ @@ -699,7 +737,8 @@ static RcmServer_FxnDesc DCEServerFxnAry[] = { "codec_control", (RcmServer_MsgFxn) codec_control }, { "codec_get_version", (RcmServer_MsgFxn) codec_get_version }, { "codec_process", (RcmServer_MsgFxn) codec_process }, - { "codec_delete", (RcmServer_MsgFxn) codec_delete } + { "codec_delete", (RcmServer_MsgFxn) codec_delete }, + { "get_rproc_info", (RcmServer_MsgFxn) get_rproc_info } }; /* DCE Server skel function table */ @@ -767,7 +806,12 @@ static MmType_FxnSig DCEServer_sigAry[] = { MmType_Dir_Out, MmType_Param_S32, 1 }, // return { MmType_Dir_In, MmType_Param_U32, 1 }, { MmType_Dir_In, MmType_Param_U32, 1 } - } } + } }, + { "get_rproc_info", 2, + { + { MmType_Dir_Out, MmType_Param_S32, 1 }, // return + { MmType_Dir_In, MmType_Param_U32, 1 } + } } }; static MmType_FxnSigTab dce_fxnSigTab = -- 2.39.2