#ifndef _PROFILER_H_
#define _PROFILER_H_

#include <string>
#include "SDL.h"
#include "DebugUtil.h"

class Profiler
{
	public:
	Profiler(std::string name = "Generic Profile") : m_name(name), m_startTime(0), m_endTime(0) {}
	~Profiler() {}

	void Start() { m_startTime = SDL_GetTicks(); }
	void End() { m_endTime = SDL_GetTicks(); }

	void PrintResults() 
	{ 
		if(m_endTime != 0)
		{
			DebugUtil::outputDebugText("Profile results for \"%s\":\n", m_name.c_str());
			unsigned int totalTime = m_endTime - m_startTime;
			DebugUtil::outputDebugText("Total time: %d\n", totalTime);
		}
	}

	protected:
	std::string m_name;
	unsigned int m_startTime, m_endTime;
};

#endif
