summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-10-08 16:27:33 +0300
committerAndrei Karas <akaras@inbox.ru>2012-10-08 16:27:33 +0300
commitc70431d73da9c821cfedbd162c7d2447b7057459 (patch)
treeb6c1ea809a790415e26edad92d9283977ad72a48
parent0c2def29e3bf56a686305ba7385de45214ec86a4 (diff)
downloadmanaverse-c70431d73da9c821cfedbd162c7d2447b7057459.tar.gz
manaverse-c70431d73da9c821cfedbd162c7d2447b7057459.tar.bz2
manaverse-c70431d73da9c821cfedbd162c7d2447b7057459.tar.xz
manaverse-c70431d73da9c821cfedbd162c7d2447b7057459.zip
Add functions for future batch size detection.
-rw-r--r--src/test/testlauncher.cpp10
-rw-r--r--src/test/testlauncher.h2
-rw-r--r--src/test/testmain.cpp34
-rw-r--r--src/test/testmain.h5
4 files changed, 48 insertions, 3 deletions
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);