testpat: use stopwatch
authorTomi Valkeinen <tomi.valkeinen@ti.com>
Sat, 4 Jun 2016 19:01:27 +0000 (22:01 +0300)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Sat, 4 Jun 2016 19:33:53 +0000 (22:33 +0300)
libkms++util/testpat.cpp

index 7a15a35567f1608f8df8bb801ec8d5330c9c00d8..6296b1925156c363d6b1335c61d45d3a0707aafd 100644 (file)
@@ -1,7 +1,6 @@
 
 //#define DRAW_PERF_PRINT
 
 
 //#define DRAW_PERF_PRINT
 
-#include <chrono>
 #include <cstring>
 #include <cassert>
 #include <thread>
 #include <cstring>
 #include <cassert>
 #include <thread>
@@ -9,6 +8,7 @@
 #include <kms++.h>
 #include <kms++util.h>
 #include <cpuframebuffer.h>
 #include <kms++.h>
 #include <kms++util.h>
 #include <cpuframebuffer.h>
+#include "stopwatch.h"
 
 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
 
 
 #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
 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
 #endif
 
        draw_test_pattern_impl(fb);
 
 #ifdef DRAW_PERF_PRINT
-       auto t2 = high_resolution_clock::now();
-       auto time_span = duration_cast<microseconds>(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
 }
 
 #endif
 }