diff --git a/pasdk/common/asp0.c b/pasdk/common/asp0.c
index c21b74b9c11917797ab77a3dc647346569fdac9f..b25a449a12bcd475bd4f162dc7ab27b0df71acd3 100644 (file)
--- a/pasdk/common/asp0.c
+++ b/pasdk/common/asp0.c
#include <xdc/runtime/IHeap.h>
#include <ti/sysbios/heaps/HeapMem.h>
+
+#define PROFILER
+
+#ifdef PROFILER
+#include <ti/sysbios/knl/Task.h>
+#include "ti/sysbios/knl/Clock.h"
+#include "xdc/runtime/Timestamp.h"
+#include "ti/sysbios/utils/Load.h"
+
+#ifndef MAX_NUM
+#define MAX_NUM 28515
+#endif
+UInt32 profile_array_dsp_cycles[MAX_NUM];
+UInt32 profile_array_dsp_cpuload[MAX_NUM];
+UInt32 profile_index = 0;
+UInt32 start_profiling = 0;
+#endif
+
//
#include "asp0.h"
//#include <paf_alg.h>
}
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)))
+ if (alg->fxns->apply /*&& (errno = alg->fxns->apply(alg, pAudioFrame))*/)
{
- if (this->log)
+
+#ifdef PROFILER
+ {
+ volatile UInt32 time32_1, time32_2;
+
+ time32_1 = Timestamp_get32();
+#endif
+ errno = alg->fxns->apply(alg, pAudioFrame);
+
+#ifdef PROFILER
+ time32_2 = Timestamp_get32();
+ //Load_Stat stat;
+ //Load_getTaskLoad (Task_getIdleTask(), &stat);
+ //UInt32 intLoad = Load_calculateLoad (&stat);
+ if (start_profiling == 1)
+ {
+ if (profile_index < MAX_NUM)
+ {
+ profile_array_dsp_cycles[profile_index] = (time32_2 - time32_1);
+ //profile_array_dsp_cpuload[profile_index] = (100 - intLoad);
+ profile_array_dsp_cpuload[profile_index] = Load_getCPULoad();
+ profile_index++;
+ }
+ else
+ {
+ //SW_BREAKPOINT;
+ }
+ }
+
+ //TRACE_TERSE1("profiler: Timestamp_get32() cycles: %u", (time32_2 - time32_1) * factor);
+ //TRACE_TERSE2("profiler: CPU load: idle: %d other: %d", intLoad, (100 - intLoad));
+ }
+#endif
+
+ if (errno && this->log)
{
LOG_printf(this->log, "AS%d: ASP code 0x%08x apply error 0x%x.",
this->stream, pLink->code.full, errno);