[PATCH 02/13] Makefile.am: Add new multiple trace backend supporting framework

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Xinghai Yu <yuxinghai@xxxxxxxxxxxxxx>

Add the new multiple trace backend framework, and the 'Dtrace' should
be one of the trace backends libvirt supporting.

Using the macro exported by configure.ac to decide which trace backend
to build for libvirt.
We got 2 trace macros below:
WITH_TRACE_PROBES, if --with-dtrace or other trace option was set, this
macro would be true and it tell the codes that we will use trace function,
dtrace or ftrace will be supported in libvirt.
WITH_DTRACE_PROBES, if --with-dtrace was set this macro would be true and
the dtrace will be supported in libvirt.

Signed-off-by: Xinghai Yu <yuxinghai@xxxxxxxxxxxxxx>
---
 daemon/Makefile.am |  10 ++++-
 src/Makefile.am    | 113 ++++++++++++++++++++++++++++++++++++++++++-----------
 tests/Makefile.am  |  10 ++++-
 3 files changed, 106 insertions(+), 27 deletions(-)

diff --git a/daemon/Makefile.am b/daemon/Makefile.am
index 00221ab..bd77623 100644
--- a/daemon/Makefile.am
+++ b/daemon/Makefile.am
@@ -160,8 +160,11 @@ libvirtd_LDADD =					\
 	$(POLKIT_LIBS)					\
 	$(LIBNL_LIBS)
 
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 libvirtd_LDADD += ../src/libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+libvirtd_LDADD += ../src/libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 
 libvirtd_LDADD += \
@@ -174,8 +177,11 @@ libvirtd_LDADD += \
 if ! WITH_DRIVER_MODULES
 if WITH_QEMU
     libvirtd_LDADD += ../src/libvirt_driver_qemu.la
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
     libvirtd_LDADD += ../src/libvirt_qemu_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+    libvirtd_LDADD += ../src/libvirt_qemu_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 endif WITH_QEMU
 
diff --git a/src/Makefile.am b/src/Makefile.am
index 25d0370..0e50ebc 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1943,36 +1943,77 @@ libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)
 # picked out for us.
 libvirt_la_DEPENDENCIES = $(libvirt_la_BUILT_LIBADD) $(LIBVIRT_SYMBOL_FILE)
 
-if WITH_DTRACE_PROBES
+TRACETOOL=$(srcdir)/tracetool.py
+if WITH_TRACE_PROBES
 libvirt_la_BUILT_LIBADD += libvirt_probes.lo
-libvirt_la_DEPENDENCIES += libvirt_probes.lo libvirt_probes.o
 nodist_libvirt_la_SOURCES = libvirt_probes.h
+BUILT_SOURCES += libvirt_probes.c libvirt_probes.h
+if WITH_QEMU
+libvirt_driver_qemu_impl_la_LIBADD += libvirt_qemu_probes.lo
+nodist_libvirt_driver_qemu_impl_la_SOURCES = libvirt_qemu_probes.h
+BUILT_SOURCES += libvirt_qemu_probes.c libvirt_qemu_probes.h
+endif WITH_QEMU
+.PRECIOUS: %_probes.o
+# Contain the trace_function's definition
+%_probes.c: %_trace_events
+	$(AM_V_GEN)$(PYTHON) $(TRACETOOL) \
+		--format=c \
+		--backend=trace \
+		< $< > $@
+# Contain the trace_function's declaration
+%_probes.h: %_trace_events
+	$(AM_V_GEN)$(PYTHON) $(TRACETOOL) \
+		--format=h \
+		--backend=trace \
+		< $< > $@
+%_probes.lo: %_probes.o
+	$(AM_V_GEN)printf %s\\n \
+	  '# $@ - a libtool object file' \
+	  '# Generated by libtool (GNU libtool) 2.4' \
+	  '# Actually generated by Makefile.am, in order to shut up libtool' \
+	  "pic_object='$<'" \
+	  "non_pic_object='$<'" \
+	> $@
+CLEANFILES += libvirt_probes.c libvirt_probes.h libvirt_probes.o libvirt_probes.lo \
+              libvirt_qemu_probes.c libvirt_qemu_probes.h libvirt_qemu_probes.o \
+              libvirt_qemu_probes.lo
+endif
+
+if WITH_DTRACE_PROBES
+libvirt_la_BUILT_LIBADD += libvirt_probes_dtrace.lo
+libvirt_la_DEPENDENCIES += libvirt_probes_dtrace.o libvirt_probes_dtrace.lo
+nodist_libvirt_la_SOURCES = libvirt_probes_dtrace.h
 if WITH_REMOTE
-nodist_libvirt_driver_remote_la_SOURCES = libvirt_probes.h
+nodist_libvirt_driver_remote_la_SOURCES = libvirt_probes_dtrace.h
 endif WITH_REMOTE
 if WITH_DRIVER_MODULES
 DTRACE2SYSTEMTAP_FLAGS = --with-modules
 endif WITH_DRIVER_MODULES
 
-BUILT_SOURCES += libvirt_probes.h libvirt_probes.stp libvirt_functions.stp
+BUILT_SOURCES += libvirt_probes_dtrace.h libvirt_probes.stp libvirt_functions.stp
 
 if WITH_QEMU
-libvirt_driver_qemu_la_LIBADD += libvirt_qemu_probes.lo
-nodist_libvirt_driver_qemu_la_SOURCES = libvirt_qemu_probes.h
-BUILT_SOURCES += libvirt_qemu_probes.h
+libvirt_driver_qemu_impl_la_LIBADD += libvirt_qemu_probes_dtrace.lo
+nodist_libvirt_driver_qemu_impl_la_SOURCES = libvirt_qemu_probes.h libvirt_qemu_probes_dtrace.h
+BUILT_SOURCES += libvirt_qemu_probes_dtrace.h
 endif WITH_QEMU
 
 tapsetdir = $(datadir)/systemtap/tapset
 tapset_DATA = libvirt_probes.stp libvirt_qemu_probes.stp libvirt_functions.stp
 
-%_probes.h: %_probes.d
+%_probes.d: %_trace_events
+	$(AM_V_GEN)$(PYTHON) $(TRACETOOL) \
+		--format=d \
+		--backend=trace \
+		< $< > $@
+%_probes_dtrace.h: %_probes.d
 	$(AM_V_GEN)$(DTRACE) -o $@ -h -s $<
 
-.PRECIOUS: %_probes.o
-%_probes.o: %_probes.d
+.PRECIOUS: %_probes_dtrace.o
+%_probes_dtrace.o: %_probes.d
 	$(AM_V_GEN)$(DTRACE) -o $@ -G -s $<
 
-%_probes.lo: %_probes.o
+%_probes_dtrace.lo: %_probes_dtrace.o
 	$(AM_V_GEN)printf %s\\n \
 	  '# $@ - a libtool object file' \
 	  '# Generated by libtool (GNU libtool) 2.4' \
@@ -1998,14 +2039,14 @@ libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
 	$(AM_V_GEN)$(PERL) -w $(srcdir)/dtrace2systemtap.pl \
 	  $(DTRACE2SYSTEMTAP_FLAGS) $(bindir) $(sbindir) $(libdir) $< > $@
 
-CLEANFILES += libvirt_probes.h libvirt_probes.o libvirt_probes.lo \
-              libvirt_qemu_probes.h libvirt_qemu_probes.o \
-              libvirt_qemu_probes.lo\
-              libvirt_functions.stp libvirt_probes.stp \
-              libvirt_qemu_probes.stp
+CLEANFILES += libvirt_probes_dtrace.o libvirt_probes_dtrace.lo \
+              libvirt_qemu_probes_dtrace.o libvirt_qemu_probes_dtrace.lo \
+              libvirt_functions.stp libvirt_probes.stp libvirt_qemu_probes.stp \
+              libvirt_qemu_probes_dtrace.h libvirt_probes_dtrace.h \
+              libvirt_qemu_probes.d libvirt_probes.d
 endif WITH_DTRACE_PROBES
 
-EXTRA_DIST += libvirt_probes.d libvirt_qemu_probes.d
+EXTRA_DIST += libvirt_trace_events libvirt_qemu_trace_events
 
 libvirt_qemu_la_SOURCES = libvirt-qemu.c
 libvirt_qemu_la_LDFLAGS = \
@@ -2124,8 +2165,11 @@ lockd_la_LIBADD = ../gnulib/lib/libgnu.la \
 augeas_DATA += locking/libvirt_lockd.aug
 augeastest_DATA += test_libvirt_lockd.aug
 CLEANFILES += test_libvirt_lockd.aug
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 lockd_la_LIBADD += libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+lockd_la_LIBADD += libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 if WITH_QEMU
 nodist_conf_DATA += locking/qemu-lockd.conf
@@ -2163,8 +2207,11 @@ virtlockd_LDADD = \
 		../gnulib/lib/libgnu.la \
 		$(CYGWIN_EXTRA_LIBADD) \
 		$(NULL)
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 virtlockd_LDADD += libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+virtlockd_LDADD += libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 
 else ! WITH_LIBVIRTD
@@ -2331,6 +2378,14 @@ noinst_LTLIBRARIES += \
 	libvirt-net-rpc-client.la
 
 EXTRA_DIST += \
+	tracetool.py \
+	tracetool/__init__.py \
+	tracetool/backend/__init__.py \
+	tracetool/backend/trace.py \
+	tracetool/format/__init__.py \
+	tracetool/format/d.py \
+	tracetool/format/c.py \
+	tracetool/format/h.py \
 	dtrace2systemtap.pl \
 	rpc/gendispatch.pl \
 	rpc/genprotocol.pl \
@@ -2437,8 +2492,11 @@ libvirt_iohelper_LDFLAGS = \
 libvirt_iohelper_LDADD =		\
 		libvirt_util.la		\
 		../gnulib/lib/libgnu.la
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 libvirt_iohelper_LDADD += libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+libvirt_iohelper_LDADD += libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 
 libvirt_iohelper_CFLAGS = \
@@ -2460,8 +2518,11 @@ libvirt_parthelper_LDADD =		\
 		$(LIBPARTED_LIBS)	\
 		libvirt_util.la		\
 		../gnulib/lib/libgnu.la
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 libvirt_parthelper_LDADD += libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+libvirt_parthelper_LDADD += libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 
 libvirt_parthelper_CFLAGS = \
@@ -2510,8 +2571,11 @@ libvirt_lxc_LDADD =			\
 		libvirt_conf.la \
 		libvirt_util.la \
 		../gnulib/lib/libgnu.la
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 libvirt_lxc_LDADD += libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+libvirt_lxc_LDADD += libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 libvirt_lxc_LDADD += $(SECDRIVER_LIBS)
 libvirt_lxc_CFLAGS =				\
@@ -2545,8 +2609,11 @@ virt_aa_helper_LDADD =						\
 		libvirt_conf.la					\
 		libvirt_util.la					\
 		../gnulib/lib/libgnu.la
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 virt_aa_helper_LDADD += libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+virt_aa_helper_LDADD += libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 virt_aa_helper_CFLAGS =						\
 		-I$(top_srcdir)/src/conf			\
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cd91734..8d24cd9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -45,8 +45,11 @@ INCLUDES += \
 endif WITH_DRIVER_MODULES
 
 PROBES_O =
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 PROBES_O += ../src/libvirt_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+PROBES_O += ../src/libvirt_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 
 GNULIB_LIBS = \
@@ -453,8 +456,11 @@ endif WITH_NETWORK
 if WITH_STORAGE
 qemu_LDADDS += ../src/libvirt_driver_storage_impl.la
 endif WITH_STORAGE
-if WITH_DTRACE_PROBES
+if WITH_TRACE_PROBES
 qemu_LDADDS += ../src/libvirt_qemu_probes.lo
+endif WITH_TRACE_PROBES
+if WITH_DTRACE_PROBES
+qemu_LDADDS += ../src/libvirt_qemu_probes_dtrace.lo
 endif WITH_DTRACE_PROBES
 qemu_LDADDS += $(LDADDS)
 
-- 
1.8.3.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]