add Checkpoint
This commit is contained in:
@@ -233,3 +233,19 @@ void RageLog::UnmapLog(const CString &key)
|
||||
{
|
||||
LogMaps.erase(key);
|
||||
}
|
||||
|
||||
Checkpoint_::Checkpoint_(CString key_, int n, CString fmt, ...)
|
||||
{
|
||||
key = ssprintf("%s:%i", key_.c_str(), n);
|
||||
|
||||
va_list va;
|
||||
va_start(va, fmt);
|
||||
LOG->MapLog( key, vssprintf(fmt, va) );
|
||||
va_end(va);
|
||||
}
|
||||
|
||||
Checkpoint_::~Checkpoint_()
|
||||
{
|
||||
LOG->UnmapLog( key );
|
||||
}
|
||||
|
||||
|
||||
+10
-1
@@ -37,6 +37,15 @@ private:
|
||||
void UpdateMappedLog();
|
||||
};
|
||||
|
||||
extern RageLog* LOG; // global and accessable from anywhere in our program
|
||||
/* Mapped log entry that's deleted on dtor. Note that this isn't extremely
|
||||
* fast (like VDCHECKPOINT); don't use it in inner loops. */
|
||||
struct Checkpoint_
|
||||
{
|
||||
CString key;
|
||||
Checkpoint_(CString key, int n, CString fmt, ...);
|
||||
~Checkpoint_();
|
||||
};
|
||||
#define Checkpoint(t) Checkpoint_ CP_( __FUNCTION__, __LINE__, t )
|
||||
|
||||
extern RageLog* LOG; // global and accessable from anywhere in our program
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user