From: Nicholas Nethercote Date: Tue, 21 Mar 2023 00:58:36 +0000 (+1100) Subject: Change `Threshold:` to `Thresholds:`. X-Git-Tag: VALGRIND_3_21_0~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05d01cd6817613331b35955c84b23757e27db392;p=thirdparty%2Fvalgrind.git Change `Threshold:` to `Thresholds:`. Because all the thresholds other than the first one were always 100, due to historical reasons. --- diff --git a/cachegrind/cg_annotate.in b/cachegrind/cg_annotate.in index ac2f2b792a..48bf4f1aab 100755 --- a/cachegrind/cg_annotate.in +++ b/cachegrind/cg_annotate.in @@ -233,12 +233,6 @@ class Events: # Like `sort_events`, but indices into `events`, rather than names. sort_indices: list[int] - # Threshold percentages, one per sort event. Dictates when we stop printing - # functions. Positions correspond to positions in `sort_events`. Only - # `thresholds[0]` is actually used for thresholding, for historical - # reasons. - threshold_percs: list[float] - def __init__(self, text: str) -> None: self.events = text.split() self.num_events = len(self.events) @@ -269,11 +263,6 @@ class Events: self.sort_indices = [event_indices[event] for event in self.sort_events] - # The primary sort event gets the --threshold value, and all other sort - # events get 100% (i.e. ignored). - self.threshold_percs = [100] * len(self.sort_events) - self.threshold_percs[0] = args.threshold - def mk_cc(self, text: str) -> Cc: # This is slightly faster than a list comprehension. counts = list(map(int, text.split())) @@ -561,7 +550,7 @@ def print_header(desc: str, cmd: str, events: Events) -> None: print("Events recorded: ", *events.events) print("Events shown: ", *events.show_events) print("Event sort order:", *events.sort_events) - print("Thresholds: ", *events.threshold_percs) + print("Threshold: ", args.threshold) if len(args.include) == 0: print("Include dirs: ") @@ -598,9 +587,7 @@ def print_flfn_ccs( threshold_index = events.sort_indices[0] # Convert the threshold from a percentage to an event count. - threshold = ( - events.threshold_percs[0] * abs(summary_cc.counts[threshold_index]) / 100 - ) + threshold = args.threshold * abs(summary_cc.counts[threshold_index]) / 100 def meets_threshold(flfn_and_cc: tuple[Flfn, Cc]) -> bool: cc = flfn_and_cc[1] diff --git a/cachegrind/tests/ann1.post.exp b/cachegrind/tests/ann1.post.exp index 10196377a7..e946b0a743 100644 --- a/cachegrind/tests/ann1.post.exp +++ b/cachegrind/tests/ann1.post.exp @@ -7,7 +7,7 @@ Data file: cgout-test Events recorded: Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw Events shown: Ir I1mr ILmr Event sort order: Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw -Thresholds: 0.1 100 100 100 100 100 100 100 100 +Threshold: 0.1 Include dirs: User annotated: Auto-annotation: on diff --git a/cachegrind/tests/ann2.post.exp b/cachegrind/tests/ann2.post.exp index 4428346813..a4884e6152 100644 --- a/cachegrind/tests/ann2.post.exp +++ b/cachegrind/tests/ann2.post.exp @@ -7,7 +7,7 @@ Data file: cgout-test Events recorded: Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw Events shown: Dw Dr Ir Event sort order: Dr -Thresholds: 0.1 +Threshold: 0.1 Include dirs: User annotated: a.c Auto-annotation: off diff --git a/cachegrind/tests/ann3.post.exp b/cachegrind/tests/ann3.post.exp index 063715aa6f..a5520b5af3 100644 --- a/cachegrind/tests/ann3.post.exp +++ b/cachegrind/tests/ann3.post.exp @@ -4,7 +4,7 @@ Data file: cgout-test3 Events recorded: A SomeCount VeryLongEventName Events shown: A SomeCount VeryLongEventName Event sort order: A SomeCount VeryLongEventName -Thresholds: 0.5 100 100 +Threshold: 0.5 Include dirs: ann3-no-such-dir ann3-no-such-dir-2 ann3-aux diff --git a/cachegrind/tests/diff.post.exp b/cachegrind/tests/diff.post.exp index 81fbe3e920..7d3b8aeeee 100644 --- a/cachegrind/tests/diff.post.exp +++ b/cachegrind/tests/diff.post.exp @@ -5,7 +5,7 @@ Data file: cgout-diff Events recorded: Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw Events shown: Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw Event sort order: Ir I1mr ILmr Dr D1mr DLmr Dw D1mw DLmw -Thresholds: 0.1 100 100 100 100 100 100 100 100 +Threshold: 0.1 Include dirs: User annotated: Auto-annotation: on