From 8687931a97791a67a2f880d51e00febc99958c21 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Mon, 22 Apr 2013 18:56:36 +0000 Subject: Added a (commented-out) performance test for cHeiGenBiomal and cCompoGenBiomal git-svn-id: http://mc-server.googlecode.com/svn/trunk@1401 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Generating/ComposableGenerator.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'source') diff --git a/source/Generating/ComposableGenerator.cpp b/source/Generating/ComposableGenerator.cpp index ce1e6ee8d..8219d67c0 100644 --- a/source/Generating/ComposableGenerator.cpp +++ b/source/Generating/ComposableGenerator.cpp @@ -226,6 +226,19 @@ void cComposableGenerator::InitHeightGen(cIniFile & a_IniFile) LOGWARN("Unknown HeightGen \"%s\", using \"Biomal\" instead.", HeightGenName.c_str()); } m_HeightGen = new cHeiGenBiomal(Seed, *m_BiomeGen); + + /* + // Performance-testing: + LOGINFO("Measuring performance of cHeiGenBiomal..."); + clock_t BeginTick = clock(); + for (int x = 0; x < 500; x++) + { + cChunkDef::HeightMap Heights; + m_HeightGen->GenHeightMap(x * 5, x * 5, Heights); + } + clock_t Duration = clock() - BeginTick; + LOGINFO("HeightGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); + //*/ } // Add a cache, if requested: @@ -295,6 +308,21 @@ void cComposableGenerator::InitCompositionGen(cIniFile & a_IniFile) int SeaLevel = a_IniFile.GetValueSetI("Generator", "BiomalSeaLevel", 62); int Seed = m_ChunkGenerator.GetSeed(); m_CompositionGen = new cCompoGenBiomal(Seed, SeaLevel); + + /* + // Performance-testing: + LOGINFO("Measuring performance of cCompoGenBiomal..."); + clock_t BeginTick = clock(); + for (int x = 0; x < 500; x++) + { + cChunkDesc Desc(200 + x * 8, 200 + x * 8); + m_BiomeGen->GenBiomes(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetBiomeMap()); + m_HeightGen->GenHeightMap(Desc.GetChunkX(), Desc.GetChunkZ(), Desc.GetHeightMap()); + m_CompositionGen->ComposeTerrain(Desc); + } + clock_t Duration = clock() - BeginTick; + LOGINFO("CompositionGen for 500 chunks took %d ticks (%.02f sec)", Duration, (double)Duration / CLOCKS_PER_SEC); + //*/ } } -- cgit v1.2.3