summaryrefslogtreecommitdiff
path: root/src/test/testlauncher.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-12-22 18:16:25 +0300
committerAndrei Karas <akaras@inbox.ru>2016-12-22 18:18:35 +0300
commit19aec4ec37cffa2b3f7ab84165728dfcceac008e (patch)
tree949380d0fc10d51a14c435e9cc23fd208788ad62 /src/test/testlauncher.cpp
parent9cf97ab28310a58b195e4daa85a24775df7c9c00 (diff)
downloadplus-19aec4ec37cffa2b3f7ab84165728dfcceac008e.tar.gz
plus-19aec4ec37cffa2b3f7ab84165728dfcceac008e.tar.bz2
plus-19aec4ec37cffa2b3f7ab84165728dfcceac008e.tar.xz
plus-19aec4ec37cffa2b3f7ab84165728dfcceac008e.zip
Add speed test for dye A software function.
Diffstat (limited to 'src/test/testlauncher.cpp')
-rw-r--r--src/test/testlauncher.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp
index eacbcbc6e..313986c8c 100644
--- a/src/test/testlauncher.cpp
+++ b/src/test/testlauncher.cpp
@@ -102,9 +102,11 @@ int TestLauncher::exec()
else if (mTest == "104")
return testFps3();
else if (mTest == "105")
- return testDyeSpeed();
+ return testDyeSSpeed();
else if (mTest == "106")
return testStackSpeed();
+ else if (mTest == "107")
+ return testDyeASpeed();
return -1;
}
@@ -477,7 +479,7 @@ int TestLauncher::testDye()
return 0;
}
-int TestLauncher::testDyeSpeed()
+int TestLauncher::testDyeSSpeed()
{
#if defined __linux__ || defined __linux
const int sz = 100000;
@@ -502,7 +504,39 @@ int TestLauncher::testDyeSpeed()
+ static_cast<long int>(time2.tv_nsec)) / 1) -
((static_cast<long int>(time1.tv_sec) * 1000000000L
+ static_cast<long int>(time1.tv_nsec)) / 1);
- printf("salt: %u\n", buf[0]);
+ printf("dye s salt: %u\n", buf[0]);
+ printf("time: %ld\n", diff);
+#endif // defined __linux__ || defined __linux
+
+ return 0;
+}
+
+int TestLauncher::testDyeASpeed()
+{
+#if defined __linux__ || defined __linux
+ const int sz = 100000;
+ uint32_t buf[sz];
+ timespec time1;
+ timespec time2;
+
+ DyePalette pal("#0000ffff,00000000,000020ff,70605040", 8);
+
+ for (int f = 0; f < sz; f ++)
+ buf[f] = f;
+
+ pal.replaceAColor(buf, sz);
+
+ clock_gettime(CLOCK_MONOTONIC, &time1);
+
+ for (int f = 0; f < 50000; f ++)
+ pal.replaceSColor(buf, sz);
+
+ clock_gettime(CLOCK_MONOTONIC, &time2);
+ long diff = ((static_cast<long int>(time2.tv_sec) * 1000000000L
+ + static_cast<long int>(time2.tv_nsec)) / 1) -
+ ((static_cast<long int>(time1.tv_sec) * 1000000000L
+ + static_cast<long int>(time1.tv_nsec)) / 1);
+ printf("dye a salt: %u\n", buf[0]);
printf("time: %ld\n", diff);
#endif // defined __linux__ || defined __linux