[PATCH 3 of 4] 7170638: Enable dtrace compatible sdt probes on GNU/Linux builds

Mark Wielaard mjw at redhat.com
Fri Jul 20 07:34:31 PDT 2012


 make/linux/makefiles/dtrace.make |  24 ++++++++++++++++++++++++
 make/linux/makefiles/vm.make     |   2 +-
 2 files changed, 25 insertions(+), 1 deletions(-)


# HG changeset patch
# User Mark Wielaard <mark at klomp.org>
# Date 1342788329 -7200
# Node ID 83f53049b275e6c613e149114aece6d078889038
# Parent  c85270e9500fa52fefa80763c4ccec7f3f0dc3a2
7170638: Enable dtrace compatible sdt probes on GNU/Linux builds.
Summary: If sys/sdt.h is found, then enable dtrace compatible sdt probes.
Contributed-by: Mark Wielaard <mjw at redhat.com>

diff --git a/make/linux/makefiles/dtrace.make b/make/linux/makefiles/dtrace.make
--- a/make/linux/makefiles/dtrace.make
+++ b/make/linux/makefiles/dtrace.make
@@ -1,5 +1,6 @@
 #
 # Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012 Red Hat, Inc.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,3 +26,26 @@
 # Linux does not build jvm_db
 LIBJVM_DB =
 
+# But it does have a SystemTap dtrace compatible sys/sdt.h
+ifneq ($(ALT_SDT_H),)
+  SDT_H_FILE = $(ALT_SDT_H)
+else
+  SDT_H_FILE = /usr/include/sys/sdt.h
+endif
+DTRACE_ENABLED = $(shell test -f $(SDT_H_FILE) && echo $(SDT_H_FILE))
+
+ifneq ($(DTRACE_ENABLED),)
+  CFLAGS += -DDTRACE_ENABLED
+endif
+
+# Phone target used in vm.make build target to check whether enabled.
+.PHONY: dtraceCheck
+ifeq ($(DTRACE_ENABLED),)
+dtraceCheck:
+	$(QUIETLY) echo "**NOTICE** Dtrace support disabled $(SDT_H_FILE) not found"
+else
+dtraceCheck:
+endif
+
+# It doesn't support HAVE_DTRACE_H though.
+
diff --git a/make/linux/makefiles/vm.make b/make/linux/makefiles/vm.make
--- a/make/linux/makefiles/vm.make
+++ b/make/linux/makefiles/vm.make
@@ -387,7 +387,7 @@
 
 #----------------------------------------------------------------------
 
-build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) $(WB_JAR)
+build: $(LIBJVM) $(LAUNCHER) $(LIBJSIG) $(LIBJVM_DB) $(BUILDLIBSAPROC) dtraceCheck $(WB_JAR)
 
 install: install_jvm install_jsig install_saproc
 


More information about the hotspot-dev mailing list