diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2017-04-11 10:56:54 +0100 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2017-04-21 10:45:35 +0100 |
commit | 659370f71f2c3d4105b04178abd751242e1c1b68 (patch) | |
tree | f7227dbed57f65b1a769280ad680fe149e3e3842 /scripts | |
parent | 3d1baccb08562e2893085f102c863507917c0453 (diff) |
simpletrace: document Analyzer method signatures
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>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/simpletrace.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py index 4c990047b6..d60b3a08f7 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.""" |