From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: linux-trace-devel@vger.kernel.org
Cc: rostedt@goodmis.org, Douglas.Raillard@arm.com,
Valentin.Schneider@arm.com, nd@arm.com,
"Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
Subject: [PATCH v2 05/12] trace-cruncher: Adapt sched_wakeup.py to use the new module
Date: Tue, 7 Jan 2020 19:03:05 +0200 [thread overview]
Message-ID: <20200107170312.27116-6-y.karadz@gmail.com> (raw)
In-Reply-To: <20200107170312.27116-1-y.karadz@gmail.com>
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
examples/sched_wakeup.py | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/examples/sched_wakeup.py b/examples/sched_wakeup.py
index 52f2688..41e0c9c 100755
--- a/examples/sched_wakeup.py
+++ b/examples/sched_wakeup.py
@@ -15,18 +15,18 @@ import matplotlib.pyplot as plt
import scipy.stats as st
import numpy as np
-from ksharksetup import setup
-# Always call setup() before importing ksharkpy!!!
-setup()
+import tracecruncher.datawrapper as dw
+import tracecruncher.ksharkpy as ks
+import tracecruncher.ftracepy as ft
+import tracecruncher.utils as tc
-import ksharkpy as ks
# Get the name of the user program.
if len(sys.argv) >= 2:
fname = str(sys.argv[1])
else:
fname = input('choose a trace file: ')
-status = ks.open_file(fname)
+status = ks.open(fname)
if not status:
print ("Failed to open file ", fname)
sys.exit()
@@ -35,7 +35,7 @@ ks.register_plugin('reg_pid')
# We do not need the Process Ids of the records.
# Do not load the "pid" data.
-data = ks.load_data(pid_data=False)
+data = dw.load(pid_data=False)
tasks = ks.get_tasks()
# Get the name of the user program.
@@ -48,8 +48,8 @@ else:
task_pid = tasks[prog_name][0]
# Get the Event Ids of the sched_switch and sched_waking events.
-ss_eid = ks.event_id('sched', 'sched_switch')
-w_eid = ks.event_id('sched', 'sched_waking')
+ss_eid = ft.event_id('sched', 'sched_switch')
+w_eid = ft.event_id('sched', 'sched_waking')
# Gey the size of the data.
i = data['offset'].size
@@ -60,7 +60,7 @@ delta_max = i_ss_max = i_sw_max = 0
while i > 0:
i = i - 1
if data['event'][i] == ss_eid:
- next_pid = ks.read_event_field(offset=data['offset'][i],
+ next_pid = ft.read_event_field(offset=data['offset'][i],
event_id=ss_eid,
field='next_pid')
@@ -77,9 +77,9 @@ while i > 0:
break
if data['event'][i] == ss_eid:
- next_pid = ks.read_event_field(offset=data['offset'][i],
- event_id=ss_eid,
- field='next_pid')
+ next_pid = ft.read_event_field(offset=data['offset'][i],
+ event_id=ss_eid,
+ field='next_pid')
if next_pid == task_pid:
# Second sched_switch for the same task. ?
time_ss = data['time'][i]
@@ -89,7 +89,7 @@ while i > 0:
continue
if (data['event'][i] == w_eid):
- waking_pid = ks.read_event_field(offset=data['offset'][i],
+ waking_pid = ft.read_event_field(offset=data['offset'][i],
event_id=w_eid,
field='pid')
@@ -120,7 +120,7 @@ ax.hist(dt, bins=(100), histtype='step')
plt.show()
sname = 'sched.json'
-ks.new_session(fname, sname)
+tc.new_gui_session(fname, sname)
with open(sname, 'r+') as s:
session = json.load(s)
@@ -143,6 +143,6 @@ with open(sname, 'r+') as s:
session['ViewTop'] = int(i_sw_max) - 5
- ks.save_session(session, s)
+ tc.save_session(session, s)
ks.close()
--
2.20.1
next prev parent reply other threads:[~2020-01-07 17:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-07 17:03 [PATCH v2 00/12] Build trace-cruncher as Python pakage Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 01/12] trace-cruncher: Refactor the part of the interface that relies on libkshark Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 02/12] trace-cruncher: Refactor the part of the interface that relies on libtraceevent Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 03/12] trace-cruncher: Refactor NumPy based data wrapper Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 04/12] trace-cruncher: Add "utils" Yordan Karadzhov (VMware)
2020-01-07 17:03 ` Yordan Karadzhov (VMware) [this message]
2020-01-07 17:03 ` [PATCH v2 06/12] trace-cruncher: Add Makefile Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 07/12] trace-cruncher: Adapt gpareto_fit.py to use the new module Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 08/12] trace-cruncher: Adapt page_faults.py " Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 09/12] trace-cruncher: Automate the third-party build Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 10/12] trace-cruncher: Update README.md Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 11/12] trace-cruncher: Remove all leftover files Yordan Karadzhov (VMware)
2020-01-07 17:03 ` [PATCH v2 12/12] trace-cruncher: Improve Makefile Provide more robust and better looking build process 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=20200107170312.27116-6-y.karadz@gmail.com \
--to=y.karadz@gmail.com \
--cc=Douglas.Raillard@arm.com \
--cc=Valentin.Schneider@arm.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=nd@arm.com \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).