[PATCH 2/8] trace-cruncher: Fix bug in the constructor if tc_synth class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux