add Checkpoint

This commit is contained in:
Glenn Maynard
2003-04-22 05:53:18 +00:00
parent 84cb834f26
commit a97df9c0de
2 changed files with 26 additions and 1 deletions
+16
View File
@@ -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
View File
@@ -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