filter_openocd: Prefer high repetitions.

I'd rather see "these 10 lines were repeated 100 times" than "these 100
lines were repeated 10 times."

Change-Id: I88fcf86b10c5fb0ba1d19b21fe054065da90fedd
Signed-off-by: Tim Newsome <tim@sifive.com>
This commit is contained in:
Tim Newsome 2022-10-05 11:51:00 -07:00
parent 4270857a76
commit bed28d5ec7
1 changed files with 1 additions and 1 deletions

View File

@ -50,7 +50,7 @@ def shorten_buffer(outfd, buf, current_repetition):
repetitions.append((matched_lines + length, length)) repetitions.append((matched_lines + length, length))
if repetitions: if repetitions:
repetitions.sort(key=lambda entry: (entry[0] * (entry[1] / entry[0]), -entry[1])) repetitions.sort(key=lambda entry: -entry[1])
matched_lines, length = repetitions[-1] matched_lines, length = repetitions[-1]
repeated = int(matched_lines / length) repeated = int(matched_lines / length)
if repeated * length >= 3: if repeated * length >= 3: