Files
source/VFS/Profiler/Prof.h
T
Wanne 47db604b50 *** Merged Code from Multiplayer Branch Revision 2960 ***
- Virtual File System (VFS) by birdflu. This is needed for Multiplayer and is also used for Single Player. Very neat system :-)
- Multiplayer Version 1.1 + some additional features and bugfixes
* INFO: If you compile a new EXE and want to test, be sure to also use the latest SVN GameDir files in your JA2 install directory *




git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2961 3b4a5df2-a311-0410-b5c6-a8a6f20db521
2009-06-04 21:01:45 +00:00

59 lines
1.3 KiB
C++

#ifndef _PROF_H_
#define _PROF_H_
#include "HPTimer.h"
#include "../vfs_types.h"
#include <string>
#include <vector>
#define DO_PROFILE 1
#if DO_PROFILE
#define REGISTERMARKER(id,name) static CProf::tMarkerID id = g_Profiler->RegisterMarker(name)
#define STARTMARKER(id) (g_Profiler->StartMarker(id))
#define STOPMARKER(id,success) (g_Profiler->StopMarker(id,success))
#define DUMPPROFILERSTATSTOFILE(file) if(g_Profiler){g_Profiler->PrintProfilerState(file);}
#else
#define REGISTERMARKER(id,name)
#define STARTMARKER(id)
#define STOPMARKER(id,success)
#define DUMPPROFILERSTATSTOFILE(file)
#endif
class CProf
{
public:
typedef unsigned int tMarkerID;
static CProf* GetProf();
void Clear();
tMarkerID RegisterMarker(const char *marker);
void StartMarker(tMarkerID id);
void StopMarker(tMarkerID id, bool success);
bool PrintProfilerState(vfs::Path const& file);
private:
CProf();
struct MARKER
{
MARKER() : call_count(0), success_count(0), fail_count(0), time(0.0) {};
std::string markername;
long double time;
unsigned long call_count;
unsigned long success_count;
unsigned long fail_count;
CHPTimer timer;
};
std::vector<MARKER> m_vMarker;
unsigned int _nextMarker;
};
extern CProf* g_Profiler;
#endif // _PROF_H_