diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-04-26 21:56:58 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-04-26 21:56:58 +0300 |
commit | 129b19f69fbbdcd896150aa8faa7f20254169c0c (patch) | |
tree | dd15d89fa3d6422139a0ba41a22f6f4db3f8b5ee /src/test | |
parent | 5f5ea46910feefc212a98ea715b0d4b0d9d4bc23 (diff) | |
download | manaplus-129b19f69fbbdcd896150aa8faa7f20254169c0c.tar.gz manaplus-129b19f69fbbdcd896150aa8faa7f20254169c0c.tar.bz2 manaplus-129b19f69fbbdcd896150aa8faa7f20254169c0c.tar.xz manaplus-129b19f69fbbdcd896150aa8faa7f20254169c0c.zip |
Add to log draw backend name.
Add ability to get free video memory (fast openg with NVIDIA).
Add test with id 100 for long perfomance testing.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/testlauncher.cpp | 50 | ||||
-rw-r--r-- | src/test/testlauncher.h | 2 |
2 files changed, 52 insertions, 0 deletions
diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index d3caa8938..55273ab41 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -69,6 +69,8 @@ int TestLauncher::exec() return testRescale(); else if (mTest == "8" || mTest == "9" || mTest == "10") return testFps(); + else if (mTest == "100") + return testInternal(); return -1; } @@ -155,6 +157,54 @@ int TestLauncher::testFps() return 0; } +int TestLauncher::testInternal() +{ + timeval start; + timeval end; + + Wallpaper::loadWallpapers(); + Wallpaper::getWallpaper(800, 600); + Image *img[4]; + + img[0] = Theme::getImageFromTheme("graphics/sprites/manaplus_emotions.png"); + img[1] = Theme::getImageFromTheme("graphics/sprites/manaplus_emotions.png"); + img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_left.gif"); + img[3] = Theme::getImageFromTheme("graphics/sprites/arrow_right.gif"); + int idx = 0; + int mem = mainGraphics->getMemoryUsage(); + +// int cnt = 5; + int cnt = 5000; + + gettimeofday(&start, nullptr); + for (int k = 0; k < cnt; k ++) + { + for (int x = 0; x < 800; x += 20) + { + for (int y = 0; y < 600; y += 25) + { + mainGraphics->drawImage(img[idx], x, y); + mainGraphics->drawImage(img[idx], x + 1, y); + mainGraphics->drawImage(img[idx], x, y + 5); + + idx ++; + if (idx > 3) + idx = 0; + } + } + mainGraphics->updateScreen(); + } + + gettimeofday(&end, nullptr); + int tFps = calcFps(&start, &end, cnt); + file << mTest << std::endl; + file << tFps << std::endl; + file << mem << std::endl; + + sleep(1); + return 0; +} + int TestLauncher::calcFps(timeval *start, timeval *end, int calls) { long mtime; diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index b1031a9c1..1f86dc396 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -45,6 +45,8 @@ class TestLauncher int testFps(); + int testInternal(); + private: std::string mTest; |