Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.c @ 41:cf3e9238aeb0
Measure suspend and master times works -- refactored
| author | Me |
|---|---|
| date | Sat, 11 Sep 2010 04:40:12 -0700 |
| parents | 1df8d7f2c9b1 |
| children | 72373405c816 8f7141a9272e |
comparison
equal
deleted
inserted
replaced
| 17:765ef4a5f6ed | 18:aa82127c7e20 |
|---|---|
| 125 //Just allocate a massive chunk of memory and roll own malloc/free and | 125 //Just allocate a massive chunk of memory and roll own malloc/free and |
| 126 // make app use VMS__malloc_to, which will suspend and perform malloc | 126 // make app use VMS__malloc_to, which will suspend and perform malloc |
| 127 // in the master, taking from this massive chunk. | 127 // in the master, taking from this massive chunk. |
| 128 | 128 |
| 129 // initFreeList(); | 129 // initFreeList(); |
| 130 | |
| 131 //============================= MEASUREMENT STUFF ======================== | |
| 132 #ifdef MEAS__TIME_STAMP_SUSP | |
| 133 //RDTSC may run out of order, and so measure a time-span different | |
| 134 // from the desired time-span -- got some weird changes in suspend | |
| 135 // hist when added Master hist | |
| 136 _VMSMasterEnv->measSuspHist = makeHistogram( 25, 110, 1300 ); | |
| 137 #endif | |
| 138 | |
| 139 #ifdef MEAS__TIME_MASTER | |
| 140 _VMSMasterEnv->measMasterHist = makeHistogram( 25, 500, 800 ); | |
| 141 #endif | |
| 142 //======================================================================== | |
| 143 | 130 |
| 144 } | 131 } |
| 145 | 132 |
| 146 /* | 133 /* |
| 147 void | 134 void |
| 369 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr) \ | 356 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr) \ |
| 370 /* inputs */ : \ | 357 /* inputs */ : \ |
| 371 /* clobber */ : "%eax" \ | 358 /* clobber */ : "%eax" \ |
| 372 ); | 359 ); |
| 373 | 360 |
| 361 //=========================== Measurement stuff ======================== | |
| 374 #ifdef MEAS__TIME_STAMP_SUSP | 362 #ifdef MEAS__TIME_STAMP_SUSP |
| 375 //record time stamp: compare to time-stamp recorded below, at resume | 363 //record time stamp: compare to time-stamp recorded below |
| 376 saveLowTimeStampCountInto( animatingPr->preSuspTSCLow ); | 364 saveLowTimeStampCountInto( animatingPr->preSuspTSCLow ); |
| 377 #endif | 365 #endif |
| 366 //======================================================================= | |
| 378 | 367 |
| 379 //restore coreloop's frame ptr, then jump back to "start" of core loop | 368 //restore coreloop's frame ptr, then jump back to "start" of core loop |
| 380 //Note, GCC compiles to assembly that saves esp and ebp in the stack | 369 //Note, GCC compiles to assembly that saves esp and ebp in the stack |
| 381 // frame -- so have to explicitly do assembly that saves to memory | 370 // frame -- so have to explicitly do assembly that saves to memory |
| 382 asm volatile("movl %0, %%eax; \ | 371 asm volatile("movl %0, %%eax; \ |
| 390 // live vars that are in regs on stack before this | 379 // live vars that are in regs on stack before this |
| 391 // assembly, so that stack pointer is correct, before jmp | 380 // assembly, so that stack pointer is correct, before jmp |
| 392 | 381 |
| 393 ResumePt: | 382 ResumePt: |
| 394 #ifdef MEAS__TIME_STAMP_SUSP | 383 #ifdef MEAS__TIME_STAMP_SUSP |
| 384 //NOTE: only take low part of count -- do sanity check when take diff | |
| 395 saveLowTimeStampCountInto( animatingPr->postSuspTSCLow ); | 385 saveLowTimeStampCountInto( animatingPr->postSuspTSCLow ); |
| 396 //Take difference between the pre-suspend and post-suspend times | |
| 397 // and do sanity check to see if rollover happened between | |
| 398 int diff = animatingPr->postSuspTSCLow - animatingPr->preSuspTSCLow; | |
| 399 if( diff > 1000000 ) diff = 0; | |
| 400 addToHist( diff, _VMSMasterEnv->measSuspHist ); | |
| 401 | |
| 402 #endif | 386 #endif |
| 403 | 387 |
| 404 return; | 388 return; |
| 405 } | 389 } |
| 406 | 390 |
