From a43428253b48b724231767f7356e9e1b1fea854d Mon Sep 17 00:00:00 2001 From: hrydgard Date: Thu, 21 Jan 2010 21:27:52 +0000 Subject: [PATCH] Kill the last timeGetTime calls. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4921 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/Common/Src/OpenCL.cpp | 8 ++++---- Source/Core/Common/Src/Timer.cpp | 2 +- Source/Core/VideoCommon/Src/OnScreenDisplay.cpp | 4 ++-- Source/Core/VideoCommon/Src/Profiler.cpp | 2 +- Source/Plugins/Plugin_VideoDX9/Src/Render.cpp | 5 +++-- .../Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp | 12 ++++++------ Source/Plugins/Plugin_VideoOGL/Src/Render.cpp | 8 ++++---- 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/Source/Core/Common/Src/OpenCL.cpp b/Source/Core/Common/Src/OpenCL.cpp index 7eaa44355f..44ae1e8a53 100644 --- a/Source/Core/Common/Src/OpenCL.cpp +++ b/Source/Core/Common/Src/OpenCL.cpp @@ -132,7 +132,7 @@ cl_command_queue GetCommandQueue() cl_program CompileProgram(const char *Kernel) { - u32 compileStart = timeGetTime(); + u32 compileStart = Common::Timer::GetTimeMs(); int err; cl_program program; program = clCreateProgramWithSource(OpenCL::g_context, 1, (const char **) & Kernel, NULL, &err); @@ -152,13 +152,13 @@ cl_program CompileProgram(const char *Kernel) return NULL; } - NOTICE_LOG(COMMON, "OpenCL CompileProgram took %.3f seconds", (float)(timeGetTime() - compileStart) / 1000.0); + NOTICE_LOG(COMMON, "OpenCL CompileProgram took %.3f seconds", (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0); return program; } cl_kernel CompileKernel(cl_program program, const char *Function) { - u32 compileStart = timeGetTime(); + u32 compileStart = Common::Timer::GetTimeMs(); int err; // Create the compute kernel in the program we wish to run @@ -168,7 +168,7 @@ cl_kernel CompileKernel(cl_program program, const char *Function) HandleCLError(err, "Failed to create compute kernel!"); return NULL; } - NOTICE_LOG(COMMON, "OpenCL CompileKernel took %.3f seconds", (float)(timeGetTime() - compileStart) / 1000.0); + NOTICE_LOG(COMMON, "OpenCL CompileKernel took %.3f seconds", (float)(Common::Timer::GetTimeMs() - compileStart) / 1000.0); return kernel; } #endif diff --git a/Source/Core/Common/Src/Timer.cpp b/Source/Core/Common/Src/Timer.cpp index 3fc1f79574..1bbd0e6632 100644 --- a/Source/Core/Common/Src/Timer.cpp +++ b/Source/Core/Common/Src/Timer.cpp @@ -128,7 +128,7 @@ std::string Timer::GetTimeElapsedFormatted() const // The number of milliseconds since the start, use a different value if the timer is stopped u64 Milliseconds; if (m_Running) - Milliseconds = timeGetTime() - m_StartTime; + Milliseconds = GetTimeMs() - m_StartTime; else Milliseconds = m_LastTime - m_StartTime; // Seconds diff --git a/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp b/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp index 3ea94958f9..b172e7390c 100644 --- a/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp +++ b/Source/Core/VideoCommon/Src/OnScreenDisplay.cpp @@ -42,7 +42,7 @@ static std::list s_listMsgs; void AddMessage(const char* pstr, u32 ms) { - s_listMsgs.push_back(MESSAGE(pstr, timeGetTime() + ms)); + s_listMsgs.push_back(MESSAGE(pstr, Common::Timer::GetTimeMs() + ms)); } void DrawMessages() @@ -53,7 +53,7 @@ void DrawMessages() std::list::iterator it = s_listMsgs.begin(); while (it != s_listMsgs.end()) { - int time_left = (int)(it->dwTimeStamp - timeGetTime()); + int time_left = (int)(it->dwTimeStamp - Common::Timer::GetTimeMs()); int alpha = 255; if (time_left < 1024) diff --git a/Source/Core/VideoCommon/Src/Profiler.cpp b/Source/Core/VideoCommon/Src/Profiler.cpp index 1cb29d3a61..7edc07fd28 100644 --- a/Source/Core/VideoCommon/Src/Profiler.cpp +++ b/Source/Core/VideoCommon/Src/Profiler.cpp @@ -137,7 +137,7 @@ void DVProfRegister(const char *pname) // while(it != g_listAllProfilers.end() ) { // // if( _tcscmp(pname, (*it)->pname) == 0 ) { -// (*it)->listTimes.push_back(timeGetTime()); +// (*it)->listTimes.push_back(Common::Timer::GetTimeMs()); // DVPROFTRACK dvtrack; // dvtrack.pdwTime = &(*it)->listTimes.back(); // dvtrack.pprof = *it; diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp index 8443648201..8f6a4e03c6 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp @@ -20,6 +20,7 @@ #include #include "Common.h" +#include "Timer.h" #include "Statistics.h" #include "VideoConfig.h" @@ -1017,9 +1018,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) static int fpscount = 0; static unsigned long lasttime; ++fpscount; - if (timeGetTime() - lasttime > 1000) + if (Common::Timer::GetTimeMs() - lasttime > 1000) { - lasttime = timeGetTime(); + lasttime = Common::Timer::GetTimeMs(); s_fps = fpscount - 1; fpscount = 0; } diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp index 1770912b12..2213d8b357 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureConverter.cpp @@ -203,23 +203,23 @@ void EncodeToRamUsingShader(LPDIRECT3DPIXELSHADER9 shader, LPDIRECT3DTEXTURE9 sr LPDIRECT3DSURFACE9 s_texConvReadSurface = NULL; LPDIRECT3DSURFACE9 Rendersurf = NULL; - if(index >= WorkingBuffers) + if (index >= WorkingBuffers) { - if(WorkingBuffers < NUM_TRANSFORM_BUFFERS) + if (WorkingBuffers < NUM_TRANSFORM_BUFFERS) WorkingBuffers++; - if(index >= WorkingBuffers) + if (index >= WorkingBuffers) index--; - if(TrnBuffers[index].RenderSurface != NULL) + if (TrnBuffers[index].RenderSurface != NULL) { TrnBuffers[index].RenderSurface->Release(); TrnBuffers[index].RenderSurface = NULL; } - if(TrnBuffers[index].ReadSurface != NULL) + if (TrnBuffers[index].ReadSurface != NULL) { TrnBuffers[index].ReadSurface->Release(); TrnBuffers[index].ReadSurface = NULL; } - if(TrnBuffers[index].FBTexture != NULL) + if (TrnBuffers[index].FBTexture != NULL) { TrnBuffers[index].FBTexture->Release(); TrnBuffers[index].FBTexture = NULL; diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp index 69e8e390f2..8240ab2410 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp @@ -1011,9 +1011,9 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight) static int fpscount = 0; static unsigned long lasttime; ++fpscount; - if (timeGetTime() - lasttime > 1000) + if (Common::Timer::GetTimeMs() - lasttime > 1000) { - lasttime = timeGetTime(); + lasttime = Common::Timer::GetTimeMs(); s_fps = fpscount - 1; fpscount = 0; } @@ -1163,10 +1163,10 @@ void Renderer::DrawDebugText() { if (OSDChoice > 0) { - OSDTime = timeGetTime() + 3000; + OSDTime = Common::Timer::GetTimeMs() + 3000; OSDChoice = -OSDChoice; } - if ((u32)OSDTime > timeGetTime()) + if ((u32)OSDTime > Common::Timer::GetTimeMs()) { std::string T1 = "", T2 = ""; std::vector T0;