Skip to content

Commit 284d513

Browse files
authored
[rdma]improve statistic (#959)
1 parent 29eb2a1 commit 284d513

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/coro_rpc/benchmark/bench.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,16 @@ async_simple::coro::Lazy<std::error_code> request(const bench_config& conf) {
9292
});
9393
}
9494

95+
std::cout << std::fixed << std::setprecision(2);
96+
9597
while (true) {
98+
auto start = std::chrono::system_clock::now();
9699
std::this_thread::sleep_for(std::chrono::seconds{1});
97100
auto c = g_count.exchange(0);
98-
std::cout << "Throughput:" << 8.0 * c / 1000'000'000 << " Gb/s\n";
101+
auto end = std::chrono::system_clock::now();
102+
auto dur = (end - start) / std::chrono::milliseconds(1);
103+
double val = (8.0 * c * 1000) / (1000'000'000ll * dur);
104+
std::cout << "Throughput:" << val << " Gb/s\n";
99105
}
100106
}
101107

0 commit comments

Comments
 (0)