Skip to content

Commit

Permalink
Compute time per operation in ns.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehpor committed Dec 12, 2024
1 parent 6158e28 commit d419a78
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions benchmarks/free_list_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ void benchmark_linux_scalability()
std::cout << "Linux Scalability:" << std::endl;
std::cout << "Time: " << (end - start) / 1e9 << " sec" << std::endl;
std::cout << "Throughput: " << 2 * N / ((end - start) / 1e9) << " ops/s" << std::endl;
std::cout << "Time per operation: " << (end - start) / (2 * N) << " ns" << std::endl;

delete[] handles;
delete[] buffer;
Expand Down Expand Up @@ -76,6 +77,7 @@ void benchmark_threadtest()
std::cout << "Threadtest:" << std::endl;
std::cout << "Time: " << (end - start) / 1e9 << " sec" << std::endl;
std::cout << "Throughput: " << 2 * N * M / ((end - start) / 1e9) << " ops/s" << std::endl;
std::cout << "Time per operation: " << (end - start) / (2 * N * M) << " ns" << std::endl;

delete[] handles;
}
Expand Down Expand Up @@ -129,6 +131,7 @@ void benchmark_larson()
std::cout << "Larson benchmark:" << std::endl;
std::cout << "Time: " << (end - start) / 1e9 << " sec" << std::endl;
std::cout << "Throughput: " << (N * 2 - M) / ((end - start) / 1e9) << " ops/s" << std::endl;
std::cout << "Time per operation: " << (end - start) / (2 * N - M) << " ns" << std::endl;

delete[] handles;
}
Expand Down
1 change: 1 addition & 0 deletions benchmarks/pool_allocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ void benchmark_linux_scalability()
std::cout << "Linux Scalability:" << std::endl;
std::cout << "Time: " << (end - start) / 1e9 << " sec" << std::endl;
std::cout << "Throughput: " << 2 * N / ((end - start) / 1e9) << " ops/s" << std::endl;
std::cout << "Time per operation: " << (end - start) / (2 * N) << " ns" << std::endl;

delete[] handles;
delete[] buffer;
Expand Down

0 comments on commit d419a78

Please sign in to comment.