summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-24 02:10:19 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-24 02:10:37 +0300
commit4e6c08b939fbfb1cd4a8a5653bd16d285b55150c (patch)
treea475b8663601782b0675a37f8e18dfb317e2294f
parenta19aa379785b1be41d58daa693418ccaa9711edc (diff)
downloadplus-4e6c08b939fbfb1cd4a8a5653bd16d285b55150c.tar.gz
plus-4e6c08b939fbfb1cd4a8a5653bd16d285b55150c.tar.bz2
plus-4e6c08b939fbfb1cd4a8a5653bd16d285b55150c.tar.xz
plus-4e6c08b939fbfb1cd4a8a5653bd16d285b55150c.zip
Update test for dye speed.
-rw-r--r--src/test/testlauncher.cpp25
-rw-r--r--src/test/testlauncher.h3
2 files changed, 10 insertions, 18 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index 7b47963b2..74447af7e 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -460,22 +460,25 @@ int TestLauncher::testDye()
int TestLauncher::testDyeSpeed()
{
- timeval start;
- timeval end;
- const int sz = 10000;
+ const int sz = 100000;
uint32_t buf[sz];
+ timespec time1;
+ timespec time2;
DyePalette pal("#0000ff,000000,000020,706050", 6);
for (int f = 0; f < sz; f ++)
buf[f] = f;
- gettimeofday(&start, nullptr);
+ clock_gettime(CLOCK_MONOTONIC, &time1);
- pal.replaceSColor(buf, sz);
+ for (int f = 0; f < 1000; f ++)
+ pal.replaceSColor(buf, sz);
- gettimeofday(&end, nullptr);
- printf("time: %f\n", calcTime(&start, &end));
+ clock_gettime(CLOCK_MONOTONIC, &time2);
+ long diff = ((static_cast<long long int>(time2.tv_sec) * 1000000000LL + static_cast<long long int>(time2.tv_nsec)) / 1) -
+ ((static_cast<long long int>(time1.tv_sec) * 1000000000LL + static_cast<long long int>(time1.tv_nsec)) / 1);
+ printf("time: %ld\n", diff);
return 0;
}
@@ -576,12 +579,4 @@ int TestLauncher::calcFps(const timeval *const start, const timeval *const end,
return static_cast<int>(static_cast<long>(calls) * 10000 / mtime);
}
-float TestLauncher::calcTime(const timeval *const start,
- const timeval *const end) const
-{
- const long seconds = end->tv_sec - start->tv_sec;
- const long useconds = end->tv_usec - start->tv_usec;
-
- return (seconds * 1000 + useconds / 1000.0);
-}
#endif
diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h
index 25406aa14..abb84483b 100644
--- a/src/test/testlauncher.h
+++ b/src/test/testlauncher.h
@@ -72,9 +72,6 @@ class TestLauncher final
int testDyeSpeed();
- float calcTime(const timeval *const start,
- const timeval *const end) const;
-
private:
std::string mTest;