diff --git a/src/Profiler.cpp b/src/Profiler.cpp index dcede5b73..0afb8779f 100644 --- a/src/Profiler.cpp +++ b/src/Profiler.cpp @@ -101,11 +101,21 @@ void Profiler::printStatistics() { vector totalSorted(sections.size()); iota(totalSorted.begin(), totalSorted.end(), 0); + #ifndef CORRADE_GCC44_COMPATIBILITY sort(totalSorted.begin(), totalSorted.end(), [this](size_t i, size_t j){return totalData[i] > totalData[j];}); + #else + sort(totalSorted.begin(), totalSorted.end(), Compare(this)); + #endif Corrade::Utility::Debug() << "Statistics for last" << measureDuration << "frames:"; for(size_t i = 0; i != sections.size(); ++i) - Corrade::Utility::Debug() << ' ' << sections[totalSorted[i]] << chrono::microseconds(totalData[totalSorted[i]]).count()/frameCount << u8"µs"; + Corrade::Utility::Debug() << ' ' << sections[totalSorted[i]] + << chrono::microseconds(totalData[totalSorted[i]]).count()/frameCount + #ifndef CORRADE_GCC44_COMPATIBILITY + << u8"µs"; + #else + << "µs"; + #endif } } diff --git a/src/Profiler.h b/src/Profiler.h index 3be943bd6..f0a09fb05 100644 --- a/src/Profiler.h +++ b/src/Profiler.h @@ -24,6 +24,7 @@ #include #include +#include "magnumCompatibility.h" #include "magnumVisibility.h" namespace Magnum { @@ -190,6 +191,19 @@ class MAGNUM_EXPORT Profiler { void printStatistics(); private: + #if !defined(DOXYGEN_GENERATING_OUTPUT) && defined(CORRADE_GCC44_COMPATIBILITY) + struct Compare { + public: + inline Compare(const Profiler* p): p(p) {} + inline bool operator()(size_t i, size_t j) const { + return p->totalData[i] > p->totalData[j]; + } + + private: + const Profiler* p; + }; + #endif + void save(); bool enabled;