Finalized Checkpointing, see t-eoCheckpointing for a test
This commit is contained in:
parent
6d5d34ba1f
commit
9bcf9d95f8
12 changed files with 558 additions and 11 deletions
36
eo/src/utils/eoUpdater.cpp
Normal file
36
eo/src/utils/eoUpdater.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4786)
|
||||
#endif
|
||||
|
||||
|
||||
#include <strstream>
|
||||
|
||||
#include <utils/eoState.h>
|
||||
#include <utils/eoUpdater.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
void eoTimedStateSaver::operator()(void)
|
||||
{
|
||||
time_t now = time(0);
|
||||
|
||||
if (now >= last_time + interval)
|
||||
{
|
||||
last_time = now;
|
||||
|
||||
ostrstream os;
|
||||
os << prefix << (now - first_time) << '.' << extension << ends;
|
||||
state.save(os.str());
|
||||
}
|
||||
}
|
||||
|
||||
void eoCountedStateSaver::operator()(void)
|
||||
{
|
||||
if (++counter % interval == 0)
|
||||
{
|
||||
ostrstream os;
|
||||
os << prefix << counter << '.' << extension << ends;
|
||||
state.save(os.str());
|
||||
}
|
||||
};
|
||||
|
||||
Reference in a new issue