Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit a9d346b

Browse files
author
Julien Desfossez
committed
fix: filtering of period in stats and freq per-parent
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
1 parent 7e126fb commit a9d346b

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lttnganalyses/cli/periods.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -843,27 +843,26 @@ def _hierarchical_sub(self, tmp_hierarchical_list, event, per_period_stats,
843843

844844
# Recursively iterate over all the children of this period
845845
for child in event.children:
846+
if not self._filter_event_duration(child):
847+
continue
846848
if child.name not in per_period_stats.keys():
847849
per_period_stats[child.name] = _AggregatedPeriodStats(
848850
self._analysis_conf.period_def_registry,
849851
child.name)
850852
active_periods[event].add_child(child.name, child.duration)
851853
active_periods[child] = _TmpAggregation(active_periods[event])
852-
# print('passing', ancestors_captures + event_captures)
853854
child_captures = self._hierarchical_sub(
854855
tmp_hierarchical_list, child, per_period_stats,
855856
per_parent_period_group_by_stats, active_periods,
856857
ancestors_captures + event_captures,
857858
per_group_active_periods, per_period_group_by_stats)
858859
del(active_periods[child])
859-
# print('returned', child_captures)
860860
for c in child_captures:
861861
local_captures.append(event_captures + c)
862862
global_captures.append(event_captures.copy() + c)
863863
if len(local_captures) == 0:
864864
local_captures = [event_captures]
865865
global_captures = [event_captures.copy()]
866-
# print('in', event.name, 'local + children', local_captures)
867866
full_captures = []
868867
for c in global_captures:
869868
tmp_c = c.copy()
@@ -872,7 +871,6 @@ def _hierarchical_sub(self, tmp_hierarchical_list, event, per_period_stats,
872871
# dedup
873872
if tmp_c not in full_captures:
874873
full_captures.append(tmp_c)
875-
# print('in2', event.name, full_captures)
876874
active_periods[event].capture_groups = full_captures
877875

878876
self._account_parents_in_group(event, full_captures,
@@ -905,6 +903,8 @@ def _get_aggregated_lists(self):
905903
active_periods = {}
906904
per_group_active_periods = {}
907905
for period_event in self._analysis.all_period_list:
906+
if not self._filter_event_duration(period_event):
907+
continue
908908
if self._analysis_conf._order_by == "hierarchy" or \
909909
self._args.stats or self._args.freq:
910910
# Only top-level events to start the recursive iteration
@@ -929,14 +929,14 @@ def _get_aggregated_lists(self):
929929

930930
if period_event.name != self._analysis_conf._aggregate_by:
931931
continue
932-
if not self._filter_event_duration(period_event):
933-
continue
934932
if period_event not in parent_aggregated_dict.keys():
935933
parent_aggregated_dict[period_event] = {}
936934
# Associate the periods with their full capture list (each period
937935
# sees its own capture and the capture of all its children)
938936
tmp_list = []
939937
for child in period_event.children:
938+
if not self._filter_event_duration(child.duration):
939+
continue
940940
self._find_aggregated_subperiods(
941941
period_event,
942942
child, tmp_list,
@@ -1398,6 +1398,8 @@ def _get_per_period_stats_result_table(self, begin_ns, end_ns,
13981398
min, max, count, avg, total, period_list = \
13991399
self._get_filtered_min_max_count_avg_total_flist(
14001400
period_stats.period_list)
1401+
if count == 0:
1402+
continue
14011403
stdev = self._compute_period_duration_stdev(period_list)
14021404

14031405
if math.isnan(stdev):

0 commit comments

Comments
 (0)