diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-04-30 13:05:56 -0700 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-04-30 13:05:56 -0700 |
commit | f2791ab02b0100c890fce8a2dbcd322d84595936 (patch) | |
tree | bfb416546a96d4b5e402d0f0745bb8054ea0868c /templates | |
parent | d30457a34875fe0ddaeb533ecc566916d88255f9 (diff) | |
parent | 34c396325a207bbacebb3cd67e108a5f36a2b5cc (diff) |
Merge pull request #1408 from dgquintas/stap
Integration of Systemtap as a profiling mechanism.
Diffstat (limited to 'templates')
-rw-r--r-- | templates/Makefile.template | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/templates/Makefile.template b/templates/Makefile.template index 9a12cf9922..1e7a2a49bd 100644 --- a/templates/Makefile.template +++ b/templates/Makefile.template @@ -101,14 +101,23 @@ CPPFLAGS_opt = -O2 LDFLAGS_opt = DEFINES_opt = NDEBUG -VALID_CONFIG_latprof = 1 -CC_latprof = $(DEFAULT_CC) -CXX_latprof = $(DEFAULT_CXX) -LD_latprof = $(DEFAULT_CC) -LDXX_latprof = $(DEFAULT_CXX) -CPPFLAGS_latprof = -O2 -DGRPC_LATENCY_PROFILER -LDFLAGS_latprof = -DEFINES_latprof = NDEBUG +VALID_CONFIG_basicprof = 1 +CC_basicprof = $(DEFAULT_CC) +CXX_basicprof = $(DEFAULT_CXX) +LD_basicprof = $(DEFAULT_CC) +LDXX_basicprof = $(DEFAULT_CXX) +CPPFLAGS_basicprof = -O2 -DGRPC_BASIC_PROFILER +LDFLAGS_basicprof = +DEFINES_basicprof = NDEBUG + +VALID_CONFIG_stapprof = 1 +CC_stapprof = $(DEFAULT_CC) +CXX_stapprof = $(DEFAULT_CXX) +LD_stapprof = $(DEFAULT_CC) +LDXX_stapprof = $(DEFAULT_CXX) +CPPFLAGS_stapprof = -O2 -DGRPC_STAP_PROFILER +LDFLAGS_stapprof = +DEFINES_stapprof = NDEBUG VALID_CONFIG_dbg = 1 CC_dbg = $(DEFAULT_CC) @@ -197,6 +206,7 @@ DEFINES_gcov = _DEBUG DEBUG prefix ?= /usr/local PROTOC = protoc +DTRACE = dtrace CONFIG ?= opt CC = $(CC_$(CONFIG)) CXX = $(CXX_$(CONFIG)) @@ -364,6 +374,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 @@ -396,6 +408,18 @@ 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 +endif +endif + ifeq ($(wildcard third_party/openssl/ssl/ssl.h),) HAS_EMBEDDED_OPENSSL_ALPN = false else @@ -575,6 +599,17 @@ protoc_dep_message: @echo " make run_dep_checks" @echo +systemtap_dep_error: + @echo + @echo "DEPENDENCY ERROR" + @echo + @echo "Under the '$(CONFIG)' configutation, the target you are trying " + @echo "to build requires systemtap 2.7+ (on Linux) or dtrace (on other " + @echo "platforms such as Solaris and *BSD). " + @echo + @echo "Please consult INSTALL to get more information." + @echo + stop: @false @@ -863,6 +898,18 @@ endif % endfor +ifeq ($(CONFIG),stapprof) +src/core/profiling/stap_timers.c: $(GENDIR)/src/core/profiling/stap_probes.h +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 $@ +else +$(GENDIR)/src/core/profiling/stap_probes.h: systemtap_dep_error stop +endif +endif + $(OBJDIR)/$(CONFIG)/%.o : %.c $(E) "[C] Compiling $<" $(Q) mkdir -p `dirname $@` @@ -883,7 +930,6 @@ $(OBJDIR)/$(CONFIG)/%.o : %.cc $(Q) mkdir -p `dirname $@` $(Q) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -MMD -MF $(addsuffix .dep, $(basename $@)) -c -o $@ $< - install: install_c install_cxx install-plugins install-certs verify-install install_c: install-headers_c install-static_c install-shared_c |