From 32c7d8dc04bb2c5ba517aaa05fcd9881420ac7c2 Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen Date: Sat, 4 Jun 2016 22:01:27 +0300 Subject: testpat: use stopwatch --- libkms++util/testpat.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'libkms++util') diff --git a/libkms++util/testpat.cpp b/libkms++util/testpat.cpp index 7a15a35..6296b19 100644 --- a/libkms++util/testpat.cpp +++ b/libkms++util/testpat.cpp @@ -1,7 +1,6 @@ //#define DRAW_PERF_PRINT -#include #include #include #include @@ -9,6 +8,7 @@ #include #include #include +#include "stopwatch.h" #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) @@ -292,18 +292,15 @@ static void draw_test_pattern_impl(IMappedFramebuffer& fb) void draw_test_pattern(IMappedFramebuffer &fb) { #ifdef DRAW_PERF_PRINT - using namespace std::chrono; - - auto t1 = high_resolution_clock::now(); + Stopwatch sw; + sw.start(); #endif draw_test_pattern_impl(fb); #ifdef DRAW_PERF_PRINT - auto t2 = high_resolution_clock::now(); - auto time_span = duration_cast(t2 - t1); - - printf("draw took %u us\n", (unsigned)time_span.count()); + double us = sw.elapsed_us(); + printf("draw took %u us\n", (unsigned)us); #endif } -- cgit v1.2.3