diff mbox series

[v3,2/7] example: instrum: add skeleton

Message ID 1517846418-10342-3-git-send-email-odpbot@yandex.ru
State Superseded
Headers show
Series [v3,1/7] example: add basic papi configuration option | expand

Commit Message

Github ODP bot Feb. 5, 2018, 4 p.m. UTC
From: Bogdan Pricope <bogdan.pricope@linaro.org>


Add instrumentation library as odp example.

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

---
/** Email created from pull request 443 (bogdanPricope:master_benchmark_pr)
 ** https://github.com/Linaro/odp/pull/443
 ** Patch: https://github.com/Linaro/odp/pull/443.patch
 ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d
 ** Merge commit sha: be5c8bc74d773397cd54e079ddbad67c56d6fa33
 **/
 example/Makefile.am         |  4 ++++
 example/Makefile.inc        |  4 ++++
 example/instrum/Makefile.am | 15 +++++++++++++++
 example/instrum/instrum.c   | 18 ++++++++++++++++++
 example/m4/configure.m4     |  1 +
 5 files changed, 42 insertions(+)
 create mode 100644 example/instrum/Makefile.am
 create mode 100644 example/instrum/instrum.c
diff mbox series

Patch

diff --git a/example/Makefile.am b/example/Makefile.am
index 2ea244cf7..332dbae46 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -13,4 +13,8 @@  SUBDIRS = classifier \
 	  timer \
 	  traffic_mgmt
 
+if CODE_INSTRUM
+SUBDIRS += instrum
+endif
+
 noinst_HEADERS = example_debug.h
diff --git a/example/Makefile.inc b/example/Makefile.inc
index 3c8060da9..6d62cb6ab 100644
--- a/example/Makefile.inc
+++ b/example/Makefile.inc
@@ -16,7 +16,11 @@  AM_CFLAGS = \
 	$(HELPER_INCLUDES)
 
 if STATIC_APPS
+if !CODE_INSTRUM
 AM_LDFLAGS = -L$(LIB) -static
 else
 AM_LDFLAGS =
 endif
+else
+AM_LDFLAGS =
+endif
diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am
new file mode 100644
index 000000000..ff4a04060
--- /dev/null
+++ b/example/instrum/Makefile.am
@@ -0,0 +1,15 @@ 
+include $(top_srcdir)/Makefile.inc
+
+AM_CFLAGS = \
+        -I$(srcdir) \
+        -I$(top_srcdir)/example \
+        $(ODP_INCLUDES) \
+        $(HELPER_INCLUDES) \
+        $(PAPI_CFLAGS)
+
+AM_LDFLAGS = $(PAPI_LIBS)
+
+lib_LTLIBRARIES = $(LIB)/libinstrum.la
+
+__LIB__libinstrum_la_SOURCES = \
+		instrum.c
diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c
new file mode 100644
index 000000000..88580c58f
--- /dev/null
+++ b/example/instrum/instrum.c
@@ -0,0 +1,18 @@ 
+/* Copyright (c) 2017, Linaro Limited
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier:     BSD-3-Clause
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+static __attribute__((constructor)) void setup_wrappers(void)
+{
+	printf("Setup Wrappers\n");
+}
+
+static __attribute__((destructor)) void teardown_wrappers(void)
+{
+	printf("Teardown Wrappers\n");
+}
diff --git a/example/m4/configure.m4 b/example/m4/configure.m4
index 2fcf596ca..d925bbe78 100644
--- a/example/m4/configure.m4
+++ b/example/m4/configure.m4
@@ -31,4 +31,5 @@  AC_CONFIG_FILES([example/classifier/Makefile
 		 example/time/Makefile
 		 example/timer/Makefile
 		 example/traffic_mgmt/Makefile
+		 example/instrum/Makefile
 		 example/Makefile])