Skip to content

Commit 0a2c83f

Browse files
committed
Add fastest and slowest
But without actually sorting the array
1 parent 8c84085 commit 0a2c83f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

wpimath/src/test/native/cpp/TimeTest.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,18 @@ void ProcessDurations(const wpi::array<units::nanosecond_t, N>& durations,
9696
wpi::print("{}Last 10: {}\n", prefix, buffer);
9797

9898
wpi::array<units::nanosecond_t, N> sorted{durations};
99+
100+
for (size_t i = 0; i < 10; ++i) {
101+
buffer[i] = sorted[i];
102+
}
103+
104+
wpi::print("{}Fastest 10: {}\n", prefix, buffer);
105+
106+
for (size_t i = 0; i < 10; ++i) {
107+
buffer[i] = sorted[N - 10 + i];
108+
}
109+
110+
wpi::print("{}Slowest 10: {}\n", prefix, buffer);
99111
}
100112

101113
template <size_t N>

0 commit comments

Comments
 (0)