From 2e432af50dc6e249909890f93f214b5e7444b67c Mon Sep 17 00:00:00 2001
From: Thierry <thierry.gautier@inrialpes.fr>
Date: Wed, 25 Sep 2019 11:10:35 +0200
Subject: [PATCH] Suppress rules to build hw_count.h except in tracelib

---
 includes/kaapi_trace.h     | 9 ---------
 tool/CMakeLists.txt        | 7 +------
 tracelib/kaapi_trace_lib.c | 7 ++++++-
 ukilli/CMakeLists.txt      | 7 +------
 4 files changed, 8 insertions(+), 22 deletions(-)

diff --git a/includes/kaapi_trace.h b/includes/kaapi_trace.h
index 3f653e7..2560132 100644
--- a/includes/kaapi_trace.h
+++ b/includes/kaapi_trace.h
@@ -47,16 +47,11 @@
 
 #include <stdint.h>
 #include <stddef.h>
-#include "hw_count.h" 
 
 #if defined(__cplusplus)
 extern "C" {
 #endif
 
-#if !defined(KAAPI_MAX_HWCOUNTERS)
-#define KAAPI_MAX_HWCOUNTERS 4
-#endif
-
 #if !defined(KAAPI_CACHE_LINE)
 #define KAAPI_CACHE_LINE 64
 #endif
@@ -161,10 +156,6 @@ extern double kaapi_get_elapsedtime(void);
 #define KAAPI_PERF_GROUP_DFGBUILD  4
 #define KAAPI_PERF_GROUP_OFFLOAD   5
 
-#if ((KAAPI_PERF_ID_ENDSOFTWARE+KAAPI_MAX_HWCOUNTERS) > KAAPI_PERF_ID_MAX)
-#error "The maximal size of the peformance counters handled by Kaapi should be extended. Please contact the authors."
-#endif
-
 
 /* counter type
 */
diff --git a/tool/CMakeLists.txt b/tool/CMakeLists.txt
index 44ed1c6..2db4edd 100644
--- a/tool/CMakeLists.txt
+++ b/tool/CMakeLists.txt
@@ -9,13 +9,8 @@ set(SOURCES
   ompt_callbacks.cpp
   )
 
-add_custom_command (
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hw_count.h
-  COMMAND ${SHELL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/config/hw_count.sh ${CMAKE_CURRENT_BINARY_DIR}/hw_count.h
-  )
-
 include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
 
-add_library(tikki SHARED ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/hw_count.h)
+add_library(tikki SHARED ${SOURCES} )
 target_link_libraries (tikki tracelib)
 install(TARGETS tikki DESTINATION lib)
diff --git a/tracelib/kaapi_trace_lib.c b/tracelib/kaapi_trace_lib.c
index 2d7f1bb..07892ca 100644
--- a/tracelib/kaapi_trace_lib.c
+++ b/tracelib/kaapi_trace_lib.c
@@ -108,6 +108,11 @@ typedef struct timespec struct_time;
 #include "kaapi_util.h"
 #include "kaapi_atomic.h"
 
+#if ((KAAPI_PERF_ID_ENDSOFTWARE+KAAPI_MAX_HWCOUNTERS) > KAAPI_PERF_ID_MAX)
+#error "The maximal size of the peformance counters handled by Kaapi should be extended. Please contact the authors."
+#endif
+
+
 #if defined(__cplusplus)
 extern "C" {
 #endif
@@ -1072,7 +1077,7 @@ kaapi_tracelib_thread_t* kaapi_tracelib_thread_init(
     {
       if (kaapi_perf_idset_test( &ctxt->perfset, i))
       {
-printf("Attach event: '%s'\n", kaapi_perfctr_info[i].name);
+//printf("Attach event: '%s'\n", kaapi_perfctr_info[i].name);
         papi_event_codes[count++] = kaapi_perfctr_info[i].eventcode;
       }      
     }
diff --git a/ukilli/CMakeLists.txt b/ukilli/CMakeLists.txt
index 283965b..aa06d43 100644
--- a/ukilli/CMakeLists.txt
+++ b/ukilli/CMakeLists.txt
@@ -8,13 +8,8 @@ set(SOURCES
   ${CMAKE_SOURCE_DIR}/poti/src/poti_header.c
   )
 
-add_custom_command (
-  OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hw_count.h
-  COMMAND ${SHELL_EXECUTABLE} ${CMAKE_SOURCE_DIR}/config/hw_count.sh ${CMAKE_CURRENT_BINARY_DIR}/hw_count.h
-  )
-
 include_directories( ${CMAKE_CURRENT_BINARY_DIR} )
 
-add_executable(ukilli ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/hw_count.h)
+add_executable(ukilli ${SOURCES})
 target_link_libraries (ukilli tracelib)
 install(TARGETS ukilli DESTINATION bin)
-- 
GitLab