mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Replace std::cout and std::cerr with fmt::print() (#3519)
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
#include "wpi/spinlock.h" // NOLINT(build/include_order)
|
||||
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
#include "fmt/core.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "wpi/mutex.h"
|
||||
|
||||
@@ -50,9 +50,8 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "std::mutex sizeof: " << sizeof(std_mutex)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("std::mutex sizeof: {} time: {} value: {}\n", sizeof(std_mutex),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thrb.join();
|
||||
|
||||
@@ -65,9 +64,9 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "std::recursive_mutex sizeof: " << sizeof(std_recursive_mutex)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("std::recursive_mutex sizeof: {} time: {} value: {}\n",
|
||||
sizeof(std_recursive_mutex),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thrb2.join();
|
||||
|
||||
@@ -80,9 +79,8 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "wpi::mutex sizeof: " << sizeof(wpi_mutex)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("wpi::mutex sizeof: {} time: {} value: {}\n", sizeof(wpi_mutex),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thr2.join();
|
||||
|
||||
@@ -95,9 +93,9 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "wpi::recursive_mutex sizeof: " << sizeof(wpi_recursive_mutex)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("wpi::recursive_mutex sizeof: {} time: {} value: {}\n",
|
||||
sizeof(wpi_recursive_mutex),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thr2b.join();
|
||||
|
||||
@@ -110,9 +108,8 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "spinlock sizeof: " << sizeof(spinlock)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("spinlock sizeof: {} time: {} value: {}\n", sizeof(spinlock),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thr3.join();
|
||||
|
||||
@@ -125,9 +122,9 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "recursive_spinlock1 sizeof: " << sizeof(recursive_spinlock1)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("recursive_spinlock1 sizeof: {} time: {} value: {}\n",
|
||||
sizeof(recursive_spinlock1),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thr4.join();
|
||||
|
||||
@@ -140,9 +137,9 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "recursive_spinlock2 sizeof: " << sizeof(recursive_spinlock2)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("recursive_spinlock2 sizeof: {} time: {} value: {}\n",
|
||||
sizeof(recursive_spinlock2),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thr4b.join();
|
||||
|
||||
@@ -155,9 +152,9 @@ TEST(SpinlockTest, Benchmark) {
|
||||
++value;
|
||||
}
|
||||
auto stop = high_resolution_clock::now();
|
||||
std::cout << "recursive_spinlock sizeof: " << sizeof(recursive_spinlock)
|
||||
<< " time: " << duration_cast<microseconds>(stop - start).count()
|
||||
<< " value: " << value << "\n";
|
||||
fmt::print("recursive_spinlock sizeof: {} time: {} value: {}\n",
|
||||
sizeof(recursive_spinlock),
|
||||
duration_cast<microseconds>(stop - start).count(), value);
|
||||
});
|
||||
thr4c.join();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user