PASDK-71:Add benchmark configuration for all ASPs using PFP
authorFrank Livingston <frank-livingston@ti.com>
Fri, 28 Apr 2017 02:33:08 +0000 (21:33 -0500)
committerFrank Livingston <frank-livingston@ti.com>
Fri, 28 Apr 2017 02:33:08 +0000 (21:33 -0500)
pasdk/common/asp0.c
pasdk/common/pfp_app.h
pasdk/test_arm/framework/audioStreamDecodeProc.c
pasdk/test_dsp/framework/audioStreamInpProc.c
pasdk/test_dsp/framework/audioStreamOutProc.c

index a958ea96b34d8e2e916c37f726bf3f44ca009ccc..ffd178bb34814fcca9d1dd34dbf8c9ee5af209df 100644 (file)
@@ -91,8 +91,10 @@ volatile UInt32 time32_1, time32_2;
 #ifdef _TMS320C6X
 #define ASP_NUM_PROFILE  ( 0 )              // Profile CAR; As we have DEC->CAR(0)->OAR(1)->BMDA(2)->ENC
 UInt32 gAspProfileEnable = 0;               // ASP profile enable flag
-UInt32 gAspNumProfile = ASP_NUM_PROFILE;    // ASP number in chain starting from 0
-UInt32 gAspCurCount = 0;                    // ASP number in chain starting from 0
+//UInt32 gAspNumProfile = ASP_NUM_PROFILE;    // ASP number in chain starting from 0
+Int32 gAspNumProfile = -1;                 // Number of ASP in chain to profile or -1 to indicate all ASPs
+//UInt32 gAspCurCount = 0;                    // ASP number in chain starting from 0
+Int32 gAspPfpId;                           // Number of ASP in chain to profile or -1 to indicate all ASPs
 #endif // _TMS320C6X
 
 
@@ -321,7 +323,7 @@ PAF_ASP_chainApply_ (PAF_ASP_Chain *this, PAF_AudioFrame *pAudioFrame)
                        this->stream, i, alg);
         }
         Log_info3("PAF_ASP_chainApply_: AS_%d. link %d.  alg: 0x%x.", this->stream, i, (IArg)alg);
-
+  
         if (alg->fxns->apply /*&& (errno = alg->fxns->apply(alg, pAudioFrame))*/)
         {
 #ifdef PROFILER
@@ -332,20 +334,37 @@ PAF_ASP_chainApply_ (PAF_ASP_Chain *this, PAF_AudioFrame *pAudioFrame)
 #endif
 
 #ifdef _TMS320C6X
-            if ((gAspProfileEnable == 1) && (gAspNumProfile == gAspCurCount))  // only profile the selected ASP
-            {                
-                pfpBegin(PFP_ID_TASK1_2, Task_self());
+            if (gAspProfileEnable == 1)
+            {
+                if (gAspNumProfile == (i-1))
+                {
+                    // only profile the selected ASP
+                    pfpBegin(PFP_ID_ASOT_ASP_0, Task_self());
+                }
+                else if ((gAspNumProfile == -1) && (i <= PFP_MAX_ASP))
+                {
+                    // profile current ASP
+                    pfpBegin(PFP_ID_ASOT_ASP_0+(i-1), Task_self());
+                }
             }
 #endif            
 
             errno = alg->fxns->apply(alg, pAudioFrame);
             
 #ifdef _TMS320C6X
-            if ((gAspProfileEnable == 1) && (gAspNumProfile == gAspCurCount))  // only profile the selected ASP
+            if (gAspProfileEnable == 1)
             {
-                pfpEnd(PFP_ID_TASK1_2, PFP_FINISH_MEAS);
+                if (gAspNumProfile == (i-1))
+                {
+                    // only profile the selected ASP
+                    pfpEnd(PFP_ID_ASOT_ASP_0, PFP_FINISH_MEAS);
+                }
+                else if ((gAspNumProfile == -1) && (i <= PFP_MAX_ASP))
+                {
+                    // profile current ASP
+                    pfpEnd(PFP_ID_ASOT_ASP_0+(i-1), PFP_FINISH_MEAS);
+                }
             }
-            gAspCurCount++;
 #endif            
 
 #ifdef PROFILER
@@ -384,10 +403,6 @@ PAF_ASP_chainApply_ (PAF_ASP_Chain *this, PAF_AudioFrame *pAudioFrame)
                 LOG_printf(&trace, "AS%d: ASP code 0x%08x apply error 0x%x.",
                     this->stream, pLink->code.full, errno);
 
-#ifdef _TMS320C6X
-                // Reset ASP count for next frame
-                gAspCurCount = 0;
-#endif
 #ifdef PROFILER
                 // Reset ASP count for next frame
                 currentAspCount = 0;
@@ -398,10 +413,6 @@ PAF_ASP_chainApply_ (PAF_ASP_Chain *this, PAF_AudioFrame *pAudioFrame)
         }
     }
     
-#ifdef _TMS320C6X    
-    // Reset ASP count for next frame
-    gAspCurCount = 0;
-#endif    
 #ifdef PROFILER
     // Reset ASP count for next frame
     currentAspCount = 0;
index fa35075439abc1947a62b12d2067a962d6c18961..77ec563fda6bc3e1dc8d4a2ed13ce4956fcbf8a4 100644 (file)
 #include "pfp/pfp.h"
 
 #ifdef _TMS320C6X
+#define PFP_MAX_ASP     ( 4 )
+
 /* Define all PFP ID's */
-#define PFP_ID_MAIN     0
-#define PFP_ID_TASK0_1  1   /* ASIT, decode processing */
-#define PFP_ID_TASK0_2  2   
-#define PFP_ID_TASK1_1  3   /* ASOT, output processing */
-#define PFP_ID_TASK1_2  4   /* ASP */
-#define PFP_ID_LAST PFP_ID_TASK1_2
+#define PFP_ID_MAIN         0
+#define PFP_ID_ASIT_0       1   /* ASIT, auto processing */
+#define PFP_ID_ASIT_1       2   /* ASIT, decode processing */
+#define PFP_ID_ASIT_2       3
+#define PFP_ID_ASOT_0       4   /* ASOT, output processing */
+#define PFP_ID_ASOT_1       5
+#define PFP_ID_ASOT_ASP_0   6   /* ASP 0 */
+#define PFP_ID_ASOT_ASP_1   7   /* ASP 1 */
+#define PFP_ID_ASOT_ASP_2   8   /* ASP 2 */
+#define PFP_ID_ASOT_ASP_3   9   /* ASP 3 */
+#define PFP_ID_LAST PFP_ID_ASOT_ASP_3
 
 #if PFP_ID_LAST >= PFP_PPCNT_MAX
 #error too many PP IDs
 #else /* _TMS320C6X */
 
 /* Define all PFP ID's */
-#define PFP_ID_MAIN     0
-#define PFP_ID_TASK0_1  1   /* INFO */
-#define PFP_ID_TASK0_2  2   /* DECODE */
-#define PFP_ID_TASK0_3  3
-#define PFP_ID_LAST PFP_ID_TASK0_2
+#define PFP_ID_MAIN         0
+#define PFP_ID_ASDT_0       1   /* INFO */
+#define PFP_ID_ASDT_1       2   /* DECODE */
+#define PFP_ID_ASDT_2       3
+#define PFP_ID_LAST PFP_ID_ASDT_2
 
 #if PFP_ID_LAST >= PFP_PPCNT_MAX
 #error too many PP IDs
index 2cf9b2cb48fb958f2d4d25f558850bf8c4ab2b2a..8e04bfa199de3a17478968b0d760cb314f5b61cd 100644 (file)
@@ -208,8 +208,6 @@ Void taskAsdpFxn(
 
     // invalidate AST shared configuration
     Cache_inv(pAstCfg, sizeof(PAF_AST_Config), Cache_Type_ALLD, 0);
-    // FL: no need to share this pointer, can be local
-    //Cache_inv(&pC, sizeof(PAF_AST_Config *), Cache_Type_ALLD, 0);
     Cache_wait();
     
     // (***) FL: revisit
@@ -622,9 +620,9 @@ Void taskAsdpFxn(
                     errno = 0;
                     if (dec->fxns->info)
                     {
-                        pfpBegin(PFP_ID_TASK0_1, pC->taskHandle);
+                        pfpBegin(PFP_ID_ASDT_0, pC->taskHandle);
                         errno = dec->fxns->info(dec, NULL, &pAstCfg->xDec[z].decodeControl, &pAstCfg->xDec[z].decodeStatus);
-                        pfpEnd(PFP_ID_TASK0_1, PFP_FINISH_MEAS);
+                        pfpEnd(PFP_ID_ASDT_0, PFP_FINISH_MEAS);
                     }
                     
                     // write back Dec configuration
@@ -696,9 +694,9 @@ Void taskAsdpFxn(
                         // FL: debug, capture input buffer
                         //capIb(pAstCfg->xInp[z].pInpBuf);
                     
-                        pfpBegin(PFP_ID_TASK0_2, pC->taskHandle);
+                        pfpBegin(PFP_ID_ASDT_1, pC->taskHandle);
                         errno = dec->fxns->decode(dec, NULL, &pAstCfg->xDec[z].decodeInStruct, &pAstCfg->xDec[z].decodeOutStruct);
-                        pfpEnd(PFP_ID_TASK0_2, PFP_FINISH_MEAS);
+                        pfpEnd(PFP_ID_ASDT_1, PFP_FINISH_MEAS);
                         if (errno < 0)
                         {
                             //SW_BREAKPOINT;
index 443428e698f10d4421950cdbd58db72dfe0ab6e9..109c1ee9a3c5352a8dfbf715361fac7ea3603301 100644 (file)
@@ -2249,8 +2249,8 @@ PAF_ASIT_decodeProcessing(
                 
                 // Measure cycles in decode processing loop.
                 // Only measures cycles spent in loop.
-                pfpEnd(PFP_ID_TASK0_1, PFP_FINISH_MEAS);
-                pfpBegin(PFP_ID_TASK0_1, pC->taskHandle);
+                pfpEnd(PFP_ID_ASIT_1, PFP_FINISH_MEAS);
+                pfpBegin(PFP_ID_ASIT_1, pC->taskHandle);
 
                 if (errno = pP->fxns->decodeInfo2(pP, pQ, pC, frame, block))
                 {
index 416b56e1edf982dcfbef6ad5b3b6e360305949c0..0aa79e202a6850cd2e152b8cbb4baa5f611452cb 100644 (file)
@@ -1457,8 +1457,8 @@ PAF_ASOT_decodeProcessing(
                 
                 // Measure cycles in output processing loop.
                 // Only measures cycles spent in loop.
-                pfpEnd(PFP_ID_TASK1_1, PFP_FINISH_MEAS);
-                pfpBegin(PFP_ID_TASK1_1, pC->taskHandle);
+                pfpEnd(PFP_ID_ASOT_0, PFP_FINISH_MEAS);
+                pfpBegin(PFP_ID_ASOT_0, pC->taskHandle);
 
                 // (***) FL: do we need this? 
                 //       AF pointers come from CB read, any resets occur in Decoder AF.