All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] simpletrace: document Analyzer method signatures
@ 2017-04-11  9:56 Stefan Hajnoczi
  2017-04-11 12:28 ` Alex Bennée
  2017-04-11 15:43 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2017-04-11  9:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée, 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>
---
 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] 3+ messages in thread

* Re: [Qemu-devel] [PATCH] simpletrace: document Analyzer method signatures
  2017-04-11  9:56 [Qemu-devel] [PATCH] simpletrace: document Analyzer method signatures Stefan Hajnoczi
@ 2017-04-11 12:28 ` Alex Bennée
  2017-04-11 15:43 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Bennée @ 2017-04-11 12:28 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel


Stefan Hajnoczi <stefanha@redhat.com> writes:

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

> ---
>  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."""


--
Alex Bennée

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

* Re: [Qemu-devel] [PATCH] simpletrace: document Analyzer method signatures
  2017-04-11  9:56 [Qemu-devel] [PATCH] simpletrace: document Analyzer method signatures Stefan Hajnoczi
  2017-04-11 12:28 ` Alex Bennée
@ 2017-04-11 15:43 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2017-04-11 15:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alex Bennée

[-- Attachment #1: Type: text/plain, Size: 595 bytes --]

On Tue, Apr 11, 2017 at 10:56:54AM +0100, Stefan Hajnoczi wrote:
> 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>
> ---
>  scripts/simpletrace.py | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)

Thanks, applied to my tracing-next tree:
https://github.com/stefanha/qemu/commits/tracing-next

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

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

end of thread, other threads:[~2017-04-11 15:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-11  9:56 [Qemu-devel] [PATCH] simpletrace: document Analyzer method signatures Stefan Hajnoczi
2017-04-11 12:28 ` Alex Bennée
2017-04-11 15:43 ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.