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 2/8] trace-cruncher: Fix bug in the constructor if tc_synth class
Date: Thu, 10 Feb 2022 17:23:33 +0200 [thread overview]
Message-ID: <20220210152339.363943-3-y.karadz@gmail.com> (raw)
In-Reply-To: <20220210152339.363943-1-y.karadz@gmail.com>
There is a missing argument when calling one of the low-level APIs for
synthetic events (add_sum()). In the patch we also add comments, in order
to make this part of the code more readable.
Signed-off-by: Yordan Karadzhov (VMware) <y.karadz@gmail.com>
---
tracecruncher/ft_utils.py | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tracecruncher/ft_utils.py b/tracecruncher/ft_utils.py
index f4d1f05..7e0e642 100644
--- a/tracecruncher/ft_utils.py
+++ b/tracecruncher/ft_utils.py
@@ -357,6 +357,8 @@ class tc_synth(tc_event):
for f in synth_fields:
args = f.split(' ')
if args[0] == 'delta_t' and len(args) < 4:
+ # The expected format is: 'delta_t [name] hd'.
+ # Arguments 1 and 2 are optional.
if len(args) == 1:
self.synth.add_delta_T()
elif len(args) == 3 and args[2] == 'hd':
@@ -366,15 +368,26 @@ class tc_synth(tc_event):
else:
self.synth.add_delta_T(name=args[1])
elif args[0] == 'delta_start' and len(args) == 4:
+ # The expected format is:
+ # 'delta_start [name] [start_field] [end_field]'.
self.synth.add_delta_start(name=args[1],
start_field=args[2],
end_field=args[3])
+
elif args[0] == 'delta_end' and len(args) == 4:
+ # The expected format is:
+ # 'delta_end [name] [start_field] [end_field]'.
self.synth.add_delta_end(name=args[1],
start_field=args[2],
end_field=args[3])
- elif args[0] == 'delta_start' and len(args) == 3:
- self.synth.add_sum(start_field=args[1], end_field=args[2])
+
+ elif args[0] == 'sun' and len(args) == 4:
+ # The expected format is:
+ # 'sum [name] [start_field] [end_field]'.
+ self.synth.add_sum(name=args[1],
+ start_field=args[2],
+ end_field=args[3])
+
else:
raise ValueError('Invalid synth. field \'{0}\''.format(f))
--
2.32.0
next prev parent reply other threads:[~2022-02-10 15:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-10 15:23 [PATCH 0/8] trace-cruncher:Fixes before v0.2 (Beta) Yordan Karadzhov (VMware)
2022-02-10 15:23 ` [PATCH 1/8] trace-cruncher: Prefix all python class names with 'tc_' Yordan Karadzhov (VMware)
2022-02-10 15:23 ` Yordan Karadzhov (VMware) [this message]
2022-02-10 15:23 ` [PATCH 3/8] trace-cruncher: Add tests for synth helper APIs Yordan Karadzhov (VMware)
2022-02-10 15:23 ` [PATCH 4/8] trace-cruncher: Code cleanup in the constructor of tc_synth Yordan Karadzhov (VMware)
2022-02-10 15:23 ` [PATCH 5/8] trace-cruncher: Rename python function argument in PyFtrace_eprobe Yordan Karadzhov (VMware)
2022-02-10 15:23 ` [PATCH 6/8] trace-cruncher: Add tc_eprobe class to ft_utiles Yordan Karadzhov (VMware)
2022-02-10 15:23 ` [PATCH 7/8] trace-cruncher: Check kernel support in the eprobe constructor Yordan Karadzhov (VMware)
2022-02-10 15:23 ` [PATCH 8/8] trace-cruncher: Add more comments to the examples 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=20220210152339.363943-3-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 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).