qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.9 0/3] Tracing patches
@ 2017-04-21  9:53 Stefan Hajnoczi
  2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 1/3] configure: eliminate Python dependency for --help Stefan Hajnoczi
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-04-21  9:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, 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

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(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL for-2.9 1/3] configure: eliminate Python dependency for --help
  2017-04-21  9:53 [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Stefan Hajnoczi
@ 2017-04-21  9:53 ` Stefan Hajnoczi
  2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 2/3] trace: Put all trace.o into libqemuutil.a Stefan Hajnoczi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-04-21  9:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Stefan Hajnoczi

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.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 20170328134418.3426-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 configure | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/configure b/configure
index be4d326..6db3044 100755
--- a/configure
+++ b/configure
@@ -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
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL for-2.9 2/3] trace: Put all trace.o into libqemuutil.a
  2017-04-21  9:53 [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Stefan Hajnoczi
  2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 1/3] configure: eliminate Python dependency for --help Stefan Hajnoczi
@ 2017-04-21  9:53 ` Stefan Hajnoczi
  2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 3/3] simpletrace: document Analyzer method signatures Stefan Hajnoczi
  2017-04-21 14:59 ` [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-04-21  9:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, Xu, Anthony, Stefan Hajnoczi

From: "Xu, Anthony" <anthony.xu@intel.com>

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 <anthony.xu@intel.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 Makefile               | 6 +++---
 Makefile.target        | 5 ++---
 tests/Makefile.include | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 6c359b2..31d41a7 100644
--- a/Makefile
+++ b/Makefile
@@ -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
 
diff --git a/Makefile.target b/Makefile.target
index 7df2b8c..e62021d 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -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)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index f3de81f..579ec07 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -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 \
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL for-2.9 3/3] simpletrace: document Analyzer method signatures
  2017-04-21  9:53 [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Stefan Hajnoczi
  2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 1/3] configure: eliminate Python dependency for --help Stefan Hajnoczi
  2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 2/3] trace: Put all trace.o into libqemuutil.a Stefan Hajnoczi
@ 2017-04-21  9:53 ` Stefan Hajnoczi
  2017-04-21 14:59 ` [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Stefan Hajnoczi @ 2017-04-21  9:53 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, 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.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Message-id: 20170411095654.18383-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 scripts/simpletrace.py | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index 4c99004..d60b3a0 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -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."""
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PULL for-2.9 0/3] Tracing patches
  2017-04-21  9:53 [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Stefan Hajnoczi
                   ` (2 preceding siblings ...)
  2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 3/3] simpletrace: document Analyzer method signatures Stefan Hajnoczi
@ 2017-04-21 14:59 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2017-04-21 14:59 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers

On 21 April 2017 at 10:53, Stefan Hajnoczi <stefanha@redhat.com> wrote:
> 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)
>
> ----------------------------------------------------------------
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-21 14:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-21  9:53 [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Stefan Hajnoczi
2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 1/3] configure: eliminate Python dependency for --help Stefan Hajnoczi
2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 2/3] trace: Put all trace.o into libqemuutil.a Stefan Hajnoczi
2017-04-21  9:53 ` [Qemu-devel] [PULL for-2.9 3/3] simpletrace: document Analyzer method signatures Stefan Hajnoczi
2017-04-21 14:59 ` [Qemu-devel] [PULL for-2.9 0/3] Tracing patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).