GregMiscellaneous: zzogl-pg: Move the time functions over to be by the Profile code.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/GregMiscellaneous@3999 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-11-06 06:05:00 +00:00
parent 0970117f81
commit 7501916896
3 changed files with 32 additions and 36 deletions

View File

@ -35,6 +35,23 @@ extern u64 luPerfFreq;
#ifdef __LINUX__
#include <sys/time.h>
#include <sys/timeb.h> // ftime(), struct timeb
inline unsigned long timeGetTime()
{
timeb t;
ftime(&t);
return (unsigned long)(t.time*1000 + t.millitm);
}
inline unsigned long timeGetPreciseTime()
{
timespec t;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t);
return t.tv_nsec;
}
static __forceinline void InitCPUTicks()
{
@ -56,6 +73,18 @@ static __forceinline u64 GetCPUTicks()
#else
static __aligned16 LARGE_INTEGER lfreq;
inline unsigned long timeGetTime()
{
// Implement later.
return (unsigned long)0;
}
inline unsigned long timeGetPreciseTime()
{
// Implement later.
return 0;
}
static __forceinline void InitCPUTicks()
{
QueryPerformanceFrequency(&lfreq);

View File

@ -53,6 +53,7 @@ extern "C" u32 CALLBACK PS2EgetLibVersion2(u32 type);
extern "C" char* CALLBACK PS2EgetLibName(void);
#include "ZZoglMath.h"
#include "Profile.h"
#include <vector>
#include <string>
@ -90,34 +91,6 @@ static __forceinline void pcsx2_aligned_free(void* pmem)
#endif
#ifdef __LINUX__
#include <sys/timeb.h> // ftime(), struct timeb
inline unsigned long timeGetTime()
{
timeb t;
ftime(&t);
return (unsigned long)(t.time*1000 + t.millitm);
}
#include <time.h>
inline unsigned long timeGetPreciseTime()
{
timespec t;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t);
return t.tv_nsec;
}
struct RECT
{
int left, top;
int right, bottom;
};
#endif
#define max(a,b) (((a) > (b)) ? (a) : (b))
#define min(a,b) (((a) < (b)) ? (a) : (b))

View File

@ -2737,16 +2737,16 @@ void FlushTransferRanges(const tex0Info* ptex)
#endif
#ifdef __LINUX__
//#define LOG_RESOLVE_PROFILE
#endif
template <typename Tdst, bool do_conversion>
inline void Resolve_32_Bit(const void* psrc, int fbp, int fbw, int fbh, const int psm, u32 fbm)
{
u32 mask, imask;
#ifdef LOG_RESOLVE_PROFILE
#ifdef __LINUX__
u32 startime = timeGetPreciseTime();
#endif
#endif
if (PSMT_ISHALF(psm)) /* 16 bit */
@ -2822,10 +2822,8 @@ inline void Resolve_32_Bit(const void* psrc, int fbp, int fbw, int fbh, const in
src -= raw_size;
}
#ifdef LOG_RESOLVE_PROFILE
#ifdef __LINUX__
ZZLog::Dev_Log("*** 32 bits: execution time %d", timeGetPreciseTime()-startime);
#endif
#endif
}
static const __aligned16 unsigned int pixel_5b_mask[4] = {0x0000001F, 0x0000001F, 0x0000001F, 0x0000001F};
@ -3061,9 +3059,7 @@ void Resolve_32_Bit_sse2(const void* psrc, int fbp, int fbw, int fbh, u32 fbm)
{
// Note a basic implementation was done in Resolve_32_Bit function
#ifdef LOG_RESOLVE_PROFILE
#ifdef __LINUX__
u32 startime = timeGetPreciseTime();
#endif
#endif
u32 pix_mask;
if (PSMT_ISHALF(psm)) /* 16 bit format */
@ -3137,10 +3133,8 @@ void Resolve_32_Bit_sse2(const void* psrc, int fbp, int fbw, int fbh, u32 fbm)
}
#ifdef LOG_RESOLVE_PROFILE
#ifdef __LINUX__
ZZLog::Dev_Log("*** 32 bits: execution time %d", timeGetPreciseTime()-startime);
#endif
#endif
}
#endif