Skip to contentSkip to conversation

Tracing patches

GIT PULL Applied Stefan Hajnoczi 2 participants 5 messages Apr 21, 2017 Kbuild

lore
Share & tools
lore
#0 lore raw

The following changes since commit fa54abb8c298f892639ffc4bc2f61448ac3be4a1:

Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1 (2017-04-20 18:33:33 +0100)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/tracing-pull-request

for you to fetch changes up to 659370f71f2c3d4105b04178abd751242e1c1b68:

simpletrace: document Analyzer method signatures (2017-04-21 10:45:35 +0100)

----------------------------------------------------------------

----------------------------------------------------------------

Stefan Hajnoczi (2):
configure: eliminate Python dependency for --help
simpletrace: document Analyzer method signatures

Xu, Anthony (1):
trace: Put all trace.o into libqemuutil.a

 configure              | 35 +++++++++++++++++++----------------
 Makefile               |  6 +++---
 Makefile.target        |  5 ++---
 tests/Makefile.include |  2 +-
 scripts/simpletrace.py | 23 ++++++++++++++++++++++-
 5 files changed, 47 insertions(+), 24 deletions(-)
Signature · 1 line
2.9.3
#1 lore raw

[Qemu-devel] [PULL for-2.9 1/3] configure: eliminate Python dependency for --help

The ./configure script should produce --help output even if Python is not installed.

Listing trace backends is simple: show the names of all Python modules in scripts/tracetool/backend/ whose source code contains 'PUBLIC = True'.

Perform the backend enumeration in shell instead of Python so that we can move the Python check until after ./configure --help.

Message-id: [email protected]

---
 configure | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)
configure +19 -16
index be4d326..6db3044 100755
@@ -1191,21 +1191,6 @@ for opt do
   esac
 done
 
-if ! has $python; then
-  error_exit "Python not found. Use --python=/path/to/python"
-fi
-
-# Note that if the Python conditional here evaluates True we will exit
-# with status 1 which is a shell 'false' value.
-if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
-  error_exit "Cannot use '$python', Python 2.6 or later is required." \
-      "Note that Python 3 or later is not yet supported." \
-      "Use --python=/path/to/python to specify a supported Python."
-fi
-
-# Suppress writing compiled files
-python="$python -B"
-
 case "$cpu" in
     ppc)
            CPU_CFLAGS="-m32"
@@ -1280,6 +1265,9 @@ for config in $mak_wilds; do
     default_target_list="${default_target_list} $(basename "$config" .mak)"
 done
 
+# Enumerate public trace backends for --help output
+trace_backend_list=$(echo $(grep -le '^PUBLIC = True$' scripts/tracetool/backend/*.py | sed -e 's/^.*\/\(.*\)\.py$/\1/'))
+
 if test x"$show_help" = x"yes" ; then
 cat << EOF
 
@@ -1333,7 +1321,7 @@ Advanced options (experts only):
                            set block driver read-only whitelist
                            (affects only QEMU, not qemu-img)
   --enable-trace-backends=B Set trace backend
-                           Available backends: $($python $source_path/scripts/tracetool.py --list-backends)
+                           Available backends: $trace_backend_list
   --with-trace-file=NAME   Full PATH,NAME of file to store traces
                            Default:trace-<pid>
   --disable-slirp          disable SLIRP userspace network connectivity
@@ -1433,6 +1421,21 @@ EOF
 exit 0
 fi
 
+if ! has $python; then
+  error_exit "Python not found. Use --python=/path/to/python"
+fi
+
+# Note that if the Python conditional here evaluates True we will exit
+# with status 1 which is a shell 'false' value.
+if ! $python -c 'import sys; sys.exit(sys.version_info < (2,6) or sys.version_info >= (3,))'; then
+  error_exit "Cannot use '$python', Python 2.6 or later is required." \
+      "Note that Python 3 or later is not yet supported." \
+      "Use --python=/path/to/python to specify a supported Python."
+fi
+
+# Suppress writing compiled files
+python="$python -B"
+
 # Now we have handled --enable-tcg-interpreter and know we're not just
 # printing the help message, bail out if the host CPU isn't supported.
 if test "$ARCH" = "unknown"; then
Signature · 1 line
2.9.3
#2 lore raw

[Qemu-devel] [PULL for-2.9 2/3] trace: Put all trace.o into libqemuutil.a

In reply to Stefan Hajnoczi

From: "Xu, Anthony" <[email protected]>

Currently all trace.o are linked into qemu-system, qemu-img, qemu-nbd, qemu-io etc., even the corresponding components are not included.
Put all trace.o into libqemuutil.a that the linker would only pull in .o files containing symbols that are actually referenced by the program.

Signed-off -by: Anthony Xu <[email protected]>

---
 Makefile               | 6 +++---
 Makefile.target        | 5 ++---
 tests/Makefile.include | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)
Makefile +3 -3
index 6c359b2..31d41a7 100644
@@ -346,7 +346,7 @@ dtc/%:
 	mkdir -p $@
 
 $(SUBDIR_RULES): libqemuutil.a libqemustub.a $(common-obj-y) $(chardev-obj-y) \
-	$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY)) $(trace-obj-y)
+	$(qom-obj-y) $(crypto-aes-obj-$(CONFIG_USER_ONLY))
 
 ROMSUBDIR_RULES=$(patsubst %,romsubdir-%, $(ROMS))
 # Only keep -O and -g cflags
@@ -366,11 +366,11 @@ Makefile: $(version-obj-y)
 # Build libraries
 
 libqemustub.a: $(stub-obj-y)
-libqemuutil.a: $(util-obj-y)
+libqemuutil.a: $(util-obj-y) $(trace-obj-y)
 
 ######################################################################
 
-COMMON_LDADDS = $(trace-obj-y) libqemuutil.a libqemustub.a
+COMMON_LDADDS = libqemuutil.a libqemustub.a
 
 qemu-img.o: qemu-img-cmds.h
 
Makefile.target +2 -3
index 7df2b8c..e62021d 100644
@@ -188,8 +188,7 @@ dummy := $(call unnest-vars,.., \
                qom-obj-y \
                io-obj-y \
                common-obj-y \
-               common-obj-m \
-               trace-obj-y)
+               common-obj-m)
 target-obj-y := $(target-obj-y-save)
 all-obj-y += $(common-obj-y)
 all-obj-y += $(target-obj-y)
@@ -201,7 +200,7 @@ all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
 
 $(QEMU_PROG_BUILD): config-devices.mak
 
-COMMON_LDADDS = $(trace-obj-y) ../libqemuutil.a ../libqemustub.a
+COMMON_LDADDS = ../libqemuutil.a ../libqemustub.a
 
 # build either PROG or PROGW
 $(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS)
tests/Makefile.include +1 -1
index f3de81f..579ec07 100644
@@ -519,7 +519,7 @@ QEMU_CFLAGS += -I$(SRC_PATH)/tests
 
 
 # Deps that are common to various different sets of tests below
-test-util-obj-y = $(trace-obj-y) libqemuutil.a libqemustub.a
+test-util-obj-y = libqemuutil.a libqemustub.a
 test-qom-obj-y = $(qom-obj-y) $(test-util-obj-y)
 test-qapi-obj-y = tests/test-qapi-visit.o tests/test-qapi-types.o \
 	tests/test-qapi-event.o tests/test-qmp-introspect.o \
Signature · 1 line
2.9.3
#3 lore raw

[Qemu-devel] [PULL for-2.9 3/3] simpletrace: document Analyzer method signatures

In reply to Stefan Hajnoczi

Users can inherit from the simpletrace.Analyzer class and receive callbacks when events of interest occur in a trace file. The method signature is a little magic because the timestamp and pid arguments are optional. Document this.

Message-id: [email protected]

---
 scripts/simpletrace.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
scripts/simpletrace.py +22 -1
index 4c99004..d60b3a0 100755
@@ -116,7 +116,28 @@ class Analyzer(object):
     is invoked.
 
     If a method matching a trace event name exists, it is invoked to process
-    that trace record.  Otherwise the catchall() method is invoked."""
+    that trace record.  Otherwise the catchall() method is invoked.
+
+    Example:
+    The following method handles the runstate_set(int new_state) trace event::
+
+      def runstate_set(self, new_state):
+          ...
+
+    The method can also take a timestamp argument before the trace event
+    arguments::
+
+      def runstate_set(self, timestamp, new_state):
+          ...
+
+    Timestamps have the uint64_t type and are in nanoseconds.
+
+    The pid can be included in addition to the timestamp and is useful when
+    dealing with traces from multiple processes::
+
+      def runstate_set(self, timestamp, pid, new_state):
+          ...
+    """
 
     def begin(self):
         """Called at the start of the trace."""
Signature · 1 line
2.9.3
#4 lore raw
In reply to Stefan Hajnoczi
Quoted 8 lines · Stefan Hajnoczi

The following changes since commit fa54abb8c298f892639ffc4bc2f61448ac3be4a1:

Drop QEMU_GNUC_PREREQ() checks for gcc older than 4.1 (2017-04-20 18:33:33 +0100)

are available in the git repository at:

git://github.com/stefanha/qemu.git tags/tracing-pull-request

Quoted 7 lines

for you to fetch changes up to 659370f71f2c3d4105b04178abd751242e1c1b68:

simpletrace: document Analyzer method signatures (2017-04-21 10:45:35 +0100)

----------------------------------------------------------------

----------------------------------------------------------------

Applied, thanks.

-- PMM