From d2fbfdbf227a270ac16ae4ec117c81e55f12eaa5 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Fri, 12 Jun 2020 21:50:05 +0200 Subject: [PATCH] Remove unused globebrowsing instrumentation --- ext/ghoul | 2 +- modules/globebrowsing/CMakeLists.txt | 5 -- modules/globebrowsing/globebrowsingmodule.cpp | 82 ------------------- modules/globebrowsing/globebrowsingmodule.h | 25 ------ modules/globebrowsing/src/renderableglobe.cpp | 24 ------ modules/globebrowsing/src/renderableglobe.h | 4 - 6 files changed, 1 insertion(+), 141 deletions(-) diff --git a/ext/ghoul b/ext/ghoul index 767fa3e42e..a634fc1515 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit 767fa3e42e1831ade7deb5b4b099c2c5a823c9f9 +Subproject commit a634fc15154ee51462e379917299fbe546c9fd1d diff --git a/modules/globebrowsing/CMakeLists.txt b/modules/globebrowsing/CMakeLists.txt index ec5c7f389c..70834fe46a 100644 --- a/modules/globebrowsing/CMakeLists.txt +++ b/modules/globebrowsing/CMakeLists.txt @@ -117,11 +117,6 @@ create_new_module( ${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES} ) -option(OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION "Instrumentation for GlobeBrowsing Performance" OFF) -if (OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION) - target_compile_definitions(openspace-module-globebrowsing INTERFACE "OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION") -endif () - install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/gdal_data DESTINATION modules/globebrowsing) if (WIN32) diff --git a/modules/globebrowsing/globebrowsingmodule.cpp b/modules/globebrowsing/globebrowsingmodule.cpp index b7cea3cb2d..7314da9eff 100644 --- a/modules/globebrowsing/globebrowsingmodule.cpp +++ b/modules/globebrowsing/globebrowsingmodule.cpp @@ -106,14 +106,6 @@ namespace { "The maximum size of the MemoryAwareTileCache, on the CPU and GPU." }; -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - constexpr const openspace::properties::Property::PropertyInfo InstrumentationInfo = { - "SaveInstrumentationInfo", - "Save Instrumentation Info", - "If enabled, the instrumentation data is saved to disk at the end of the frame." - }; -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - openspace::GlobeBrowsingModule::Capabilities parseSubDatasets(char** subDatasets, int nSubdatasets) @@ -176,24 +168,12 @@ GlobeBrowsingModule::GlobeBrowsingModule() , _wmsCacheLocation(WMSCacheLocationInfo, "${BASE}/cache_gdal") , _wmsCacheSizeMB(WMSCacheSizeInfo, 1024) , _tileCacheSizeMB(TileCacheSizeInfo, 1024) -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - , _saveInstrumentation(InstrumentationInfo, false) -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION { addProperty(_wmsCacheEnabled); addProperty(_offlineMode); addProperty(_wmsCacheLocation); addProperty(_wmsCacheSizeMB); addProperty(_tileCacheSizeMB); - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _saveInstrumentation.onChange([&]() { - if (_saveInstrumentation) { - _frameInfo.lastSavedFrame = global::renderEngine.frameNumber(); - } - }); - addProperty(_saveInstrumentation); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION } void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { @@ -268,45 +248,6 @@ void GlobeBrowsingModule::internalInitialize(const ghoul::Dictionary& dict) { _tileCache->update(); }); - // Postdraw -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - global::callback::postDraw.emplace_back([&]() { - ZoneScopedN("GlobeBrowsingModule") - - // >= as we might have multiple frames per postDraw call (stereo rendering, - // fisheye, etc) - const uint16_t next = _frameInfo.lastSavedFrame + _frameInfo.saveEveryNthFrame; - const bool shouldSave = _saveInstrumentation && - global::renderEngine.frameNumber() >= next; - if (shouldSave) { - using K = const globebrowsing::RenderableGlobe*; - using V = std::vector; - for (const std::pair& i : _frameInfo.frames) { - std::string filename = fmt::format( - "_inst_globebrowsing_{}_{}_{}.txt", - i.first->owner()->identifier(), // Owner of the renderable has a name - _frameInfo.lastSavedFrame, - _frameInfo.saveEveryNthFrame - ); - std::ofstream file(absPath("${BIN}/" + filename)); - for (const FrameInfo& f : i.second) { - std::string line = fmt::format( - "{}\t{}\t{}\t{}", - f.iFrame, - f.nTilesRenderedLocal, - f.nTilesRenderedGlobal, - f.nTilesUploaded - ); - file << line << '\n'; - } - } - - _frameInfo.frames.clear(); - _frameInfo.lastSavedFrame = global::renderEngine.frameNumber(); - } - }); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - // Deinitialize global::callback::deinitialize.emplace_back([&]() { ZoneScopedN("GlobeBrowsingModule") @@ -834,27 +775,4 @@ uint64_t GlobeBrowsingModule::wmsCacheSize() const { return size * 1024 * 1024; } -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION -void GlobeBrowsingModule::addFrameInfo(globebrowsing::RenderableGlobe* globe, - uint32_t nTilesRenderedLocal, - uint32_t nTilesRenderedGlobal, - uint32_t nTilesUploaded) -{ - auto it = _frameInfo.frames.find(globe); - if (it == _frameInfo.frames.end()) { - _frameInfo.frames[globe] = std::vector(); - _frameInfo.frames[globe].reserve(_frameInfo.saveEveryNthFrame); - } - else { - it->second.push_back({ - global::renderEngine.frameNumber(), - nTilesRenderedLocal, - nTilesRenderedGlobal, - nTilesUploaded - }); - } -} - -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - } // namespace openspace diff --git a/modules/globebrowsing/globebrowsingmodule.h b/modules/globebrowsing/globebrowsingmodule.h index e6af83d999..cf3612ca66 100644 --- a/modules/globebrowsing/globebrowsingmodule.h +++ b/modules/globebrowsing/globebrowsingmodule.h @@ -95,11 +95,6 @@ public: std::string wmsCacheLocation() const; uint64_t wmsCacheSize() const; // bytes -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - void addFrameInfo(globebrowsing::RenderableGlobe* globe, uint32_t nTilesRenderedLocal, - uint32_t nTilesRenderedGlobal, uint32_t nTilesUploaded); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - protected: void internalInitialize(const ghoul::Dictionary&) override; @@ -141,26 +136,6 @@ private: std::map _capabilitiesMap; std::multimap _urlList; - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - struct FrameInfo { - uint64_t iFrame = 0; - uint32_t nTilesRenderedLocal = 0; - uint32_t nTilesRenderedGlobal = 0; - uint32_t nTilesUploaded = 0; - }; - - struct { - std::unordered_map< - globebrowsing::RenderableGlobe*, - std::vector - > frames; - - uint64_t lastSavedFrame = 0; - const uint16_t saveEveryNthFrame = 2048; - } _frameInfo; - properties::BoolProperty _saveInstrumentation; -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION }; } // namespace openspace diff --git a/modules/globebrowsing/src/renderableglobe.cpp b/modules/globebrowsing/src/renderableglobe.cpp index b883b6acfb..6109087b54 100644 --- a/modules/globebrowsing/src/renderableglobe.cpp +++ b/modules/globebrowsing/src/renderableglobe.cpp @@ -50,13 +50,6 @@ #include #include -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION -#include -#include -openspace::GlobeBrowsingModule* _module = nullptr; - -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - namespace { // Global flags to modify the RenderableGlobe constexpr const bool LimitLevelByAvailableData = true; @@ -709,10 +702,6 @@ RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary) _generalProperties.shadowMapping = true; } _generalProperties.shadowMapping.onChange(notifyShaderRecompilation); - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _module = global::moduleEngine.module(); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION } void RenderableGlobe::initializeGL() { @@ -921,11 +910,7 @@ void RenderableGlobe::update(const UpdateData& data) { _shadowComponent.update(data); } -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _nUploadedTiles = _layerManager.update(); -#else _layerManager.update(); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION if (_nLayersIsDirty) { std::array lgs = @@ -1237,15 +1222,6 @@ void RenderableGlobe::renderChunks(const RenderData& data, RendererTasks&, } _localRenderer.program->deactivate(); -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - _module->addFrameInfo( - this, - std::min(localCount, ChunkBufferSize), - std::min(globalCount, ChunkBufferSize), - _nUploadedTiles - ); -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - if (_debugProperties.showChunkBounds || _debugProperties.showChunkAABB) { for (int i = 0; i < std::min(globalCount, ChunkBufferSize); ++i) { debugRenderChunk( diff --git a/modules/globebrowsing/src/renderableglobe.h b/modules/globebrowsing/src/renderableglobe.h index ab4045d893..59f2c51b38 100644 --- a/modules/globebrowsing/src/renderableglobe.h +++ b/modules/globebrowsing/src/renderableglobe.h @@ -297,10 +297,6 @@ private: // Labels GlobeLabelsComponent _globeLabelsComponent; ghoul::Dictionary _labelsDictionary; - -#ifdef OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION - int _nUploadedTiles = 0; -#endif // OPENSPACE_MODULE_GLOBEBROWSING_INSTRUMENTATION }; } // namespace openspace::globebrowsing