diff --git a/modules/globebrowsing/chunk/chunkedlodglobe.cpp b/modules/globebrowsing/chunk/chunkedlodglobe.cpp index e38edca3b1..37f6203340 100644 --- a/modules/globebrowsing/chunk/chunkedlodglobe.cpp +++ b/modules/globebrowsing/chunk/chunkedlodglobe.cpp @@ -43,6 +43,8 @@ #define _USE_MATH_DEFINES #include +#include + namespace { const std::string _loggerCat = "ChunkLodGlobe"; } @@ -66,6 +68,7 @@ namespace openspace { , maxSplitDepth(22) , _savedCamera(nullptr) , _tileProviderManager(tileProviderManager) + , stats(StatsCollector(absPath("test_stats"))) { auto geometry = std::make_shared( @@ -84,6 +87,7 @@ namespace openspace { _chunkEvaluatorByDistance = std::make_unique(); _renderer = std::make_unique(geometry, tileProviderManager); + } ChunkedLodGlobe::~ChunkedLodGlobe() { @@ -146,9 +150,23 @@ namespace openspace { desiredLevel = glm::clamp(desiredLevel, minSplitDepth, maxSplitDepth); return desiredLevel; } - void ChunkedLodGlobe::render(const RenderData& data){ + + stats.startNewRecord(); + + + int j2000s = Time::now().unsyncedJ2000Seconds(); + int lastJ2000s = stats.i.previous("time"); + if (j2000s == lastJ2000s) { + stats.disable(); + } + else { + stats.enable(); + } + + stats.i["time"] = j2000s; + minDistToCamera = INFINITY; _leftRoot->updateChunkTree(data); @@ -162,10 +180,16 @@ namespace openspace { // Render function std::function renderJob = [this, &data, &mvp](const ChunkNode& chunkNode) { + stats.i["chunks"]++; const Chunk& chunk = chunkNode.getChunk(); - if (chunkNode.isLeaf() && chunk.isVisible()) { - _renderer->renderChunk(chunkNode.getChunk(), data); - debugRenderChunk(chunk, mvp); + if (chunkNode.isLeaf()){ + stats.i["chunks leafs"]++; + if (chunk.isVisible()) { + stats.i["rendered chunks"]++; + double t0 = Time::now().unsyncedJ2000Seconds(); + _renderer->renderChunk(chunkNode.getChunk(), data); + debugRenderChunk(chunk, mvp); + } } }; diff --git a/modules/globebrowsing/chunk/chunkedlodglobe.h b/modules/globebrowsing/chunk/chunkedlodglobe.h index e781c516c9..56e8d2e39c 100644 --- a/modules/globebrowsing/chunk/chunkedlodglobe.h +++ b/modules/globebrowsing/chunk/chunkedlodglobe.h @@ -117,6 +117,7 @@ namespace openspace { bool levelByProjAreaElseDistance = true; } debugOptions; + StatsCollector stats; private: @@ -149,8 +150,6 @@ namespace openspace { std::shared_ptr _tileProviderManager; - //std::shared_ptr> _stats; - //StatsTracker stats; }; } // namespace openspace diff --git a/monitor/index.html b/monitor/index.html new file mode 100644 index 0000000000..e5c69edb16 --- /dev/null +++ b/monitor/index.html @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/monitor/style.css b/monitor/style.css new file mode 100644 index 0000000000..ebf2021fb5 --- /dev/null +++ b/monitor/style.css @@ -0,0 +1,20 @@ +body { + font: 10px sans-serif; +} + +.axis path, +.axis line { + fill: none; + stroke: #000; + shape-rendering: crispEdges; +} + +.x.axis path { + display: none; +} + +.line { + fill: none; + stroke: steelblue; + stroke-width: 1.5px; +}