Tests: Multi-trace stream intersection test
[babeltrace.git] / bindings / python / examples / sched_switch.py
index 99e818e290de8de98f1f30b23a85ef821ea52a60..0deb4a5320af4a13f70c17cb3a89df820364b93b 100644 (file)
 #
 # The above copyright notice and this permission notice shall be included in
 # all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
 
 # The script takes one optional argument (pid)
 # The script will read events based on pid and
@@ -26,7 +34,9 @@
 # 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")
@@ -35,7 +45,7 @@ elif len(sys.argv) == 3:
 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")
@@ -45,7 +55,7 @@ for event in traces.events:
         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
This page took 0.023652 seconds and 4 git commands to generate.