From b75782d518d378ee1e2c7d1cce76aa9dc6f7edbb Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Tue, 24 May 2022 10:31:26 +0200
Subject: [PATCH] testings: trace and profile are enabled for each iteration
 but warmup

---
 testing/chameleon_ztesting.c | 2 +-
 testing/testings.c           | 8 ++++----
 testing/vendor_ztesting.c    | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/testing/chameleon_ztesting.c b/testing/chameleon_ztesting.c
index 64df983c6..dfe7776bf 100644
--- a/testing/chameleon_ztesting.c
+++ b/testing/chameleon_ztesting.c
@@ -206,7 +206,7 @@ int main (int argc, char **argv) {
         run_arg_list_t copy = run_arg_list_copy( &(run->args) );
 
         /* Run the warmup test as -1 */
-        options.run_id--;
+        options.run_id = -1;
         fptr( &copy, options.check );
         run_arg_list_destroy( &copy );
         options.run_id++;
diff --git a/testing/testings.c b/testing/testings.c
index 88df38910..d50b392fc 100644
--- a/testing/testings.c
+++ b/testing/testings.c
@@ -139,12 +139,12 @@ testing_start( testdata_t *tdata )
     }
 
     /* Start kernel statistics */
-    if ( options.profile ) {
+    if ( options.profile && (options.run_id >= 0) ) {
         CHAMELEON_Enable( CHAMELEON_KERNELPROFILE_MODE );
     }
 
     /* Start tracing */
-    if ( options.trace && (options.run_id == 0) ) {
+    if ( options.trace && (options.run_id >= 0) ) {
         CHAMELEON_Enable( CHAMELEON_PROFILING_MODE );
     }
 
@@ -203,12 +203,12 @@ testing_stop( testdata_t *tdata, cham_fixdbl_t flops )
     }
 
     /* Stop tracing */
-    if ( options.trace && (options.run_id == 0) ) {
+    if ( options.trace && (options.run_id >= 0) ) {
         CHAMELEON_Disable( CHAMELEON_PROFILING_MODE );
     }
 
     /* Stop kernel statistics */
-    if ( options.profile ) {
+    if ( options.profile && (options.run_id >= 0) ) {
         CHAMELEON_Disable( CHAMELEON_KERNELPROFILE_MODE );
     }
 #endif
diff --git a/testing/vendor_ztesting.c b/testing/vendor_ztesting.c
index 9acfe313c..df72f106c 100644
--- a/testing/vendor_ztesting.c
+++ b/testing/vendor_ztesting.c
@@ -151,7 +151,7 @@ int main (int argc, char **argv) {
         run_arg_list_t copy = run_arg_list_copy( &(run->args) );
 
         /* Run the warmup test as -1 */
-        options.run_id--;
+        options.run_id = -1;
         fptr( &copy, options.check );
         run_arg_list_destroy( &copy );
         options.run_id++;
-- 
GitLab