Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- namespace Maxx {
- namespace Utils {
- //--------------------------------------------------------------------
- class ProfileScope
- {
- public:
- //--------------------------------------------------------------------
- ProfileScope(const std::string& description)
- : startTime(SDL_GetTicks())
- , description(description)
- {
- }
- //--------------------------------------------------------------------
- ~ProfileScope()
- {
- Uint32 elapsedTime = SDL_GetTicks() - startTime;
- printf("PROFILE %d ms\t%s\n", elapsedTime, description.c_str());
- }
- //--------------------------------------------------------------------
- private:
- Uint32 startTime;
- std::string description;
- };
- } // Utils
- } // Maxx
- //--------------------------------------------------------------------
- #if defined(PROFILER_ON)
- #define PROFILE_SCOPE(str) Maxx::Utils::ProfileScope profileScoper(str);
- #undef PROFILER_ON
- #else
- #define PROFILE_SCOPE(str)
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement