/*---------------------------------------------------------------------------* Project: NintendoWare File: demo_DebugUtility.cpp 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: 18943 $ *---------------------------------------------------------------------------*/ #include #include #include #include #include namespace nw { namespace demo { size_t DebugUtility::s_DeviceMemoryFreeSize; size_t DebugUtility::s_ParticleMemoryFreeSize; bool DebugUtility::s_IsForceCpuProfilingMode = false; bool DebugUtility::s_SilentMode = false; int DebugUtility::s_ProfileCallCount = 0; static s32 s_RefreshMeterCount = 0; static bool s_LastCpuCountingMode = false; //---------------------------------------- void DebugUtility::DrawLoadMeter( nw::demo::RenderSystem* renderSystem, nw::demo::GraphicsDrawing* graphicsDrawing, bool refreshMeter ) { NW_POINTER_ASSERT(renderSystem); NW_POINTER_ASSERT(graphicsDrawing); if (nw::demo::DebugUtility::IsCpuProfilingMode() != s_LastCpuCountingMode) { if (!s_SilentMode) { if (nw::demo::DebugUtility::IsCpuProfilingMode()) { NW_DEV_LOG("-------------------------------------------------------------------------------\n"); NW_DEV_LOG("| Entering CPU profiling mode. |\n"); NW_DEV_LOG("-------------------------------------------------------------------------------\n"); NW_DEV_LOG("Command list won't run.\n"); NW_DEV_LOG("Load meter will be output to log.\n"); NW_DEV_LOG("To leave profiling mode, turn DBG switch OFF.\n"); NW_DEV_LOG("\n"); } else { NW_DEV_LOG("-------------------------------------------------------------------------------\n"); NW_DEV_LOG("| Leaving CPU profiling mode. |\n"); NW_DEV_LOG("-------------------------------------------------------------------------------\n"); } } s_LastCpuCountingMode = nw::demo::DebugUtility::IsCpuProfilingMode(); } if (refreshMeter) { if (nw::demo::DebugUtility::IsCpuProfilingMode()) { if ( ++s_RefreshMeterCount > 2) { renderSystem->CalcLoadMeter(); if (!s_SilentMode) { renderSystem->LogLoadMeter(); NW_DEV_LOG("\n"); } s_RefreshMeterCount = 0; } } else { renderSystem->CalcLoadMeter(); } } renderSystem->DrawLoadMeter(*graphicsDrawing, 40, 158); } } // namespace demo } // namespace nw