]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/dspdce.git/commitdiff
get_rproc_info: Introduce new API to query remoteproc 1.00.00.08
authorKarthik Ramanan <a0393906@ti.com>
Mon, 20 Jun 2016 11:48:42 +0000 (17:18 +0530)
committerKarthik Ramanan <a0393906@ti.com>
Mon, 20 Jun 2016 11:48:42 +0000 (17:18 +0530)
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 <a0393906@ti.com>
src/ti/framework/dce/dce.c

index 875b33e37134bf69e5e7f538d4e6e11aade3ac60..957bf6966e32bc4faecd2999e010304499a1b02f 100644 (file)
@@ -60,6 +60,7 @@
 #include <xdc/runtime/IHeap.h>\r
 #include <xdc/runtime/knl/Thread.h>\r
 #include <xdc/std.h>\r
 #include <xdc/runtime/IHeap.h>\r
 #include <xdc/runtime/knl/Thread.h>\r
 #include <xdc/std.h>\r
+#include <ti/sysbios/utils/Load.h>\r
 \r
 #include "dce_priv.h"\r
 #include "dce_rpc.h"\r
 \r
 #include "dce_priv.h"\r
 #include "dce_rpc.h"\r
@@ -98,6 +99,7 @@ typedef void (*DeleteFxn)(void *);
 /* DCE Server static function declarations */\r
 static Int32 engine_open(UInt32 size, UInt32 *data);\r
 static Int32 engine_close(UInt32 size, UInt32 *data);\r
 /* DCE Server static function declarations */\r
 static Int32 engine_open(UInt32 size, UInt32 *data);\r
 static Int32 engine_close(UInt32 size, UInt32 *data);\r
+static Int32 get_rproc_info(UInt32 size, UInt32 *data);\r
 \r
 /* VIDDEC2 Decoder Server static function declarations */\r
 static VIDDEC2_Handle viddec2_create(Engine_Handle engine, String name, VIDDEC2_Params *params);\r
 \r
 /* VIDDEC2 Decoder Server static function declarations */\r
 static VIDDEC2_Handle viddec2_create(Engine_Handle engine, String name, VIDDEC2_Params *params);\r
@@ -400,6 +402,42 @@ static Int32 engine_close(UInt32 size, UInt32 *data)
     return (0);\r
 }\r
 \r
     return (0);\r
 }\r
 \r
+#define INFO_TYPE_CPU_LOAD 0\r
+#define INFO_TYPE_TOTAL_HEAP_SIZE 1\r
+#define INFO_TYPE_AVAILABLE_HEAP_SIZE 2\r
+\r
+static Int32 get_rproc_info(UInt32 size, UInt32 *data)\r
+{\r
+    MmType_Param    *payload = (MmType_Param *)data;\r
+    Uint32           info_type = (Uint32)payload[0].data;\r
+    Uint32 output = 0;\r
+    Memory_Stats    stats;\r
+\r
+    switch(info_type)\r
+    {\r
+            case INFO_TYPE_CPU_LOAD:\r
+               output = Load_getCPULoad();\r
+                break;\r
+\r
+            case INFO_TYPE_TOTAL_HEAP_SIZE:\r
+                Memory_getStats(NULL, &stats);\r
+                output = stats.totalSize;\r
+                break;\r
+\r
+            case INFO_TYPE_AVAILABLE_HEAP_SIZE:\r
+                Memory_getStats(NULL, &stats);\r
+                output = stats.totalFreeSize;\r
+                break;\r
+\r
+            default:\r
+                System_printf("\n ERROR: Invalid INFO TYPE chosen \n");\r
+                break;\r
+    }\r
+\r
+    return output;\r
+}\r
+\r
+\r
 /*\r
   * codec_create\r
   */\r
 /*\r
   * codec_create\r
   */\r
@@ -699,7 +737,8 @@ static RcmServer_FxnDesc    DCEServerFxnAry[] =
     { "codec_control",     (RcmServer_MsgFxn) codec_control },\r
     { "codec_get_version", (RcmServer_MsgFxn) codec_get_version },\r
     { "codec_process",     (RcmServer_MsgFxn) codec_process },\r
     { "codec_control",     (RcmServer_MsgFxn) codec_control },\r
     { "codec_get_version", (RcmServer_MsgFxn) codec_get_version },\r
     { "codec_process",     (RcmServer_MsgFxn) codec_process },\r
-    { "codec_delete",      (RcmServer_MsgFxn) codec_delete }\r
+    { "codec_delete",      (RcmServer_MsgFxn) codec_delete },\r
+    { "get_rproc_info",    (RcmServer_MsgFxn) get_rproc_info }\r
 };\r
 \r
 /* DCE Server skel function table */\r
 };\r
 \r
 /* DCE Server skel function table */\r
@@ -767,7 +806,12 @@ static MmType_FxnSig    DCEServer_sigAry[] =
           { MmType_Dir_Out, MmType_Param_S32, 1 }, // return\r
           { MmType_Dir_In, MmType_Param_U32, 1 },\r
           { MmType_Dir_In, MmType_Param_U32, 1 }\r
           { MmType_Dir_Out, MmType_Param_S32, 1 }, // return\r
           { MmType_Dir_In, MmType_Param_U32, 1 },\r
           { MmType_Dir_In, MmType_Param_U32, 1 }\r
-      } }\r
+     } },\r
+    { "get_rproc_info", 2,\r
+      {\r
+         { MmType_Dir_Out, MmType_Param_S32, 1 }, // return\r
+          { MmType_Dir_In, MmType_Param_U32, 1 }\r
+     } }\r
 };\r
 \r
 static MmType_FxnSigTab    dce_fxnSigTab =\r
 };\r
 \r
 static MmType_FxnSigTab    dce_fxnSigTab =\r