let us set the size of the heap in a sane way
[c11tester.git] / snapshot.cc
index b0b49d405c896681edbfd852847851746737ed50..b848d024c4eab7a0efe39f6f9693c680bdae3aa6 100644 (file)
@@ -31,11 +31,11 @@ void BeginOperation( struct timeval * theStartTime ){
        gettimeofday( theStartTime, NULL );
 #endif
 }
-#if DEBUG
+#if SSDEBUG
 struct timeval *starttime = NULL;
 #endif
 void DumpIntoLog( const char * filename, const char * message ){
-#if DEBUG
+#if SSDEBUG
    static pid_t thePID = getpid();
    char newFn[ 1024 ] ={ 0 };
    sprintf( newFn,"%s-%d.txt", filename, thePID );
@@ -123,7 +123,7 @@ void createSharedLibrary(){
 #ifdef __cplusplus
 }
 #endif
-void initSnapShotLibrary(unsigned int numbackingpages, unsigned int numsnapshots, unsigned int nummemoryregions , MyFuncPtr entryPoint){
+void initSnapShotLibrary(unsigned int numbackingpages, unsigned int numsnapshots, unsigned int nummemoryregions, unsigned int numheappages, MyFuncPtr entryPoint){
 #if USE_CHECKPOINTING
   struct sigaction sa;
   sa.sa_flags = SA_SIGINFO | SA_NODEFER | SA_RESTART;
@@ -134,6 +134,8 @@ void initSnapShotLibrary(unsigned int numbackingpages, unsigned int numsnapshots
     exit(-1);
   }
   initSnapShotRecord(numbackingpages, numsnapshots, nummemoryregions);
+  mySpace = create_mspace( numheappages*PAGESIZE, 1 );
+  addMemoryRegionToSnapShot(mySpace, numheappages);
   entryPoint();
 #else
   //add a signal to indicate that the process is going to terminate.
@@ -146,7 +148,7 @@ void initSnapShotLibrary(unsigned int numbackingpages, unsigned int numsnapshots
     exit(-1);
   }
   createSharedLibrary();
- #if DEBUG
+ #if SSDEBUG
   starttime = &(sTheRecord->startTimeGlobal);
   gettimeofday( starttime, NULL );
 #endif
@@ -187,7 +189,7 @@ void initSnapShotLibrary(unsigned int numbackingpages, unsigned int numsnapshots
     } else {
       int status;
       int retVal;
-#if DEBUG
+#if SSDEBUG
       char mesg[ 1024 ] = { 0 };
       sprintf( mesg, "The process id of child is %d and the process id of this process is %d and snapshot id is %d", forkedID, getpid(), snapshotid );
       DumpIntoLog( "ModelSnapshot", mesg );
@@ -271,7 +273,7 @@ void rollBack( snapshot_id theID ){
   getcontext( &sTheRecord->mContextToRollback );
   if( !sTemp ){
     sTemp = 1;
-#if DEBUG
+#if SSDEBUG
        DumpIntoLog( "ModelSnapshot", "Invoked rollback" ); 
 #endif
        exit( 0 );