diff --git a/src/Magnum/DebugTools/Profiler.cpp b/src/Magnum/DebugTools/Profiler.cpp index 168b2f4fe..2969fe81f 100644 --- a/src/Magnum/DebugTools/Profiler.cpp +++ b/src/Magnum/DebugTools/Profiler.cpp @@ -39,11 +39,14 @@ using namespace std::chrono; namespace Magnum { namespace DebugTools { +/* MSVC complains about deprecated Section here */ +CORRADE_IGNORE_DEPRECATED_PUSH Profiler::Section Profiler::addSection(const std::string& name) { CORRADE_ASSERT(!_enabled, "Profiler: cannot add section when profiling is enabled", 0); _sections.push_back(name); return _sections.size()-1; } +CORRADE_IGNORE_DEPRECATED_POP void Profiler::setMeasureDuration(std::size_t frames) { CORRADE_ASSERT(!_enabled, "Profiler: cannot set measure duration when profiling is enabled", ); @@ -61,6 +64,8 @@ void Profiler::disable() { _enabled = false; } +/* MSVC complains about deprecated Section here */ +CORRADE_IGNORE_DEPRECATED_PUSH void Profiler::start(Section section) { if(!_enabled) return; CORRADE_ASSERT(section < _sections.size(), "Profiler: unknown section passed to start()", ); @@ -69,6 +74,7 @@ void Profiler::start(Section section) { _currentSection = section; } +CORRADE_IGNORE_DEPRECATED_POP void Profiler::stop() { if(!_enabled) return; @@ -117,7 +123,10 @@ void Profiler::printStatistics() { std::vector totalSorted(_sections.size()); std::iota(totalSorted.begin(), totalSorted.end(), 0); + /* MSVC complains about deprecated _totalData here (WTF) */ + CORRADE_IGNORE_DEPRECATED_PUSH std::sort(totalSorted.begin(), totalSorted.end(), [this](std::size_t i, std::size_t j){return _totalData[i] > _totalData[j];}); + CORRADE_IGNORE_DEPRECATED_POP Debug() << "Statistics for last" << _measureDuration << "frames:"; for(std::size_t i = 0; i != _sections.size(); ++i) diff --git a/src/Magnum/DebugTools/Profiler.h b/src/Magnum/DebugTools/Profiler.h index 0e2b387c1..1f19fd297 100644 --- a/src/Magnum/DebugTools/Profiler.h +++ b/src/Magnum/DebugTools/Profiler.h @@ -126,9 +126,15 @@ class CORRADE_DEPRECATED("use FrameProfiler instead") MAGNUM_DEBUGTOOLS_EXPORT P * * @see @ref start() */ + /* MSVC complains about deprecated Section here */ + CORRADE_IGNORE_DEPRECATED_PUSH static const Section otherSection = 0; + CORRADE_IGNORE_DEPRECATED_POP + /* MSVC complains about deprecated Section here */ + CORRADE_IGNORE_DEPRECATED_PUSH explicit Profiler(): _enabled(false), _measureDuration(60), _currentFrame(0), _frameCount(0), _sections{"Other"}, _currentSection(otherSection) {} + CORRADE_IGNORE_DEPRECATED_POP /** * @brief Set measure duration @@ -145,7 +151,10 @@ class CORRADE_DEPRECATED("use FrameProfiler instead") MAGNUM_DEBUGTOOLS_EXPORT P * @attention This function cannot be called if profiling is enabled. * @see @ref otherSection, @ref start(Section), @ref stop() */ + /* MSVC complains about deprecated Section here */ + CORRADE_IGNORE_DEPRECATED_PUSH Section addSection(const std::string& name); + CORRADE_IGNORE_DEPRECATED_POP /** * @brief Whether profiling is enabled @@ -177,7 +186,10 @@ class CORRADE_DEPRECATED("use FrameProfiler instead") MAGNUM_DEBUGTOOLS_EXPORT P * section. * @see @ref otherSection, @ref start(Section) */ + /* MSVC complains about deprecated Section here */ + CORRADE_IGNORE_DEPRECATED_PUSH void start(Section section); + CORRADE_IGNORE_DEPRECATED_POP /** * @brief Start profiling of "other" section @@ -185,7 +197,12 @@ class CORRADE_DEPRECATED("use FrameProfiler instead") MAGNUM_DEBUGTOOLS_EXPORT P * Same as calling @cpp start(DebugTools::Profiler::otherSection) @ce. * @note Does nothing if profiling is disabled. */ - void start() { start(otherSection); } + void start() { + /* MSVC complains about deprecated Section here */ + CORRADE_IGNORE_DEPRECATED_PUSH + start(otherSection); + CORRADE_IGNORE_DEPRECATED_POP + } /** * @brief Stop profiling