/*---------------------------------------------------------------------------* Project: Horizon File: font_Stopwatch.h Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Revision: 25674 $ *---------------------------------------------------------------------------*/ #ifndef NN_FONT_FONT_STOPWATCH_H_ #define NN_FONT_FONT_STOPWATCH_H_ #ifdef NN_PLATFORM_CTR // #define NN_FONT_PROFILE 1 #endif #if defined(NN_FONT_PROFILE) #include namespace nn { namespace font { class Stopwatch { public: void Start() { NN_ASSERT(! IsRunning()); using namespace nn::os; m_StartTick = Tick::GetSystemCurrent(); } void Stop() { NN_ASSERT(IsRunning()); using namespace nn::os; using namespace nn::fnd; m_TotalTick += Tick::GetSystemCurrent() - m_StartTick; m_StartTick = nn::os::Tick(); } void Reset() { m_TotalTick = nn::os::Tick(); } nn::fnd::TimeSpan GetElapsedTime() const { return m_TotalTick; } bool IsRunning() const { return m_StartTick != nn::os::Tick(); } private: nn::os::Tick m_StartTick; nn::os::Tick m_TotalTick; }; } // namespace font } // namespace nn #define NN_FONT_STOPWATCH_START(sw) (sw).Start() #define NN_FONT_STOPWATCH_STOP(sw) (sw).Stop() #define NN_FONT_COUNTUP(counter) (++(counter)) #else #define NN_FONT_STOPWATCH_START(sw) ((void)0) #define NN_FONT_STOPWATCH_STOP(sw) ((void)0) #define NN_FONT_COUNTUP(counter) ((void)0) #endif #endif // NN_FONT_FONT_STOPWATCH_H_