When adding samples to the counter in the test body, most of them get added at the same time (rtc::TimeMicros()). This means that the comparator [2] is not able to sort them explicitly (for the comparator they are equal). PerfTest.TestGetPerfResultsHistogramsWithStatsCounter was relying on std::sort implementation being stable, but it is not. If stability is needed, std::stable_sort should be used so this CL switches ::webrtc::test:GetSortedSamples() to std::stable_sort. [1] - https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/api/numerics/samples_stats_counter.cc;l=31;drc=9d777620236ec76754cfce19f6e82dd18e52d22c [2] - https://source.chromium.org/chromium/chromium/src/+/main:third_party/webrtc/test/testsupport/perf_test.cc;l=51-55;drc=a2e3d80cf6f8833ec6f2c5f8e69c2a58a52ddd62 Bug: None Change-Id: I99a44720ce3ad577f0cdb42aa633bd73d62aeaff Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/242961 Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org> Commit-Queue: Tomas Gunnarsson <tommi@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35600}