Commits

dbacchet  committed e39ac5a

restructured tmer and logger

  • Participants
  • Parent commits f56361e

Comments (0)

Files changed (23)

File temp/test_hordefiles/Horde3D.cpp

 
 #include "egModules.h"
 #include "egCom.h"
+#include "engine_logger.h"
 // #include "egExtensions.h"
 #include "egRenderer.h"
 #include "egModel.h"
 	static string msgText;
 	static LogMessage msg;
 	
-	if( Modules::log().getMessage( msg ) )
+	if( Modules::log().get_message( msg ) )
 	{
 		if( level != 0x0 ) *level = msg.level;
 		if( time != 0x0 ) *time = msg.time;
 	Resource *resObj = Modules::resMan().resolveResHandle( res );
 	APIFUNC_VALIDATE_RES( resObj, "h3dLoadResource", false );
 	
-	Modules::log().writeInfo( "Loading resource '%s'", resObj->get_name().c_str() );
+	Modules::log().info( "Loading resource '%s'", resObj->get_name().c_str() );
 	return resObj->load( data, size );
 }
 
 
 	if (Modules::resMan().getResource(ResourceTypes::Texture, name) == 0)
 	{	
-		Modules::log().writeDebugInfo( "Failed to add resource in h3dCreateTexture; maybe the name is already in use?" );
+		Modules::log().debug( "Failed to add resource in h3dCreateTexture; maybe the name is already in use?" );
 		delete texRes;
 	}
 
 
 	if( !sgRes->is_loaded() )
 	{
-		Modules::log().writeDebugInfo( "Unloaded SceneGraph resource passed to h3dAddNodes" );
+		Modules::log().debug( "Unloaded SceneGraph resource passed to h3dAddNodes" );
 		return 0;
 	}
 	
-	//Modules::log().writeInfo( "Adding nodes from SceneGraph resource '%s'", res->get_name().c_str() );
+	//Modules::log().info( "Adding nodes from SceneGraph resource '%s'", res->get_name().c_str() );
 	return Modules::sceneMan().addNodes( *parentNode, *(SceneGraphResource *)sgRes );
 }
 
 	SceneNode *sn = Modules::sceneMan().resolveNodeHandle( node );
 	APIFUNC_VALIDATE_NODE( sn, "h3dRemoveNode", APIFUNC_RET_VOID );
 
-	//Modules::log().writeInfo( "Removing node %i", node );
+	//Modules::log().info( "Removing node %i", node );
 	Modules::sceneMan().removeNode( *sn );
 }
 
 	SceneNode *parentNode = Modules::sceneMan().resolveNodeHandle( parent );
 	APIFUNC_VALIDATE_NODE( parentNode, "h3dAddGroupNode", 0 );
 
-	//Modules::log().writeInfo( "Adding Group node '%s'", safeStr( name ).c_str() );
+	//Modules::log().info( "Adding Group node '%s'", safeStr( name ).c_str() );
 	GroupNodeTpl tpl( safeStr( name, 0 ) );
 	SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Group )->factoryFunc( tpl );
 	return Modules::sceneMan().addNode( sn, *parentNode );
 	Resource *geoRes = Modules::resMan().resolveResHandle( geometryRes );
 	APIFUNC_VALIDATE_RES_TYPE( geoRes, ResourceTypes::Geometry, "h3dAddModelNode", 0 );
 
-	//Modules::log().writeInfo( "Adding Model node '%s'", safeStr( name ).c_str() );
+	//Modules::log().info( "Adding Model node '%s'", safeStr( name ).c_str() );
 	ModelNodeTpl tpl( safeStr( name, 0 ), (GeometryResource *)geoRes );
 	SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Model )->factoryFunc( tpl );
 	return Modules::sceneMan().addNode( sn, *parentNode );
 	Resource *matRes = Modules::resMan().resolveResHandle( materialRes );
 	APIFUNC_VALIDATE_RES_TYPE( matRes, ResourceTypes::Material, "h3dAddMeshNode", 0 );
 
-	//Modules::log().writeInfo( "Adding Mesh node '%s'", safeStr( name ).c_str() );
+	//Modules::log().info( "Adding Mesh node '%s'", safeStr( name ).c_str() );
 	MeshNodeTpl tpl( safeStr( name, 0 ), (MaterialResource *)matRes, (unsigned)batchStart,
 	                 (unsigned)batchCount, (unsigned)vertRStart, (unsigned)vertREnd );
 	SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Mesh )->factoryFunc( tpl );
 	SceneNode *parentNode = Modules::sceneMan().resolveNodeHandle( parent );
 	APIFUNC_VALIDATE_NODE( parentNode, "h3dAddJointNode", 0 );
 
-	//Modules::log().writeInfo( "Adding Joint node '%s'", safeStr( name ).c_str() );
+	//Modules::log().info( "Adding Joint node '%s'", safeStr( name ).c_str() );
 	JointNodeTpl tpl( safeStr( name, 0 ), (unsigned)jointIndex );
 	SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Joint )->factoryFunc( tpl );
 	return Modules::sceneMan().addNode( sn, *parentNode );
 		APIFUNC_VALIDATE_RES_TYPE( matRes, ResourceTypes::Material, "h3dAddLightNode", 0 );
 	}
 	
-	//Modules::log().writeInfo( "Adding Light node '%s'", safeStr( name ).c_str() );
+	//Modules::log().info( "Adding Light node '%s'", safeStr( name ).c_str() );
 	LightNodeTpl tpl( safeStr( name, 0 ), (MaterialResource *)matRes,
 	                  safeStr( lightingContext, 1 ), safeStr( shadowContext, 2 ) );
 	SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Light )->factoryFunc( tpl );
 	Resource *pipeRes = Modules::resMan().resolveResHandle( pipelineRes );
 	APIFUNC_VALIDATE_RES_TYPE( pipeRes, ResourceTypes::Pipeline, "h3dAddCameraNode", 0 );
 	
-	//Modules::log().writeInfo( "Adding Camera node '%s'", safeStr( name ).c_str() );
+	//Modules::log().info( "Adding Camera node '%s'", safeStr( name ).c_str() );
 	CameraNodeTpl tpl( safeStr( name, 0 ), (PipelineResource *)pipeRes );
 	SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Camera )->factoryFunc( tpl );
 	return Modules::sceneMan().addNode( sn, *parentNode );
 	Resource *effRes = Modules::resMan().resolveResHandle( particleEffectRes );
 	APIFUNC_VALIDATE_RES_TYPE( effRes, ResourceTypes::ParticleEffect, "h3dAddEmitterNode", 0 );
 	
-	//Modules::log().writeInfo( "Adding Emitter node '%s'", safeStr( name ).c_str() );
+	//Modules::log().info( "Adding Emitter node '%s'", safeStr( name ).c_str() );
 	EmitterNodeTpl tpl( safeStr( name, 0 ), (MaterialResource *)matRes, (ParticleEffectResource *)effRes,
 	                    (unsigned)maxParticleCount, respawnCount );
 	SceneNode *sn = Modules::sceneMan().findType( SceneNodeTypes::Emitter )->factoryFunc( tpl );

File temp/test_hordefiles/egAnimation.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egAnimation.h"
 #include "egModules.h"
 #include "egCom.h"
 	release();
 	initDefault();
 
-	Modules::log().writeError( "Animation resource '%s': %s", _name.c_str(), msg.c_str() );
+	Modules::log().error( "Animation resource '%s': %s", _name.c_str(), msg.c_str() );
 	
 	return false;
 }
 	Quaternion nodeRotQuat;
 	Vec3f nodeTransVec, nodeScaleVec;
 	
-	Timer *timer = Modules::stats().getTimer( EngineStats::AnimationTime );
-	if( Modules::config().gatherTimeStats ) timer->setEnabled( true );
-	
 	// Animate
 	for( size_t i = 0, si = _nodeList.size(); i < si; ++i )
 	{
 		}
 	}
 
-	timer->setEnabled( false );
-
 	_dirty = false;
 	return true;
 }

File temp/test_hordefiles/egCom.cpp

 // *************************************************************************************************
 
 #include "egCom.h"
+#include "engine_logger.h"
 #include "utMath.h"
 #include "egModules.h"
 #include "egRenderer.h"
 	wireframeMode = false;
 	debugViewMode = false;
 	dumpFailedShaders = false;
-	gatherTimeStats = true;
 }
 
 
 		return debugViewMode ? 1.0f : 0.0f;
 	case EngineOptions::DumpFailedShaders:
 		return dumpFailedShaders ? 1.0f : 0.0f;
-	case EngineOptions::GatherTimeStats:
-		return gatherTimeStats ? 1.0f : 0.0f;
 	default:
 		Modules::setError( "Invalid param for h3dGetOption" );
 		return Math::NaN;
 		
 		if( !Modules::renderer().createShadowRB( size, size ) )
 		{
-			Modules::log().writeWarning( "Failed to create shadow map" );
+			Modules::log().warning( "Failed to create shadow map" );
 			// Restore old buffer
 			Modules::renderer().createShadowRB( shadowMapSize, shadowMapSize );
 			return false;
 	case EngineOptions::DumpFailedShaders:
 		dumpFailedShaders = (value != 0);
 		return true;
-	case EngineOptions::GatherTimeStats:
-		gatherTimeStats = (value != 0);
-		return true;
 	default:
 		Modules::setError( "Invalid param for h3dSetOption" );
 		return false;
 }
 
 
-// *************************************************************************************************
-// Class EngineLog
-// *************************************************************************************************
-
-EngineLog::EngineLog()
-{
-	_timer.setEnabled( true );
-	_maxNumMessages = 512;
-}
-
-
-void EngineLog::pushMessage( int level, const char *msg, va_list args )
-{
-	float time = _timer.getElapsedTimeMS() / 1000.0f;
-
-#if defined( PLATFORM_WIN )
-#pragma warning( push )
-#pragma warning( disable:4996 )
-	vsnprintf( _textBuf, 2048, msg, args );
-#pragma warning( pop )
-#else
-	vsnprintf( _textBuf, 2048, msg, args );
-#endif
-	
-	if( _messages.size() < _maxNumMessages - 1 )
-	{
-		_messages.push( LogMessage( _textBuf, level, time ) );
-	}
-	else if( _messages.size() == _maxNumMessages - 1 )
-	{
-		_messages.push( LogMessage( "Message queue is full", 1, time ) );
-	}
-
-#if defined( PLATFORM_WIN ) && defined( H3D_DEBUGGER_OUTPUT )
-	const TCHAR *headers[6] = { TEXT(""), TEXT("  [h3d-err] "), TEXT("  [h3d-warn] "), TEXT("[h3d] "), TEXT("  [h3d-dbg] "), TEXT("[h3d- ] ")};
-	
-	OutputDebugString( headers[std::min( (uint32_t)level, (uint32_t)5 )] );
-	OutputDebugStringA( _textBuf );
-	OutputDebugString( TEXT("\r\n") );
-#endif
-}
-
-
-void EngineLog::writeError( const char *msg, ... )
-{
-	if( Modules::config().maxLogLevel < 1 ) return;
-
-	va_list args;
-	va_start( args, msg );
-	pushMessage( 1, msg, args );
-	va_end( args );
-}
-
-
-void EngineLog::writeWarning( const char *msg, ... )
-{
-	if( Modules::config().maxLogLevel < 2 ) return;
-
-	va_list args;
-	va_start( args, msg );
-	pushMessage( 2, msg, args );
-	va_end( args );
-}
-
-
-void EngineLog::writeInfo( const char *msg, ... )
-{
-	if( Modules::config().maxLogLevel < 3 ) return;
-
-	va_list args;
-	va_start( args, msg );
-	pushMessage( 3, msg, args );
-	va_end( args );
-}
-
-
-void EngineLog::writeDebugInfo( const char *msg, ... )
-{
-	if( Modules::config().maxLogLevel < 4 ) return;
-
-	va_list args;
-	va_start( args, msg );
-	pushMessage( 4, msg, args );
-	va_end( args );
-}
-
-
-bool EngineLog::getMessage( LogMessage &msg )
-{
-	if( !_messages.empty() )
-	{
-		msg = _messages.front();
-		_messages.pop();
-		return true;
-	}
-	else
-		return false;
-}
-
 
 // *************************************************************************************************
 // Class StatManager
 		value = _frameTime;
 		if( reset ) _frameTime = 0;
 		return value;
-	case EngineStats::AnimationTime:
-		value = _animTimer.getElapsedTimeMS();
-		if( reset ) _animTimer.reset();
-		return value;
-	case EngineStats::SkinningTime:
-		value = _geoUpdateTimer.getElapsedTimeMS();
-		if( reset ) _geoUpdateTimer.reset();
-		return value;
-	case EngineStats::ParticleSimTime:
-		value = _particleSimTimer.getElapsedTimeMS();
-		if( reset ) _particleSimTimer.reset();
-		return value;
 	case EngineStats::TextureVMem:
 		return (gRDI->getTextureMem() / 1024) / 1024.0f;
 	case EngineStats::GeometryVMem:
 }
 
 
-Timer *StatManager::getTimer( int param )
-{
-	switch( param )
-	{
-	case EngineStats::FrameTime:
-		return &_frameTimer;
-	case EngineStats::AnimationTime:
-		return &_animTimer;
-	case EngineStats::SkinningTime:
-		return &_geoUpdateTimer;
-	case EngineStats::ParticleSimTime:
-		return &_particleSimTimer;
-	default:
-		return 0x0;
-	}
-}
 
 
 }  // namespace

File temp/test_hordefiles/egCom.h

 #include <string>
 #include <queue>
 #include <cstdarg>
-#include "utTimer.h"
+#include "engine_timer.h"
 
 
 namespace Horde3D {
 	                      lights are visualized using their screen space bounding box. (Values: 0, 1; Default: 0)
 	DumpFailedShaders   - Enables or disables storing of shader code that failed to compile in a text file; this can be
 	                      useful in combination with the line numbers given back by the shader compiler. (Values: 0, 1; Default: 0)
-	GatherTimeStats     - Enables or disables gathering of time stats that are useful for profiling (Values: 0, 1; Default: 1)
 */
 struct EngineOptions
 {
 		SampleCount,
 		WireframeMode,
 		DebugViewMode,
-		DumpFailedShaders,
-		GatherTimeStats
+		DumpFailedShaders
 	};
 };
 
 	bool  wireframeMode;
 	bool  debugViewMode;
 	bool  dumpFailedShaders;
-	bool  gatherTimeStats;
 };
 
 
-// =================================================================================================
-// Engine Log
-// =================================================================================================
-
-struct LogMessage
-{
-	std::string  text;
-	int          level;
-	float        time;
-
-	LogMessage()
-	{
-	}
-
-	LogMessage( const std::string &text, int level, float time ) :
-		text( text ), level( level ), time( time )
-	{
-	}
-};
-
-// =================================================================================================
-
-class EngineLog
-{
-public:
-	EngineLog();
-
-	void writeError( const char *msg, ... );
-	void writeWarning( const char *msg, ... );
-	void writeInfo( const char *msg, ... );
-	void writeDebugInfo( const char *msg, ... );
-
-	bool getMessage( LogMessage &msg );
-
-	uint32_t getMaxNumMessages() { return _maxNumMessages; }
-	void setMaxNumMessages( uint32_t maxNumMessages ) { _maxNumMessages = maxNumMessages; }
-	
-protected:
-	void pushMessage( const std::string &text, uint32_t level );
-	void pushMessage( int level, const char *msg, va_list ap );
-
-protected:
-	Timer                     _timer;
-	char                      _textBuf[2048];
-	uint32_t                    _maxNumMessages;
-	std::queue< LogMessage >  _messages;
-};
-
 
 // =================================================================================================
 // Engine Stats
 	
 	float getStat( int param, bool reset );
 	void incStat( int param, float value );
-	Timer *getTimer( int param );
+	Timer *getTimer( void ) {  return &_frameTimer;  }
 
 protected:
 	uint32_t    _statTriCount;
 	uint32_t    _statLightPassCount;
 
 	Timer     _frameTimer;
-	Timer     _animTimer;
-	Timer     _geoUpdateTimer;
-	Timer     _particleSimTimer;
 	float     _frameTime;
 
 	friend class ProfSample;

File temp/test_hordefiles/egGeometry.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egGeometry.h"
 #include "egResource.h"
 #include "egAnimation.h"
 	release();
 	initDefault();
 
-	Modules::log().writeError( "Geometry resource '%s': %s", _name.c_str(), msg.c_str() );
+	Modules::log().error( "Geometry resource '%s': %s", _name.c_str(), msg.c_str() );
 	
 	return false;
 }
 	memcpy( &count, pData, sizeof( uint32_t ) ); pData += sizeof( uint32_t );
 
 	if( count > 75 )
-		Modules::log().writeWarning( "Geometry resource '%s': Model has more than 75 joints; this may cause defective behavior", _name.c_str() );
+		Modules::log().warning( "Geometry resource '%s': Model has more than 75 joints; this may cause defective behavior", _name.c_str() );
 
 	_joints.resize( count );
 	for( uint32_t i = 0; i < count; ++i )
 			break;
 		default:
 			pData += streamElemSize * streamSize;
-			Modules::log().writeWarning( "Geometry resource '%s': Ignoring unsupported vertex base stream", _name.c_str() );
+			Modules::log().warning( "Geometry resource '%s': Ignoring unsupported vertex base stream", _name.c_str() );
 			continue;
 		}
 	}

File temp/test_hordefiles/egMaterial.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egMaterial.h"
 #include "egTexture.h"
 #include "egModules.h"
 	initDefault();
 
 	if( line < 0 )
-		Modules::log().writeError( "Material resource '%s': %s", _name.c_str(), msg.c_str() );
+		Modules::log().error( "Material resource '%s': %s", _name.c_str(), msg.c_str() );
 	else
-		Modules::log().writeError( "Material resource '%s' in line %i: %s", _name.c_str(), line, msg.c_str() );
+		Modules::log().error( "Material resource '%s' in line %i: %s", _name.c_str(), line, msg.c_str() );
 	
 	return false;
 }

File temp/test_hordefiles/egModel.cpp

 	if( _geometryRes == 0x0 || _geometryRes->getVertPosData() == 0x0 ||
 		_geometryRes->getVertTanData() == 0x0 || _geometryRes->getVertStaticData() == 0x0 ) return false;
 	
-	Timer *timer = Modules::stats().getTimer( EngineStats::SkinningTime );
-	if( Modules::config().gatherTimeStats ) timer->setEnabled( true );
-	
 	// Reset vertices to base data
 	memcpy( _geometryRes->getVertPosData(), _baseGeoRes->getVertPosData(),
 	        _geometryRes->_vertCount * sizeof( Vec3f ) );
 	// Upload geometry
 	_geometryRes->updateDynamicVertData();
 
-	timer->setEnabled( false );
-
 	return true;
 }
 

File temp/test_hordefiles/egModules.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egResource.h"
 #include "egScene.h"
 #include "egSceneGraphRes.h"
 
 bool                   Modules::_errorFlag = false;
 EngineConfig           *Modules::_engineConfig = 0x0;
-EngineLog              *Modules::_engineLog = 0x0;
+Logger                 *Modules::_engineLog = 0x0;
 StatManager            *Modules::_statManager = 0x0;
 SceneManager           *Modules::_sceneManager = 0x0;
 ResourceManager        *Modules::_resourceManager = 0x0;
 bool Modules::init()
 {
 	// Create modules (order is important because of dependencies)
-	if( _engineLog == 0x0 ) _engineLog = new EngineLog();
+	if( _engineLog == 0x0 ) _engineLog = new Logger();
 	if( _engineConfig == 0x0 ) _engineConfig = new EngineConfig();
 	if( _sceneManager == 0x0 ) _sceneManager = new SceneManager();
 	if( _resourceManager == 0x0 ) _resourceManager = new ResourceManager();
 	if( errorStr2 ) msg.append( errorStr2 );
 	
 	_errorFlag = true;
-	_engineLog->writeDebugInfo( msg.c_str() );
+	_engineLog->debug( msg.c_str() );
 }
 
 

File temp/test_hordefiles/egModules.h

 
 // Forward declarations
 class EngineConfig;
-class EngineLog;
+class Logger;
 class StatManager;
 class SceneManager;
 class ResourceManager;
 	static bool getError();
 	
 	static EngineConfig &config() { return *_engineConfig; }
-	static EngineLog &log() { return *_engineLog; }
+	static Logger &log() { return *_engineLog; }
 	static StatManager &stats() { return *_statManager; }
 	static SceneManager &sceneMan() { return *_sceneManager; }
 	static ResourceManager &resMan() { return *_resourceManager; }
 	static bool                   _errorFlag;
 
 	static EngineConfig           *_engineConfig;
-	static EngineLog              *_engineLog;
+	static Logger              *_engineLog;
 	static StatManager            *_statManager;
 	static SceneManager           *_sceneManager;
 	static ResourceManager        *_resourceManager;

File temp/test_hordefiles/egParticle.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egParticle.h"
 #include "egMaterial.h"
 #include "egModules.h"
 	initDefault();
 
 	if( line < 0 )
-		Modules::log().writeError( "ParticleEffect resource '%s': %s", _name.c_str(), msg.c_str() );
+		Modules::log().error( "ParticleEffect resource '%s': %s", _name.c_str(), msg.c_str() );
 	else
-		Modules::log().writeError( "ParticleEffect resource '%s' in line %i: %s", _name.c_str(), line, msg.c_str() );
+		Modules::log().error( "ParticleEffect resource '%s' in line %i: %s", _name.c_str(), line, msg.c_str() );
 	
 	return false;
 }
 	// Update absolute transformation
 	updateTree();
 	
-	Timer *timer = Modules::stats().getTimer( EngineStats::ParticleSimTime );
-	if( Modules::config().gatherTimeStats ) timer->setEnabled( true );
-	
 	Vec3f bBMin( Math::MaxFloat, Math::MaxFloat, Math::MaxFloat );
 	Vec3f bBMax( -Math::MaxFloat, -Math::MaxFloat, -Math::MaxFloat );
 	
 	_bBox.max = bBMax;
 
 	_prevAbsTrans = _absTrans;
-
-	timer->setEnabled( false );
 }
 
 

File temp/test_hordefiles/egPipeline.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egPipeline.h"
 #include "egMaterial.h"
 #include "egModules.h"
 	initDefault();
 
 	if( line < 0 )
-		Modules::log().writeError( "Pipeline resource '%s': %s", _name.c_str(), msg.c_str() );
+		Modules::log().error( "Pipeline resource '%s': %s", _name.c_str(), msg.c_str() );
 	else
-		Modules::log().writeError( "Pipeline resource '%s' in line %i: %s", _name.c_str(), line, msg.c_str() );
+		Modules::log().error( "Pipeline resource '%s' in line %i: %s", _name.c_str(), line, msg.c_str() );
 	
 	return false;
 }

File temp/test_hordefiles/egRenderer.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egRenderer.h"
 #include "egParticle.h"
 #include "egLight.h"
 
 	// Check capabilities
 	if( !gRDI->getCaps().texFloat )
-		Modules::log().writeWarning( "Renderer: No floating point texture support available" );
+		Modules::log().warning( "Renderer: No floating point texture support available" );
 	if( !gRDI->getCaps().texNPOT )
-		Modules::log().writeWarning( "Renderer: No non-Power-of-two texture support available" );
+		Modules::log().warning( "Renderer: No non-Power-of-two texture support available" );
 	if( !gRDI->getCaps().rtMultisampling )
-		Modules::log().writeWarning( "Renderer: No multisampling for render targets available" );
+		Modules::log().warning( "Renderer: No multisampling for render targets available" );
 	
 	// Create vertex layouts
 	VertexLayoutAttrib attribsPosOnly[1] = {
 	// Upload default shaders
 	if( !createShaderComb( gRDI->getDefaultVSCode(), gRDI->getDefaultFSCode(), _defColorShader ) )
 	{
-		Modules::log().writeError( "Failed to compile default shaders" );
+		Modules::log().error( "Failed to compile default shaders" );
 		return false;
 	}
 
 	// Create shadow map render target
 	if( !createShadowRB( Modules::config().shadowMapSize, Modules::config().shadowMapSize ) )
 	{
-		Modules::log().writeError( "Failed to create shadow map" );
+		Modules::log().error( "Failed to create shadow map" );
 		return false;
 	}
 
 	finishRendering();
 
 	// Start frame timer
-	Timer *timer = Modules::stats().getTimer( EngineStats::FrameTime );
+	Timer *timer = Modules::stats().getTimer();
 	ASSERT( timer != 0x0 );
-	timer->setEnabled( true );
+	timer->set_enabled( true );
 	
 	return true;
 }
 	++_frameID;
 	
 	// Reset frame timer
-	Timer *timer = Modules::stats().getTimer( EngineStats::FrameTime );
+	Timer *timer = Modules::stats().getTimer();
 	ASSERT( timer != 0x0 );
 	Modules::stats().getStat( EngineStats::FrameTime, true );  // Reset
-	Modules::stats().incStat( EngineStats::FrameTime, timer->getElapsedTimeMS() );
+	Modules::stats().incStat( EngineStats::FrameTime, timer->get_elapsed_time_in_ms() );
 	timer->reset();
 }
 

File temp/test_hordefiles/egRendererBase.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egRendererBase.h"
 #include "egModules.h"
 #include "egCom.h"
 	char *renderer = (char *)glGetString( GL_RENDERER );
 	char *version = (char *)glGetString( GL_VERSION );
 	
-	Modules::log().writeInfo( "Initializing GL2 backend using OpenGL driver '%s' by '%s' on '%s'",
+	Modules::log().info( "Initializing GL2 backend using OpenGL driver '%s' by '%s' on '%s'",
 	                          version, vendor, renderer );
 	
 	// Init extensions
 	if( !initOpenGLExtensions() )
 	{	
-		Modules::log().writeError( "Could not find all required OpenGL function entry points" );
+		Modules::log().error( "Could not find all required OpenGL function entry points" );
 		failed = true;
 	}
 
 	// Check that OpenGL 2.0 is available
 	if( glExt::majorVersion * 10 + glExt::minorVersion < 20 )
 	{
-		Modules::log().writeError( "OpenGL 2.0 not available" );
+		Modules::log().error( "OpenGL 2.0 not available" );
 		failed = true;
 	}
 	
 	// Check that required extensions are supported
 	if( !glExt::EXT_framebuffer_object )
 	{
-		Modules::log().writeError( "Extension EXT_framebuffer_object not supported" );
+		Modules::log().error( "Extension EXT_framebuffer_object not supported" );
 		failed = true;
 	}
 	if( !glExt::EXT_texture_filter_anisotropic )
 	{
-		Modules::log().writeError( "Extension EXT_texture_filter_anisotropic not supported" );
+		Modules::log().error( "Extension EXT_texture_filter_anisotropic not supported" );
 		failed = true;
 	}
 	if( !glExt::EXT_texture_compression_s3tc )
 	{
-		Modules::log().writeError( "Extension EXT_texture_compression_s3tc not supported" );
+		Modules::log().error( "Extension EXT_texture_compression_s3tc not supported" );
 		failed = true;
 	}
 	if( !glExt::EXT_texture_sRGB )
 	{
-		Modules::log().writeError( "Extension EXT_texture_sRGB not supported" );
+		Modules::log().error( "Extension EXT_texture_sRGB not supported" );
 		failed = true;
 	}
 	
 	if( failed )
 	{
-		Modules::log().writeError( "Failed to init renderer backend, debug info following" );
+		Modules::log().error( "Failed to init renderer backend, debug info following" );
 		char *exts = (char *)glGetString( GL_EXTENSIONS );
-		Modules::log().writeInfo( "Supported extensions: '%s'", exts );
+		Modules::log().info( "Supported extensions: '%s'", exts );
 
 		return false;
 	}
 	if( testBuf == 0 )
 	{	
 		_depthFormat = GL_DEPTH_COMPONENT16;
-		Modules::log().writeWarning( "Render target depth precision limited to 16 bit" );
+		Modules::log().warning( "Render target depth precision limited to 16 bit" );
 	}
 	else
 		destroyRenderBuffer( testBuf );
 	{
 		// Check if texture is NPOT
 		if( (width & (width-1)) != 0 || (height & (height-1)) != 0 )
-			Modules::log().writeWarning( "Texture has non-power-of-two dimensions although NPOT is not supported by GPU" );
+			Modules::log().warning( "Texture has non-power-of-two dimensions although NPOT is not supported by GPU" );
 	}
 	
 	RDITexture tex;
 	if( samples > maxSamples )
 	{
 		samples = maxSamples;
-		Modules::log().writeWarning( "GPU does not support desired multisampling quality for render target" );
+		Modules::log().warning( "GPU does not support desired multisampling quality for render target" );
 	}
 
 	RDIRenderBuffer rb;

File temp/test_hordefiles/egResource.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egResource.h"
 #include "egModules.h"
 #include "egCom.h"
 	// A NULL pointer can be used if the file could not be loaded
 	if( data == 0x0 || size <= 0 )
 	{	
-		Modules::log().writeWarning( "Resource '%s' of type %i: No data loaded (file not found?)", _name.c_str(), get_handle_type(_handle) );
+		Modules::log().warning( "Resource '%s' of type %i: No data loaded (file not found?)", _name.c_str(), get_handle_type(_handle) );
 		return false;
 	}
 
 {
 	if( name == "" )
 	{	
-		Modules::log().writeDebugInfo( "Invalid name for added resource of type %i", type );
+		Modules::log().debug( "Invalid name for added resource of type %i", type );
 		return 0;
 	}
 	
 	if( resource == 0x0 ) return 0;
 	resource->_handle = create_handle(type, RESHANDLE_ID_MASK);	// store only the type; the id part will be updated in addResource
 
-	//Modules::log().writeInfo( "Adding %s resource '%s'", itr->second.typeString.c_str(), name.c_str() );
+	//Modules::log().info( "Adding %s resource '%s'", itr->second.typeString.c_str(), name.c_str() );
 		
 	return addResource( *resource );
 }
 	// Delete unused resources
 	for( uint32_t i = 0; i < killList.size(); ++i )
 	{
-		Modules::log().writeInfo( "Removed resource '%s'", _resources[killList[i]]->_name.c_str() );
+		Modules::log().info( "Removed resource '%s'", _resources[killList[i]]->_name.c_str() );
 		delete _resources[killList[i]]; _resources[killList[i]] = 0x0;
 	}
 
 {
 	if( name == "" )
 	{	
-		Modules::log().writeDebugInfo( "Invalid name for geometry resource");
+		Modules::log().debug( "Invalid name for geometry resource");
 		return 0;
 	}
 	

File temp/test_hordefiles/egScene.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egScene.h"
 #include "egSceneGraphRes.h"
 #include "egLight.h"
 	// Check if node can be attached to parent
 	if( !node->canAttach( parent ) )
 	{
-		Modules::log().writeDebugInfo( "Can't attach node '%s' to parent '%s'", node->_name.c_str(), parent._name.c_str() );
+		Modules::log().debug( "Can't attach node '%s' to parent '%s'", node->_name.c_str(), parent._name.c_str() );
 		delete node; node = 0x0;
 		return 0;
 	}
 	
 	if( !node.canAttach( parent ) )
 	{	
-		Modules::log().writeDebugInfo( "Can't attach node to parent in h3dSetNodeParent" );
+		Modules::log().debug( "Can't attach node to parent in h3dSetNodeParent" );
 		return false;
 	}
 	

File temp/test_hordefiles/egSceneGraphRes.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egSceneGraphRes.h"
 #include "egModules.h"
 #include "egCom.h"
 		}
 		else if( strcmp( xmlNode.getName(), "Attachment" ) != 0 )
 		{
-			Modules::log().writeWarning( "SceneGraph resource '%s': Unknown node type or missing attribute for '%s'",
-										 _name.c_str(), xmlNode.getName() );
+			Modules::log().warning( "SceneGraph resource '%s': Unknown node type or missing attribute for '%s'",
+									 _name.c_str(), xmlNode.getName() );
 			return;
 		}
 	}

File temp/test_hordefiles/egShader.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egShader.h"
 #include "egModules.h"
 #include "egCom.h"
 	release();
 	initDefault();
 	
-	Modules::log().writeError( "Code resource '%s': %s", _name.c_str(), msg.c_str() );
+	Modules::log().error( "Code resource '%s': %s", _name.c_str(), msg.c_str() );
 
 	return false;
 }
 	initDefault();
 
 	if( line < 0 )
-		Modules::log().writeError( "Shader resource '%s': %s", _name.c_str(), msg.c_str() );
+		Modules::log().error( "Shader resource '%s': %s", _name.c_str(), msg.c_str() );
 	else
-		Modules::log().writeError( "Shader resource '%s': %s (line %i)", _name.c_str(), msg.c_str(), line );
+		Modules::log().error( "Shader resource '%s': %s (line %i)", _name.c_str(), msg.c_str(), line );
 	
 	return false;
 }
 	_tmpCode1 += getCode( context.fragCodeIdx )->assembleCode();
 
 	
-	Modules::log().writeInfo( "---- C O M P I L I N G  . S H A D E R . %s@%s[%i] ----",
+	Modules::log().info( "---- C O M P I L I N G  . S H A D E R . %s@%s[%i] ----",
 		_name.c_str(), context.id.c_str(), sc.combMask );
 	
 	// Unload shader if necessary
 	// Compile shader
 	if( !Modules::renderer().createShaderComb( _tmpCode0.c_str(), _tmpCode1.c_str(), sc ) )
 	{
-		Modules::log().writeError( "Shader resource '%s': Failed to compile shader context '%s' (comb %i)",
+		Modules::log().error( "Shader resource '%s': Failed to compile shader context '%s' (comb %i)",
 			_name.c_str(), context.id.c_str(), sc.combMask );
 
 		if( Modules::config().dumpFailedShaders )
 
 	// Output shader log
 	if( gRDI->getShaderLog() != "" )
-		Modules::log().writeInfo( "Shader resource '%s': ShaderLog: %s", _name.c_str(), gRDI->getShaderLog().c_str() );
+		Modules::log().info( "Shader resource '%s': ShaderLog: %s", _name.c_str(), gRDI->getShaderLog().c_str() );
 }
 
 

File temp/test_hordefiles/egTexture.cpp

 //
 // *************************************************************************************************
 
+#include "engine_logger.h"
 #include "egTexture.h"
 #include "egModules.h"
 #include "egCom.h"
 	release();
 	initDefault();
 
-	Modules::log().writeError( "Texture resource '%s': %s", _name.c_str(), msg.c_str() );
+	Modules::log().error( "Texture resource '%s': %s", _name.c_str(), msg.c_str() );
 	
 	return false;
 }

File temp/test_hordefiles/engine_logger.cpp

+
+#include "engine_logger.h"
+// #include "utMath.h"
+// #include "egModules.h"
+// #include "egRenderer.h"
+// #include <stdarg.h>
+// #include <stdio.h>
+
+
+
+namespace Horde3D {
+
+
+
+// *************************************************************************************************
+// Class Logger
+// *************************************************************************************************
+
+Logger::Logger()
+{
+	_timer.start();
+	_maxNumMessages = 512;
+}
+
+
+void Logger::pushMessage( int level, const char *msg, va_list args )
+{
+	float time = _timer.get_elapsed_time_in_ms() / 1000.0f;
+
+#if defined( PLATFORM_WIN )
+#pragma warning( push )
+#pragma warning( disable:4996 )
+	vsnprintf( _textBuf, 2048, msg, args );
+#pragma warning( pop )
+#else
+	vsnprintf( _textBuf, 2048, msg, args );
+#endif
+	
+	if( _messages.size() < _maxNumMessages - 1 )
+	{
+		_messages.push( LogMessage( _textBuf, level, time ) );
+	}
+	else if( _messages.size() == _maxNumMessages - 1 )
+	{
+		_messages.push( LogMessage( "Message queue is full", 1, time ) );
+	}
+
+#if defined( PLATFORM_WIN ) && defined( H3D_DEBUGGER_OUTPUT )
+	const TCHAR *headers[6] = { TEXT(""), TEXT("  [h3d-err] "), TEXT("  [h3d-warn] "), TEXT("[h3d] "), TEXT("  [h3d-dbg] "), TEXT("[h3d- ] ")};
+	
+	OutputDebugString( headers[std::min( (uint32_t)level, (uint32_t)5 )] );
+	OutputDebugStringA( _textBuf );
+	OutputDebugString( TEXT("\r\n") );
+#endif
+}
+
+
+void Logger::error( const char *msg, ... )
+{
+	// if( Modules::config().maxLogLevel < 1 ) return;
+
+	va_list args;
+	va_start( args, msg );
+	pushMessage( 1, msg, args );
+	va_end( args );
+}
+
+
+void Logger::warning( const char *msg, ... )
+{
+	// if( Modules::config().maxLogLevel < 2 ) return;
+
+	va_list args;
+	va_start( args, msg );
+	pushMessage( 2, msg, args );
+	va_end( args );
+}
+
+
+void Logger::info( const char *msg, ... )
+{
+	// if( Modules::config().maxLogLevel < 3 ) return;
+
+	va_list args;
+	va_start( args, msg );
+	pushMessage( 3, msg, args );
+	va_end( args );
+}
+
+
+void Logger::debug( const char *msg, ... )
+{
+	// if( Modules::config().maxLogLevel < 4 ) return;
+
+	va_list args;
+	va_start( args, msg );
+	pushMessage( 4, msg, args );
+	va_end( args );
+}
+
+
+bool Logger::get_message( LogMessage &msg )
+{
+	if( !_messages.empty() )
+	{
+		msg = _messages.front();
+		_messages.pop();
+		return true;
+	}
+	else
+		return false;
+}
+
+
+
+
+}  // namespace

File temp/test_hordefiles/engine_logger.h

+#pragma once
+
+#include <string>
+#include <queue>
+#include "engine_timer.h"
+
+
+namespace Horde3D {
+
+
+
+// =================================================================================================
+// Engine Log
+// =================================================================================================
+
+struct LogMessage
+{
+	std::string  text;
+	int          level;
+	float        time;
+
+	LogMessage()
+	{}
+
+	LogMessage( const std::string &text, int level, float time ) :
+		text( text ), level( level ), time( time )
+	{}
+};
+
+// =================================================================================================
+
+class Logger
+{
+public:
+	Logger();
+
+	void error( const char *msg, ... );
+	void warning( const char *msg, ... );
+	void info( const char *msg, ... );
+	void debug( const char *msg, ... );
+
+	bool get_message( LogMessage &msg );
+
+	uint32_t getMaxNumMessages() { return _maxNumMessages; }
+	void setMaxNumMessages( uint32_t maxNumMessages ) { _maxNumMessages = maxNumMessages; }
+	
+protected:
+	void pushMessage( const std::string &text, uint32_t level );
+	void pushMessage( int level, const char *msg, va_list ap );
+
+protected:
+	Timer                     _timer;
+	char                      _textBuf[2048];
+	uint32_t                    _maxNumMessages;
+	std::queue< LogMessage >  _messages;
+};
+
+
+} // namespace Horde3D
+

File temp/test_hordefiles/engine_timer.___h.h

+#pragma once
+
+#include "utPlatform.h"
+
+#ifndef PLATFORM_WIN
+	#include <sys/time.h>
+#endif
+
+
+namespace Horde3D {
+
+
+class Timer
+{
+public:
+    Timer();                      // default constructor
+    ~Timer();                     // default destructor
+
+    void   start();               // start timer
+    void   stop();                // stop the timer
+    void   enable(bool flag);     // enable/disable time measurement
+    double elapsed_time();        // get elapsed time in second
+    double elapsed_time_in_sec(); // get elapsed time in second (same as elapsed_time)
+    double elapsed_time_in_ms();  // get elapsed time in milli-second
+    double elapsed_time_in_us();  // get elapsed time in micro-second
+
+
+protected:
+
+
+private:
+    double _startTimeInMicroSec;  // starting time in micro-second
+    double _elapsedTimeInMicroSec;// ending time in micro-second
+    int    _enabled;              // activation flag
+#ifdef WIN32
+    LARGE_INTEGER frequency;    
+    LARGE_INTEGER startCount;     
+    LARGE_INTEGER endCount;       
+#else
+    timeval startCount;           
+    timeval endCount;             
+#endif
+};
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  class implementation
+///////////////////////////////////////////////////////////////////////////////
+Timer::Timer()
+{
+#ifdef WIN32
+    QueryPerformanceFrequency(&frequency);
+    startCount.QuadPart = 0;
+    endCount.QuadPart = 0;
+#else
+    startCount.tv_sec = startCount.tv_usec = 0;
+    endCount.tv_sec = endCount.tv_usec = 0;
+#endif
+
+    _enabled = true;
+    _startTimeInMicroSec = 0;
+    _elapsedTimeInMicroSec = 0;
+}
+
+Timer::~Timer()
+{
+}
+
+void Timer::start()
+{
+    _enabled = true;
+#ifdef WIN32
+    QueryPerformanceCounter(&startCount);
+#else
+    gettimeofday(&startCount, NULL);
+#endif
+}
+
+void Timer::stop()
+{
+    _enabled = false;
+
+#ifdef WIN32
+    QueryPerformanceCounter(&endCount);
+#else
+    gettimeofday(&endCount, NULL);
+#endif
+}
+
+void Timer::enable( bool flag )
+{	
+	if( flag && !_enabled )
+	{
+		_startTimeInMicroSec = elapsed_time_in_us();
+		_enabled = true;
+	}
+	else if( !flag && _enabled )
+	{
+		double endTime = elapsed_time_in_us();
+		_elapsedTimeInMicroSec += endTime - _startTimeInMicroSec;
+		_enabled = false;
+	}
+}
+
+double Timer::elapsed_time_in_us()
+{
+	if (_enabled)
+	{
+	#ifdef WIN32
+    	QueryPerformanceCounter(&endCount);
+    	startTimeInMicroSec = startCount.QuadPart * (1000000.0 / frequency.QuadPart);
+    	endTimeInMicroSec = endCount.QuadPart * (1000000.0 / frequency.QuadPart);
+	#else
+       	gettimeofday(&endCount, NULL);
+    	startTimeInMicroSec = (startCount.tv_sec * 1000000.0) + startCount.tv_usec;
+    	endTimeInMicroSec = (endCount.tv_sec * 1000000.0) + endCount.tv_usec;
+	#endif
+
+    	_elapsedTimeInMicroSec = endTimeInMicroSec - startTimeInMicroSec;		
+	}
+
+    return _elapsedTimeInMicroSec;
+}
+
+double Timer::elapsed_time_in_ms()
+{
+    return this->elapsed_time_in_us() * 0.001;
+}
+
+double Timer::elapsed_time_in_sec()
+{
+    return this->elapsed_time_in_us() * 0.000001;
+}
+
+double Timer::elapsed_time()
+{
+    return this->elapsed_time_in_sec();
+}
+
+
+}	// namespace
+

File temp/test_hordefiles/engine_timer.h

+#pragma once
+
+#include "utPlatform.h"
+
+#ifndef PLATFORM_WIN
+    #include <sys/time.h>
+#endif
+
+
+namespace Horde3D {
+
+class Timer
+{
+public:
+
+    Timer();
+    
+    void start();
+    void set_enabled( bool flag );
+    void reset();
+    
+    // get timing
+    double get_current_time_in_us();
+
+    double get_elapsed_time_in_sec();
+    double get_elapsed_time_in_ms();
+    double get_elapsed_time_in_us();
+
+    // member variables
+    bool           _enabled;
+    double         _startTime;
+    double         _elapsedTime;
+
+#ifdef PLATFORM_WIN
+    LARGE_INTEGER  _timerFreq;
+#endif
+
+};
+
+
+
+///////////////////////////////////////////////////////////////////////////////
+//  class implementation
+///////////////////////////////////////////////////////////////////////////////
+
+Timer::Timer() 
+: _elapsedTime( 0 ), _enabled( false )
+{
+#if defined( PLATFORM_WIN ) 
+    // Get timer frequency
+    QueryPerformanceFrequency( &_timerFreq );
+#endif
+}
+    
+
+void Timer::start()
+{
+    _elapsedTime = 0;
+    _enabled = true;
+    _startTime = get_current_time_in_us();
+}
+
+void Timer::set_enabled( bool flag )
+{   
+    if( flag && !_enabled )
+    {
+        _startTime = get_current_time_in_us();
+        _enabled = true;
+    }
+    else if( !flag && _enabled )
+    {
+        double endTime = get_current_time_in_us();
+        _elapsedTime += endTime - _startTime;
+        _enabled = false;
+    }
+}
+
+
+void Timer::reset()
+{
+    _elapsedTime = 0;
+    if( _enabled ) _startTime = get_current_time_in_us();
+}
+    
+
+double Timer::get_elapsed_time_in_sec()
+{
+    return get_elapsed_time_in_us() * 0.000001;
+}
+
+
+double Timer::get_elapsed_time_in_ms()
+{
+    return get_elapsed_time_in_us() * 0.001;
+}
+
+
+double Timer::get_elapsed_time_in_us()
+{
+    if( _enabled )
+    {
+        double endTime = get_current_time_in_us();
+        _elapsedTime += endTime - _startTime;
+        _startTime = endTime;
+    }
+
+    return _elapsedTime;
+}
+
+
+double Timer::get_current_time_in_us()
+{
+#if defined( PLATFORM_WIN ) || defined( PLATFORM_WIN_CE )
+    // Read high performance counter
+    LARGE_INTEGER curTick;
+    QueryPerformanceCounter( &curTick );
+    return (double)curTick.QuadPart / (double)_timerFreq.QuadPart * 1000000.0;
+#else
+    timeval tv;
+    gettimeofday( &tv, 0x0 );
+    return (double)tv.tv_sec * 1000000.0 + (double)tv.tv_usec / 1000000.0;
+#endif
+}
+
+
+
+} // namespace
+

File temp/test_hordefiles/utTimer.h

-// *************************************************************************************************
-//
-// Horde3D
-//   Next-Generation Graphics Engine
-// --------------------------------------
-// Copyright (C) 2006-2011 Nicolas Schulz
-//
-// This software is distributed under the terms of the Eclipse Public License v1.0.
-// A copy of the license may be obtained at: http://www.eclipse.org/legal/epl-v10.html
-//
-// *************************************************************************************************
-
-#ifndef _utTimer_H_
-#define _utTimer_H_
-
-#include "utPlatform.h"
-
-#if defined( PLATFORM_WIN ) || defined( PLATFORM_WIN_CE )
-#   define WIN32_LEAN_AND_MEAN
-#	ifndef NOMINMAX
-#		define NOMINMAX
-#	endif
-#   include <windows.h>
-#else
-#	include <sys/time.h>
-#endif
-
-
-namespace Horde3D {
-
-class Timer
-{
-public:
-
-	Timer() : _elapsedTime( 0 ), _enabled( false )
-	{
-	#if defined( PLATFORM_WIN ) 
-		// Find first available CPU
-		DWORD_PTR procMask, sysMask;
-		GetProcessAffinityMask( GetCurrentProcess(), &procMask, &sysMask );
-		_affMask = 1;
-		while( (_affMask & procMask) == 0 ) _affMask <<= 1;
-		
-		// Get timer frequency
-		DWORD_PTR threadAffMask = SetThreadAffinityMask( GetCurrentThread(), _affMask );
-		QueryPerformanceFrequency( &_timerFreq );
-		SetThreadAffinityMask( GetCurrentThread(), threadAffMask );
-	#elif defined( PLATFORM_WIN_CE )
-		QueryPerformanceFrequency( &_timerFreq );
-	#endif
-	}
-	
-	void setEnabled( bool enabled )
-	{	
-		if( enabled && !_enabled )
-		{
-			_startTime = getTime();
-			_enabled = true;
-		}
-		else if( !enabled && _enabled )
-		{
-			double endTime = getTime();
-			_elapsedTime += endTime - _startTime;
-			_enabled = false;
-		}
-	}
-
-	void reset()
-	{
-		_elapsedTime = 0;
-		if( _enabled ) _startTime = getTime();
-	}
-	
-	float getElapsedTimeMS()
-	{
-		if( _enabled )
-		{
-			double endTime = getTime();
-			_elapsedTime += endTime - _startTime;
-			_startTime = endTime;
-		}
-
-		return (float)_elapsedTime;
-	}
-
-protected:
-
-	double getTime()
-	{
-	#if defined( PLATFORM_WIN ) || defined( PLATFORM_WIN_CE )
-		// Make sure that time is read from the same CPU
-		DWORD_PTR threadAffMask = SetThreadAffinityMask( GetCurrentThread(), _affMask );
-		
-		// Read high performance counter
-		LARGE_INTEGER curTick;
-		QueryPerformanceCounter( &curTick );
-
-		// Restore affinity mask
-		SetThreadAffinityMask( GetCurrentThread(), threadAffMask );
-
-		return (double)curTick.QuadPart / (double)_timerFreq.QuadPart * 1000.0;
-	#else
-		timeval tv;
-		gettimeofday( &tv, 0x0 );
-		return (double)tv.tv_sec * 1000.0 + (double)tv.tv_usec / 1000.0;
-	#endif
-	}
-
-protected:
-
-	double         _startTime;
-	double         _elapsedTime;
-
-#if defined( PLATFORM_WIN ) || defined( PLATFORM_WIN_CE )
-	LARGE_INTEGER  _timerFreq;
-	DWORD_PTR      _affMask;
-#endif
-
-	bool           _enabled;
-};
-
-}
-#endif  // _utTimer_H_