mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-28 17:19:34 +08:00
Changes: boost, easylogging, g2log, glog, spdlog.
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
//
|
||||
|
||||
#include <atomic>
|
||||
#include <chrono>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
|
||||
@@ -13,6 +15,8 @@ using namespace std;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
using namespace std::chrono;
|
||||
using clock = steady_clock;
|
||||
|
||||
int thread_count = 10;
|
||||
if (argc > 1)
|
||||
@@ -27,6 +31,7 @@ int main(int argc, char *argv[])
|
||||
std::atomic<int> msg_counter{0};
|
||||
vector<thread> threads;
|
||||
|
||||
auto start = clock::now();
|
||||
for (int t = 0; t < thread_count; ++t)
|
||||
{
|
||||
threads.push_back(std::thread([&]() {
|
||||
@@ -43,7 +48,16 @@ int main(int argc, char *argv[])
|
||||
for (auto &t : threads)
|
||||
{
|
||||
t.join();
|
||||
};
|
||||
}
|
||||
|
||||
duration<float> delta = clock::now() - start;
|
||||
float deltaf = delta.count();
|
||||
auto rate = howmany / deltaf;
|
||||
|
||||
std::cout << "Total: " << howmany << std::endl;
|
||||
std::cout << "Threads: " << thread_count << std::endl;
|
||||
std::cout << "Delta = " << deltaf << " seconds" << std::endl;
|
||||
std::cout << "Rate = " << rate << "/sec" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user