aboutsummaryrefslogtreecommitdiffhomepage
path: root/Makefile
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-04-27 19:17:20 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-04-27 19:17:20 -0700
commita9eb302abaccdd3609d81ba75434cccaed49f4fd (patch)
tree498edbb5f5f00a7e32aa0066a3165c206b1d45f7 /Makefile
parent515b2bbfe3a2287028581041f0ae1ec1f9f1eee4 (diff)
STAP annotation working.
Test annotations made to client_channel.c (start_rpc) and channel_create.c (grpc_channel_create).
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile25
1 files changed, 25 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 2def6e2413..1955e2fa48 100644
--- a/Makefile
+++ b/Makefile
@@ -183,6 +183,7 @@ DEFINES_gcov = NDEBUG
prefix ?= /usr/local
PROTOC = protoc
+DTRACE = dtrace
CONFIG ?= opt
CC = $(CC_$(CONFIG))
CXX = $(CXX_$(CONFIG))
@@ -350,6 +351,8 @@ PERFTOOLS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/perfto
PROTOBUF_CHECK_CMD = $(CXX) $(CXXFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/protobuf.cc -lprotobuf $(LDFLAGS)
PROTOC_CHECK_CMD = which protoc > /dev/null
PROTOC_CHECK_VERSION_CMD = protoc --version | grep -q libprotoc.3
+DTRACE_CHECK_CMD = which dtrace > /dev/null
+SYSTEMTAP_HEADERS_CHECK_CMD = $(CC) $(CFLAGS) $(CPPFLAGS) -o $(TMPOUT) test/build/systemtap.c $(LDFLAGS)
ifeq ($(OPENSSL_REQUIRES_DL),true)
OPENSSL_ALPN_CHECK_CMD += -ldl
@@ -382,6 +385,19 @@ else
HAS_VALID_PROTOC = false
endif
+# Check for Systemtap (https://sourceware.org/systemtap/), first by making sure <sys/sdt.h> is present
+# in the system and secondly by checking for the "dtrace" binary (on Linux, this is part of the Systemtap
+# distribution. It's part of the base system on BSD/Solaris machines).
+HAS_SYSTEMTAP_HEADERS = $(shell $(SYSTEMTAP_HEADERS_CHECK_CMD) 2> /dev/null && echo true || echo false)
+HAS_DTRACE = $(shell $(DTRACE_CHECK_CMD) 2> /dev/null && echo true || echo false)
+HAS_SYSTEMTAP = false
+ifeq ($(HAS_SYSTEMTAP_HEADERS),true)
+ifeq ($(HAS_DTRACE),true)
+HAS_SYSTEMTAP = true
+DEFINES += GRPC_STAP_PROFILER
+endif
+endif
+
ifeq ($(wildcard third_party/openssl/ssl/ssl.h),)
HAS_EMBEDDED_OPENSSL_ALPN = false
else
@@ -2779,6 +2795,15 @@ $(GENDIR)/test/proto/test.grpc.pb.cc: test/proto/test.proto $(PROTOBUF_DEP) $(PR
endif
+ifeq ($(HAS_SYSTEMTAP),true)
+$(GENDIR)/src/core/profiling/stap_probes.h: src/core/profiling/stap_probes.d
+ $(E) "[DTRACE] Compiling $<"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(DTRACE) -C -h -s $< -o $@
+
+src/core/profiling/timers.h: $(GENDIR)/src/core/profiling/stap_probes.h
+endif
+
$(OBJDIR)/$(CONFIG)/%.o : %.c
$(E) "[C] Compiling $<"
$(Q) mkdir -p `dirname $@`