CMSIS-DSP: Testing framework
Added some calibration to remove overhead in the benchmark measurement process.
Reorganized one test to move some initialization code outside of the test.
diff --git a/CMSIS/DSP/Testing/CMakeLists.txt b/CMSIS/DSP/Testing/CMakeLists.txt
index 365075b..087cd9c 100644
--- a/CMSIS/DSP/Testing/CMakeLists.txt
+++ b/CMSIS/DSP/Testing/CMakeLists.txt
@@ -134,6 +134,7 @@
   FrameworkSource/FPGA.cpp
   FrameworkSource/Timing.cpp
   FrameworkSource/Generators.cpp
+  FrameworkSource/Calibrate.cpp
   )
 # Change behavior of configBoot for scatter file
 # We use the linker files from older test framework because bigger sections are needed.
diff --git a/CMSIS/DSP/Testing/FrameworkInclude/Calibrate.h b/CMSIS/DSP/Testing/FrameworkInclude/Calibrate.h
new file mode 100755
index 0000000..8747446
--- /dev/null
+++ b/CMSIS/DSP/Testing/FrameworkInclude/Calibrate.h
@@ -0,0 +1,10 @@
+#include "Test.h"
+#include "Pattern.h"
+class Calibrate:public Client::Suite
+    {
+        public:
+            Calibrate(Testing::testID_t id);
+            void empty();
+            void setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr);
+            void tearDown(Testing::testID_t,Client::PatternMgr *mgr);
+    };
diff --git a/CMSIS/DSP/Testing/FrameworkInclude/IORunner.h b/CMSIS/DSP/Testing/FrameworkInclude/IORunner.h
index c275ef9..ced7189 100644
--- a/CMSIS/DSP/Testing/FrameworkInclude/IORunner.h
+++ b/CMSIS/DSP/Testing/FrameworkInclude/IORunner.h
@@ -44,6 +44,8 @@
       IO *m_io;
       PatternMgr *m_mgr;
       Testing::RunningMode m_runningMode;
+
+      Testing::cycles_t calibration = 0;
   };
 
 }
diff --git a/CMSIS/DSP/Testing/FrameworkSource/Calibrate.cpp b/CMSIS/DSP/Testing/FrameworkSource/Calibrate.cpp
new file mode 100755
index 0000000..86edd96
--- /dev/null
+++ b/CMSIS/DSP/Testing/FrameworkSource/Calibrate.cpp
@@ -0,0 +1,20 @@
+#include "Calibrate.h"
+
+Calibrate::Calibrate(Testing::testID_t id):Client::Suite(id)
+{
+
+}
+    
+void Calibrate::empty()
+{
+}
+       
+void Calibrate::setUp(Testing::testID_t,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
+{
+
+}
+       
+void Calibrate::tearDown(Testing::testID_t,Client::PatternMgr *mgr)
+{
+
+}
diff --git a/CMSIS/DSP/Testing/FrameworkSource/IORunner.cpp b/CMSIS/DSP/Testing/FrameworkSource/IORunner.cpp
index 9ef7ab5..47ce6db 100644
--- a/CMSIS/DSP/Testing/FrameworkSource/IORunner.cpp
+++ b/CMSIS/DSP/Testing/FrameworkSource/IORunner.cpp
@@ -36,6 +36,7 @@
 #include "Error.h"
 #include "Timing.h"
 #include "arm_math.h"
+#include "Calibrate.h"
 
 namespace Client
 {
@@ -54,6 +55,36 @@
         }
 
         initCycleMeasurement();
+
+/* 
+
+For calibration :
+
+Calibration means, in this context, removing the overhad of calling
+a C++ function pointer from the cycle measurements.
+
+
+*/
+        Calibrate c((Testing::testID_t)0);
+        Client::Suite *s=(Client::Suite *)&c;
+        Client::test t = (Client::test)&Calibrate::empty;
+
+        cycleMeasurementStart();
+#ifdef EXTBENCH
+        startSection();
+#endif
+        for(int i=0;i < 20;i++)
+        {
+           (s->*t)();
+        }
+#ifdef EXTBENCH
+        stopSection();
+#endif
+#ifndef EXTBENCH
+        calibration=getCycles() / 20;
+#endif
+        cycleMeasurementStop();
+
       }
 
       // Testing.
@@ -152,7 +183,7 @@
                 stopSection();
 #endif
 #ifndef EXTBENCH
-                cycles=getCycles();
+                cycles=getCycles()-calibration;
 #endif
                 cycleMeasurementStop();
               } 
diff --git a/CMSIS/DSP/Testing/Include/Benchmarks/BasicMathsBenchmarksF32.h b/CMSIS/DSP/Testing/Include/Benchmarks/BasicMathsBenchmarksF32.h
index fe48c77..db406d4 100644
--- a/CMSIS/DSP/Testing/Include/Benchmarks/BasicMathsBenchmarksF32.h
+++ b/CMSIS/DSP/Testing/Include/Benchmarks/BasicMathsBenchmarksF32.h
@@ -13,5 +13,9 @@
             Client::LocalPattern<float32_t> output;
 
             int nb;
+
+            float32_t *inp1;
+            float32_t *inp2;
+            float32_t *outp;
             
     };
\ No newline at end of file
diff --git a/CMSIS/DSP/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp b/CMSIS/DSP/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp
index 1d2a659..71cdc23 100644
--- a/CMSIS/DSP/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp
+++ b/CMSIS/DSP/Testing/Source/Benchmarks/BasicMathsBenchmarksF32.cpp
@@ -3,14 +3,9 @@
 
    
     void BasicMathsBenchmarksF32::vec_mult_f32()
-    {
-       
-       float32_t *inp1=input1.ptr();
-       float32_t *inp2=input2.ptr();
-       float32_t *outp=output.ptr();
+    {     
 
-
-       arm_mult_f32(inp1,inp2,outp,this->nb);
+       arm_mult_f32(this->inp1,this->inp2,this->outp,this->nb);
         
     } 
 
@@ -111,6 +106,19 @@
 
        
        output.create(this->nb,BasicMathsBenchmarksF32::OUT_SAMPLES_F32_ID,mgr);
+
+       switch(id)
+       {
+         case BasicMathsBenchmarksF32::VEC_MULT_F32_1:
+           /* This an overhead doing this because ptr() function is doing lot of checks
+            to ensure patterns are fresh.
+            So for small benchmark lengths it is better doing it in the setUp function
+           */
+           this->inp1=input1.ptr();
+           this->inp2=input2.ptr();
+           this->outp=output.ptr();
+         break;
+       }
        
     }
 
diff --git a/CMSIS/DSP/Testing/processResult.py b/CMSIS/DSP/Testing/processResult.py
index 43b85f4..f2b26ba 100644
--- a/CMSIS/DSP/Testing/processResult.py
+++ b/CMSIS/DSP/Testing/processResult.py
@@ -235,6 +235,11 @@
     return(TestScripts.ParseTrace.getCycles(trace))
 
 def analyseResult(root,results,embedded,benchmark,trace,formatter):
+    calibration = 0
+    if trace:
+      # First cycle in the trace is the calibration data
+      # The noramlisation factor must be coherent with the C code one.
+      calibration = int(getCyclesFromTrace(trace) / 20)
     formatter.start()
     path = []
     state = NORMAL
@@ -348,7 +353,7 @@
       
                     maybeCycles = m.group(4)
                     if maybeCycles == "t":
-                       cycles = getCyclesFromTrace(trace)
+                       cycles = getCyclesFromTrace(trace) - calibration
                     else:
                        cycles = int(maybeCycles)