Skip to content

Commit 417b789

Browse files
committed
RequirementMachine: Track maximum value stored in the histogram
1 parent 8e7a9b0 commit 417b789

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/AST/RequirementMachine/Histogram.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ class Histogram {
3535
unsigned Start;
3636
std::vector<unsigned> Buckets;
3737
unsigned OverflowBucket;
38+
unsigned MaxValue = 0;
3839

3940
const unsigned MaxWidth = 40;
4041

@@ -73,6 +74,9 @@ class Histogram {
7374
++OverflowBucket;
7475
else
7576
++Buckets[value];
77+
78+
if (value > MaxValue)
79+
MaxValue = value;
7680
}
7781

7882
/// Print a nice-looking graphical representation of the histogram.
@@ -140,6 +144,8 @@ class Histogram {
140144

141145
out << std::string(maxLabelWidth, ' ') << " | ";
142146
out << "Total: " << sumValues << "\n";
147+
out << std::string(maxLabelWidth, ' ') << " | ";
148+
out << "Max: " << MaxValue << "\n";
143149
}
144150
};
145151

0 commit comments

Comments
 (0)