Add cpu_timer.

This commit is contained in:
Allison Vacanti
2020-12-29 23:51:09 -05:00
parent b07ffafff4
commit 8c0b8e3423
3 changed files with 58 additions and 0 deletions

View File

@@ -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
View 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(); }