projects
/
babeltrace.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Python: examples: import explicit BT modules
[babeltrace.git]
/
bindings
/
python
/
examples
/
sched_switch.py
diff --git
a/bindings/python/examples/sched_switch.py
b/bindings/python/examples/sched_switch.py
index cf944f5278a8a6c0d7077ceadbff0a3de4758836..0deb4a5320af4a13f70c17cb3a89df820364b93b 100644
(file)
--- a/
bindings/python/examples/sched_switch.py
+++ b/
bindings/python/examples/sched_switch.py
@@
-34,7
+34,9
@@
# The trace needs PID context (lttng add-context -k -t pid)
import sys
# The trace needs PID context (lttng add-context -k -t pid)
import sys
-from babeltrace import *
+import babeltrace.reader
+import babeltrace.common
+
if len(sys.argv) < 2 or len(sys.argv) > 3:
raise TypeError("Usage: python sched_switch.py [pid] path/to/trace")
if len(sys.argv) < 2 or len(sys.argv) > 3:
raise TypeError("Usage: python sched_switch.py [pid] path/to/trace")
@@
-43,7
+45,7
@@
elif len(sys.argv) == 3:
else:
filterPID = False
else:
filterPID = False
-traces = TraceCollection()
+traces =
babeltrace.reader.
TraceCollection()
ret = traces.add_trace(sys.argv[len(sys.argv) - 1], "ctf")
if ret is None:
raise IOError("Error adding trace")
ret = traces.add_trace(sys.argv[len(sys.argv) - 1], "ctf")
if ret is None:
raise IOError("Error adding trace")
@@
-53,7
+55,7
@@
for event in traces.events:
continue
# Getting PID
continue
# Getting PID
- pid = event.field_with_scope("pid", CTFScope.STREAM_EVENT_CONTEXT)
+ pid = event.field_with_scope("pid",
babeltrace.common.
CTFScope.STREAM_EVENT_CONTEXT)
if pid is None:
print("ERROR: Missing PID info for sched_switch")
continue # Next event
if pid is None:
print("ERROR: Missing PID info for sched_switch")
continue # Next event
This page took
0.025312 seconds
and
4
git commands to generate.