From 6d3bde52216020c59c7f1851d090bae1d1954f39 Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Fri, 18 Apr 2014 14:35:33 +0200 Subject: Added performance test of the nether fort generator. --- src/Generating/NetherFortGen.cpp | 34 ++++++++++++++++++++++++++++++++++ src/Generating/NetherFortGen.h | 1 + 2 files changed, 35 insertions(+) (limited to 'src') diff --git a/src/Generating/NetherFortGen.cpp b/src/Generating/NetherFortGen.cpp index 7dc702e3a..d90fdeb0a 100644 --- a/src/Generating/NetherFortGen.cpp +++ b/src/Generating/NetherFortGen.cpp @@ -70,6 +70,40 @@ public: +/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Performance test of the NetherFort generator: + +/* +#include "OSSupport/Timer.h" +static class cNetherFortPerfTest +{ +public: + cNetherFortPerfTest(void) + { + cTimer Timer; + long long StartTime = Timer.GetNowTime(); + + const int GridSize = 512; + const int MaxDepth = 12; + const int NumIterations = 100; + for (int i = 0; i < NumIterations; i++) + { + cNetherFortGen FortGen(i, GridSize, MaxDepth); + delete new cNetherFortGen::cNetherFort(FortGen, 0, 0, GridSize, MaxDepth, i); + } + + long long EndTime = Timer.GetNowTime(); + printf("%d forts took %lld msec (%f sec) to generate\n", NumIterations, EndTime - StartTime, ((double)(EndTime - StartTime)) / 1000); + exit(0); + } + +} g_PerfTest; +//*/ + + + + + /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // cNetherFortGen: diff --git a/src/Generating/NetherFortGen.h b/src/Generating/NetherFortGen.h index b82b6adf3..d51596b9e 100644 --- a/src/Generating/NetherFortGen.h +++ b/src/Generating/NetherFortGen.h @@ -26,6 +26,7 @@ public: virtual ~cNetherFortGen(); protected: + friend class cNetherFortPerfTest; // fwd: NetherFortGen.cpp class cNetherFort; // fwd: NetherFortGen.cpp typedef std::list cNetherForts; -- cgit v1.2.3