Merge private branch.

This commit is contained in:
castano
2010-05-27 23:18:08 +00:00
parent 56401d5f7d
commit e7f2d1e2bc
27 changed files with 3429 additions and 3263 deletions

View File

@ -1,5 +1,6 @@
// This code is in the public domain -- castano@gmail.com
#pragma once
#ifndef NV_CORE_TIMER_H
#define NV_CORE_TIMER_H
@ -12,16 +13,16 @@
class NVCORE_CLASS Timer
{
public:
Timer() {}
void start() { m_start = clock(); }
void stop() { m_stop = clock(); }
Timer() {}
void start() { m_start = clock(); }
void stop() { m_stop = clock(); }
float elapsed() const { return float(m_stop - m_start) / CLOCKS_PER_SEC; }
float elapsed() const { return float(m_stop - m_start) / CLOCKS_PER_SEC; }
private:
clock_t m_start;
clock_t m_stop;
clock_t m_start;
clock_t m_stop;
};
#else
@ -34,22 +35,22 @@ private:
class NVCORE_CLASS Timer
{
public:
Timer() {
// get the tick frequency from the OS
QueryPerformanceFrequency((LARGE_INTEGER*) &m_frequency);
}
void start() { QueryPerformanceCounter((LARGE_INTEGER*) &m_start); }
void stop() { QueryPerformanceCounter((LARGE_INTEGER*) &m_stop); }
Timer() {
// get the tick frequency from the OS
QueryPerformanceFrequency((LARGE_INTEGER*) &m_frequency);
}
void start() { QueryPerformanceCounter((LARGE_INTEGER*) &m_start); }
void stop() { QueryPerformanceCounter((LARGE_INTEGER*) &m_stop); }
int elapsed() const {
return (int)1000 * ((double)m_stop.QuadPart - (double)m_start.QuadPart) / (double)m_frequency.QuadPart;
}
int elapsed() const {
return (int)1000 * ((double)m_stop.QuadPart - (double)m_start.QuadPart) / (double)m_frequency.QuadPart;
}
private:
LARGE_INTEGER m_frequency;
LARGE_INTEGER m_start;
LARGE_INTEGER m_stop;
LARGE_INTEGER m_frequency;
LARGE_INTEGER m_start;
LARGE_INTEGER m_stop;
};