All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH v4 06/11] trace-cruncher: Add ftracepy example
Date: Wed,  7 Jul 2021 16:21:53 +0300	[thread overview]
Message-ID: <20210707132158.68520-8-y.karadz@gmail.com> (raw)
In-Reply-To: <20210707132158.68520-1-y.karadz@gmail.com>

This is the most basic possible example. To be considered as an
equivalent of a "Hello world" program.

Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
 examples/start_tracing.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
 create mode 100755 examples/start_tracing.py

diff --git a/examples/start_tracing.py b/examples/start_tracing.py
new file mode 100755
index 0000000..da36164
--- /dev/null
+++ b/examples/start_tracing.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python3
+
+"""
+SPDX-License-Identifier: CC-BY-4.0
+
+Copyright (C) 2021 VMware Inc, Yordan Karadzhov (VMware) <y.karadz@gmail.com>
+"""
+
+import tracecruncher.ftracepy as ft
+
+# Create new Ftrace instance to work in.
+inst = ft.create_instance()
+
+# Enable all static events from systems "sched" and "irq".
+ft.enable_events(instance=inst,
+                 systems=['sched', 'irq'],
+                 events=[['sched_switch'],['all']])
+
+# Print the stream of trace events. "Ctrl+c" to stop tracing.
+ft.read_trace(instance=inst)
-- 
2.27.0


  parent reply	other threads:[~2021-07-07 13:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-07 13:21 [PATCH v4 00/11] Build trace-cruncher as Python pakage Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 01/11] trace-cruncher: Refactor the part that wraps ftrace Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 02/11] trace-cruncher: Add basic methods for tracing Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 03/11] trace-cruncher: Refactor the part that wraps libkshark Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 04/11] trace-cruncher: Add "utils" Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 05/11] trace-cruncher: Refactor the examples Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 06/11] trace-cruncher: Add ftracefy example Yordan Karadzhov (VMware)
2021-07-07 13:21 ` Yordan Karadzhov (VMware) [this message]
2021-07-07 13:21 ` [PATCH v4 07/11] trace-cruncher: Add Makefile Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 08/11] trace-cruncher: Update README.md Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 09/11] trace-cruncher: Remove all leftover files Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 10/11] trace-cruncher: Add testing Yordan Karadzhov (VMware)
2021-07-07 13:21 ` [PATCH v4 11/11] trace-cruncher: Add github workflow for CI testing Yordan Karadzhov (VMware)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210707132158.68520-8-y.karadz@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.