mirror of
https://github.com/NVIDIA/nvbench.git
synced 2026-04-20 14:58:54 +00:00
Add cpu_timer.
This commit is contained in:
@@ -2,6 +2,7 @@ set(test_srcs
|
||||
axes_metadata.cu
|
||||
benchmark.cu
|
||||
cuda_timer.cu
|
||||
cpu_timer.cu
|
||||
float64_axis.cu
|
||||
int64_axis.cu
|
||||
params.cu
|
||||
|
||||
22
testing/cpu_timer.cu
Normal file
22
testing/cpu_timer.cu
Normal file
@@ -0,0 +1,22 @@
|
||||
#include <nvbench/cpu_timer.cuh>
|
||||
|
||||
#include "test_asserts.cuh"
|
||||
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
void test_basic()
|
||||
{
|
||||
using namespace std::literals::chrono_literals;
|
||||
|
||||
nvbench::cpu_timer timer;
|
||||
|
||||
timer.start();
|
||||
std::this_thread::sleep_for(250ms);
|
||||
timer.stop();
|
||||
|
||||
ASSERT(timer.get_duration() > 0.25);
|
||||
ASSERT(timer.get_duration() < 0.50);
|
||||
}
|
||||
|
||||
int main() { test_basic(); }
|
||||
Reference in New Issue
Block a user