From c70431d73da9c821cfedbd162c7d2447b7057459 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 8 Oct 2012 16:27:33 +0300 Subject: Add functions for future batch size detection. --- src/test/testlauncher.cpp | 10 ++++++++++ src/test/testlauncher.h | 2 ++ src/test/testmain.cpp | 34 ++++++++++++++++++++++++++++++++-- src/test/testmain.h | 5 ++++- 4 files changed, 48 insertions(+), 3 deletions(-) (limited to 'src/test') diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index c13f52ffb..4352957ef 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -67,6 +67,8 @@ int TestLauncher::exec() return testRescale(); else if (mTest == "8" || mTest == "9" || mTest == "10") return testFps(); + else if (mTest == "11") + return testBatches(); else if (mTest == "99") return testVideoDetection(); else if (mTest == "100") @@ -164,6 +166,14 @@ int TestLauncher::testFps() return 0; } +int TestLauncher::testBatches() +{ + int batches = 512; + + file << mTest << std::endl; + file << batches << std::endl; +} + int TestLauncher::testInternal() { timeval start; diff --git a/src/test/testlauncher.h b/src/test/testlauncher.h index da8534306..af5c53578 100644 --- a/src/test/testlauncher.h +++ b/src/test/testlauncher.h @@ -49,6 +49,8 @@ class TestLauncher int testVideoDetection(); + int testBatches(); + private: std::string mTest; diff --git a/src/test/testmain.cpp b/src/test/testmain.cpp index 61c08f442..94914c41b 100644 --- a/src/test/testmain.cpp +++ b/src/test/testmain.cpp @@ -182,16 +182,30 @@ int TestMain::exec(const bool testAudio) maxFps = safeOpenGLFps; } + int batchSize = 256; +/* + // if OpenGL mode is fast mode we can try detect max batch sizes + if (openGLMode == 1) + { + if (!invokeFastOpenBatchTest("11")) + batchSize = readValue2(11); + if (batchSize < 256) + batchSize = 256; + } +*/ + // if OpenGL implimentation is not good, disable it. if (!detectMode) openGLMode = 0; - writeConfig(openGLMode, rescaleTest[openGLMode], soundTest, info); + writeConfig(openGLMode, rescaleTest[openGLMode], + soundTest, info, batchSize); return 0; } void TestMain::writeConfig(const int openGLMode, const int rescale, - const int sound, const std::string &info) + const int sound, const std::string &info, + const int batchSize) { mConfig.init(Client::getConfigDirectory() + "/config.xml"); @@ -209,6 +223,9 @@ void TestMain::writeConfig(const int openGLMode, const int rescale, mConfig.setValue("safemode", false); mConfig.setValue("enableMapReduce", true); + // max batch size +// mConfig.setValue("batchsize", batchSize); + // stats mConfig.setValue("testInfo", info); @@ -285,6 +302,19 @@ int TestMain::invokeFastOpenGLRenderTest(std::string test) #endif } +int TestMain::invokeFastOpenBatchTest(std::string test) +{ +#if defined USE_OPENGL + mConfig.setValue("opengl", 1); + mConfig.write(); + const int ret = execFileWait(fileName, fileName, "-t", test, 30); +// log->log("%s: %d", test.c_str(), ret); + return ret; +#else + return -1; +#endif +} + int TestMain::invokeSafeOpenGLRenderTest(std::string test) { #if defined USE_OPENGL diff --git a/src/test/testmain.h b/src/test/testmain.h index ddb10c7c4..3b3b3fbe0 100644 --- a/src/test/testmain.h +++ b/src/test/testmain.h @@ -53,12 +53,15 @@ class TestMain int invokeFastOpenGLRenderTest(std::string test); + int invokeFastOpenBatchTest(std::string test); + int invokeSafeOpenGLRenderTest(std::string test); void testsMain(); void writeConfig(const int openGLMode, const int rescale, - const int sound, const std::string &info); + const int sound, const std::string &info, + const int batchSize); int readValue2(const int ver); -- cgit v1.2.3-60-g2f50