diff mbox series

[CATERPILLAR,v2,5/6] example: instrum: configure instrumented API set

Message ID 1516888824-25562-6-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [CATERPILLAR,v2,1/6] example: add papi path configuration option | expand

Commit Message

Github ODP bot Jan. 25, 2018, 2 p.m. UTC
From: Bogdan Pricope <bogdan.pricope@linaro.org>


Add configure time option to trim API set to be instrumented.

Signed-off-by: Bogdan Pricope <bogdan.pricope@linaro.org>

---
/** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/406
 ** Patch: https://github.com/Linaro/odp/pull/406.patch
 ** Base sha: f87bb5146fb25f7cd62246500cb4f7e625375654
 ** Merge commit sha: 577e1fa00c9cfe0840f5b0f5d5d826f414ac03c6
 **/
 example/instrum/Makefile.am | 18 ++++++++++++++----
 example/instrum/drv.h       |  3 +++
 example/instrum/instrum.c   |  4 ++++
 example/instrum/sched.h     |  3 +++
 example/m4/configure.m4     | 17 ++++++++++++-----
 5 files changed, 36 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am
index 452b36c46..30c26046f 100644
--- a/example/instrum/Makefile.am
+++ b/example/instrum/Makefile.am
@@ -25,10 +25,20 @@  noinst_HEADERS = \
 		$(srcdir)/drv.h \
 		$(srcdir)/sched.h
 
-__LIB__libinstrum_la_SOURCES = \
+INSTRUM_SRC = \
 		instrum.c \
 		store.c \
 		papi_cnt.c \
-		init.c \
-		drv.c \
-		sched.c
+		init.c
+
+if CODE_INSTRUM_SCHED
+AM_CFLAGS += -DCODE_INSTRUM_SCHED
+INSTRUM_SRC += sched.c
+endif
+
+if CODE_INSTRUM_DDF
+AM_CFLAGS += -DCODE_INSTRUM_DDF
+INSTRUM_SRC += drv.c
+endif
+
+__LIB__libinstrum_la_SOURCES = $(INSTRUM_SRC)
diff --git a/example/instrum/drv.h b/example/instrum/drv.h
index 12441a7e4..ed3dd7a08 100644
--- a/example/instrum/drv.h
+++ b/example/instrum/drv.h
@@ -7,6 +7,8 @@ 
 #ifndef __INSTRUM_DRV_H__
 #define __INSTRUM_DRV_H__
 
+#ifdef CODE_INSTRUM_DDF
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -16,4 +18,5 @@  int instr_odpdrv_init(void);
 #ifdef __cplusplus
 }
 #endif
+#endif /* CODE_INSTRUM_DDF */
 #endif /* __INSTRUM_DRV_H__ */
diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c
index 05b38da68..93b6cc78f 100644
--- a/example/instrum/instrum.c
+++ b/example/instrum/instrum.c
@@ -21,11 +21,15 @@  static __attribute__((constructor)) void setup_wrappers(void)
 	if (instr_odpinit_init())
 		return;
 
+#ifdef CODE_INSTRUM_DDF
 	if (instr_odpdrv_init())
 		return;
+#endif /* CODE_INSTRUM_DDF */
 
+#ifdef CODE_INSTRUM_SCHED
 	if (instr_odpsched_init())
 		return;
+#endif /* CODE_INSTRUM_SCHED */
 }
 
 static __attribute__((destructor)) void teardown_wrappers(void)
diff --git a/example/instrum/sched.h b/example/instrum/sched.h
index 2a092b0ed..6cfc40bdc 100644
--- a/example/instrum/sched.h
+++ b/example/instrum/sched.h
@@ -7,6 +7,8 @@ 
 #ifndef __INSTRUM_SCHED_H__
 #define __INSTRUM_SCHED_H__
 
+#ifdef CODE_INSTRUM_SCHED
+
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -16,4 +18,5 @@  int instr_odpsched_init(void);
 #ifdef __cplusplus
 }
 #endif
+#endif /* CODE_INSTRUM_SCHED */
 #endif /* __INSTRUM_SCHED_H__ */
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index d2258bf27..970dfd927 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -7,15 +7,22 @@  AC_ARG_ENABLE([test-example],
     [test_example=yes])
 AM_CONDITIONAL([test_example], [test x$test_example = xyes ])
 
-PAPI_PATH=""
-code_instrumentation=no
 AC_ARG_WITH([papi-path],
 AS_HELP_STRING([--with-papi-path=DIR   path to papi install directory]),
     [PAPI_PATH="$withval"
-    code_instrumentation=yes],[])
-
+    code_instrumentation=yes],
+    [PAPI_PATH=""
+    code_instrumentation=no])
 AC_SUBST([PAPI_PATH])
-AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ])
+AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes])
+
+AC_ARG_WITH([code-instrum-profile],
+AS_HELP_STRING([--with-code-instrum-profile=all|scheduler|ddf   set code instrumentation profile]),
+    [code_instrum_profile="$withval"],
+    [code_instrum_profile="all"])
+
+AM_CONDITIONAL([CODE_INSTRUM_SCHED],[test $code_instrum_profile = "all" || test $code_instrum_profile = "scheduler"])
+AM_CONDITIONAL([CODE_INSTRUM_DDF],[test $code_instrum_profile = "all" || test $code_instrum_profile = "ddf"])
 
 AC_CONFIG_FILES([example/classifier/Makefile
 		 example/generator/Makefile