/*---------------------------------------------------------------------------* Project: NintendoWare File: font_Stopwatch.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. 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. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #ifndef NW_FONT_STOPWATCH_H_ #define NW_FONT_STOPWATCH_H_ #if defined(_MSC_VER) && _MSC_VER >= 1500 #pragma once #endif #ifdef NW_PLATFORM_CTR // #define NW_FONT_PROFILE 1 #endif #if defined(NW_FONT_PROFILE) #include namespace nw { 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 nw #define NW_FONT_STOPWATCH_START(sw) (sw).Start() #define NW_FONT_STOPWATCH_STOP(sw) (sw).Stop() #define NW_FONT_COUNTUP(counter) (++(counter)) #else #define NW_FONT_STOPWATCH_START(sw) ((void)0) #define NW_FONT_STOPWATCH_STOP(sw) ((void)0) #define NW_FONT_COUNTUP(counter) ((void)0) #endif #endif // NW_FONT_STOPWATCH_H_