add debug timer macro.

This commit is contained in:
hecomi
2017-01-07 01:15:33 +09:00
parent b0877a49ed
commit c251de3a30
2 changed files with 20 additions and 1 deletions
@@ -1,10 +1,18 @@
#pragma once
#include <time.h>
#include <fstream>
#include <sstream>
#include <mutex>
#include "Common.h"
#include "IUnityInterface.h"
// Debug flag
#define UDD_DEBUG_ON
// Logging
class Debug
{
@@ -133,4 +141,15 @@ private:
static DebugLogFuncPtr logFunc_;
static DebugLogFuncPtr errFunc_;
static std::mutex mutex_;
};
};
#ifdef UDD_DEBUG_ON
#define UDD_FUNCTION_SCOPE_TIMER \
ScopedTimer _timer_##__COUNTER__([](std::chrono::microseconds us) \
{ \
Debug::Log(__FUNCTION__, "@", __FILE__, ":", __LINE__, " => ", us.count(), " (us)"); \
});
#else
#define UDD_FUNCTION_SCOPE_TIMER
#endif