view 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
line source
1 /*
2 * Copyright 2010 OpenSourceStewardshipFoundation
3 *
4 * Licensed under BSD
5 */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include <malloc.h>
11 #include "VMS.h"
12 #include "Queue_impl/BlockingQueue.h"
13 #include "Histogram/Histogram.h"
16 #define thdAttrs NULL
18 //===========================================================================
19 void
20 shutdownFn( void *dummy, VirtProcr *dummy2 );
22 SchedSlot **
23 create_sched_slots();
25 void
26 create_masterEnv();
28 void
29 create_the_coreLoop_OS_threads();
31 pthread_mutex_t suspendLock = PTHREAD_MUTEX_INITIALIZER;
32 pthread_cond_t suspend_cond = PTHREAD_COND_INITIALIZER;
34 //===========================================================================
36 /*Setup has two phases:
37 * 1) Semantic layer first calls init_VMS, which creates masterEnv, and puts
38 * the master virt procr into the work-queue, ready for first "call"
39 * 2) Semantic layer then does its own init, which creates the seed virt
40 * procr inside the semantic layer, ready to schedule it when
41 * asked by the first run of the masterLoop.
42 *
43 *This part is bit weird because VMS really wants to be "always there", and
44 * have applications attach and detach.. for now, this VMS is part of
45 * the app, so the VMS system starts up as part of running the app.
46 *
47 *The semantic layer is isolated from the VMS internals by making the
48 * semantic layer do setup to a state that it's ready with its
49 * initial virt procrs, ready to schedule them to slots when the masterLoop
50 * asks. Without this pattern, the semantic layer's setup would
51 * have to modify slots directly to assign the initial virt-procrs, and put
52 * them into the readyToAnimateQ itself, breaking the isolation completely.
53 *
54 *
55 *The semantic layer creates the initial virt procr(s), and adds its
56 * own environment to masterEnv, and fills in the pointers to
57 * the requestHandler and slaveScheduler plug-in functions
58 */
60 /*This allocates VMS data structures, populates the master VMSProc,
61 * and master environment, and returns the master environment to the semantic
62 * layer.
63 */
64 void
65 VMS__init()
66 {
67 create_masterEnv();
68 create_the_coreLoop_OS_threads();
69 }
71 /*To initialize the sequential version, just don't create the threads
72 */
73 void
74 VMS__init_Seq()
75 {
76 create_masterEnv();
77 }
79 void
80 create_masterEnv()
81 { MasterEnv *masterEnv;
82 SRSWQueueStruc **readyToAnimateQs;
83 int coreIdx;
84 VirtProcr **masterVPs;
85 SchedSlot ***allSchedSlots; //ptr to array of ptrs
87 //Make the master env, which holds everything else
88 _VMSMasterEnv = malloc( sizeof(MasterEnv) );
89 masterEnv = _VMSMasterEnv;
90 //Need to set start pt here 'cause used by seed procr, which is created
91 // before the first core loop starts up. -- not sure how yet..
92 // masterEnv->coreLoopStartPt = ;
93 // masterEnv->coreLoopEndPt = ;
95 //Make a readyToAnimateQ for each core loop
96 readyToAnimateQs = malloc( NUM_CORES * sizeof(SRSWQueueStruc *) );
97 masterVPs = malloc( NUM_CORES * sizeof(VirtProcr *) );
99 //One array for each core, 3 in array, core's masterVP scheds all
100 allSchedSlots = malloc( NUM_CORES * sizeof(SchedSlot *) );
102 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
103 {
104 readyToAnimateQs[ coreIdx ] = makeSRSWQ();
106 //Q: should give masterVP core-specific into as its init data?
107 masterVPs[ coreIdx ] = VMS__create_procr( &masterLoop, masterEnv );
108 masterVPs[ coreIdx ]->coreAnimatedBy = coreIdx;
109 allSchedSlots[ coreIdx ] = create_sched_slots(); //makes for one core
110 }
111 _VMSMasterEnv->readyToAnimateQs = readyToAnimateQs;
112 _VMSMasterEnv->masterVPs = masterVPs;
113 _VMSMasterEnv->allSchedSlots = allSchedSlots;
117 //Aug 19, 2010: no longer need to place initial masterVP into queue
118 // because coreLoop now controls -- animates its masterVP when no work
121 //==================== malloc substitute ========================
122 //
123 //Testing whether malloc is using thread-local storage and therefore
124 // causing unreliable behavior.
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
127 // in the master, taking from this massive chunk.
129 // initFreeList();
131 }
133 /*
134 void
135 initMasterMalloc()
136 {
137 _VMSMasterEnv->mallocChunk = malloc( MASSIVE_MALLOC_SIZE );
139 //The free-list element is the first several locations of an
140 // allocated chunk -- the address given to the application is pre-
141 // pended with both the ownership structure and the free-list struc.
142 //So, write the values of these into the first locations of
143 // mallocChunk -- which marks it as free & puts in its size.
144 listElem = (FreeListElem *)_VMSMasterEnv->mallocChunk;
145 listElem->size = MASSIVE_MALLOC_SIZE - NUM_PREPEND_BYTES
146 listElem->next = NULL;
147 }
149 void
150 dissipateMasterMalloc()
151 {
152 //Just foo code -- to get going -- doing as if free list were link-list
153 currElem = _VMSMasterEnv->freeList;
154 while( currElem != NULL )
155 {
156 nextElem = currElem->next;
157 masterFree( currElem );
158 currElem = nextElem;
159 }
160 free( _VMSMasterEnv->freeList );
161 }
162 */
164 SchedSlot **
165 create_sched_slots()
166 { SchedSlot **schedSlots;
167 int i;
169 schedSlots = malloc( NUM_SCHED_SLOTS * sizeof(SchedSlot *) );
171 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
172 {
173 schedSlots[i] = malloc( sizeof(SchedSlot) );
175 //Set state to mean "handling requests done, slot needs filling"
176 schedSlots[i]->workIsDone = FALSE;
177 schedSlots[i]->needsProcrAssigned = TRUE;
178 }
179 return schedSlots;
180 }
183 void
184 freeSchedSlots( SchedSlot **schedSlots )
185 { int i;
186 for( i = 0; i < NUM_SCHED_SLOTS; i++ )
187 {
188 free( schedSlots[i] );
189 }
190 free( schedSlots );
191 }
194 void
195 create_the_coreLoop_OS_threads()
196 {
197 //========================================================================
198 // Create the Threads
199 int coreIdx, retCode;
201 //Need the threads to be created suspended, and wait for a signal
202 // before proceeding -- gives time after creating to initialize other
203 // stuff before the coreLoops set off.
204 _VMSMasterEnv->setupComplete = 0;
206 //Make the threads that animate the core loops
207 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
208 { coreLoopThdParams[coreIdx] = malloc( sizeof(ThdParams) );
209 coreLoopThdParams[coreIdx]->coreNum = coreIdx;
211 retCode =
212 pthread_create( &(coreLoopThdHandles[coreIdx]),
213 thdAttrs,
214 &coreLoop,
215 (void *)(coreLoopThdParams[coreIdx]) );
216 if(retCode){printf("ERROR creating thread: %d\n", retCode); exit(0);}
217 }
218 }
220 /*Semantic layer calls this when it want the system to start running..
221 *
222 *This starts the core loops running then waits for them to exit.
223 */
224 void
225 VMS__start_the_work_then_wait_until_done()
226 { int coreIdx;
227 //Start the core loops running
228 //===========================================================================
229 TSCount startCount, endCount;
230 unsigned long long count = 0, freq = 0;
231 double runTime;
233 startCount = getTSCount();
235 //tell the core loop threads that setup is complete
236 //get lock, to lock out any threads still starting up -- they'll see
237 // that setupComplete is true before entering while loop, and so never
238 // wait on the condition
239 pthread_mutex_lock( &suspendLock );
240 _VMSMasterEnv->setupComplete = 1;
241 pthread_mutex_unlock( &suspendLock );
242 pthread_cond_broadcast( &suspend_cond );
245 //wait for all to complete
246 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
247 {
248 pthread_join( coreLoopThdHandles[coreIdx], NULL );
249 }
251 //NOTE: do not clean up VMS env here -- semantic layer has to have
252 // a chance to clean up its environment first, then do a call to free
253 // the Master env and rest of VMS locations
256 endCount = getTSCount();
257 count = endCount - startCount;
259 runTime = (double)count / (double)TSCOUNT_FREQ;
261 printf("\n Time startup to shutdown: %f\n", runTime); fflush( stdin );
262 }
264 /*Only difference between version with an OS thread pinned to each core and
265 * the sequential version of VMS is VMS__init_Seq, this, and coreLoop_Seq.
266 */
267 void
268 VMS__start_the_work_then_wait_until_done_Seq()
269 {
270 //Instead of un-suspending threads, just call the one and only
271 // core loop (sequential version), in the main thread.
272 coreLoop_Seq( NULL );
274 }
278 /*Create stack, then create __cdecl structure on it and put initialData and
279 * pointer to the new structure instance into the parameter positions on
280 * the stack
281 *Then put function pointer into nextInstrPt -- the stack is setup in std
282 * call structure, so jumping to function ptr is same as a GCC generated
283 * function call
284 *No need to save registers on old stack frame, because there's no old
285 * animator state to return to --
286 *
287 */
288 VirtProcr *
289 VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData )
290 { VirtProcr *newPr;
291 char *stackLocs, *stackPtr;
293 newPr = malloc( sizeof(VirtProcr) );
294 newPr->procrID = numProcrsCreated++;
295 newPr->nextInstrPt = fnPtr;
296 newPr->initialData = initialData;
297 newPr->requests = NULL;
298 newPr->schedSlot = NULL;
299 // newPr->coreLoopStartPt = _VMSMasterEnv->coreLoopStartPt;
301 //fnPtr takes two params -- void *initData & void *animProcr
302 //alloc stack locations, make stackPtr be the highest addr minus room
303 // for 2 params + return addr. Return addr (NULL) is in loc pointed to
304 // by stackPtr, initData at stackPtr + 4 bytes, animatingPr just above
305 stackLocs = malloc( VIRT_PROCR_STACK_SIZE );
306 if(stackLocs == 0)
307 {perror("malloc stack"); exit(1);}
308 newPr->startOfStack = stackLocs;
309 stackPtr = ( (char *)stackLocs + VIRT_PROCR_STACK_SIZE - 0x10 );
310 //setup __cdecl on stack -- coreloop will switch to stackPtr before jmp
311 *( (int *)stackPtr + 2 ) = (int) newPr; //rightmost param -- 32bit pointer
312 *( (int *)stackPtr + 1 ) = (int) initialData; //next param to left
313 newPr->stackPtr = stackPtr; //core loop will switch to this, then
314 newPr->framePtr = stackPtr; //suspend loop will save new stack & frame ptr
316 return newPr;
317 }
320 /*there is a label inside this function -- save the addr of this label in
321 * the callingPr struc, as the pick-up point from which to start the next
322 * work-unit for that procr. If turns out have to save registers, then
323 * save them in the procr struc too. Then do assembly jump to the CoreLoop's
324 * "done with work-unit" label. The procr struc is in the request in the
325 * slave that animated the just-ended work-unit, so all the state is saved
326 * there, and will get passed along, inside the request handler, to the
327 * next work-unit for that procr.
328 */
329 void
330 VMS__suspend_procr( VirtProcr *animatingPr )
331 { void *jmpPt, *stackPtrAddr, *framePtrAddr, *coreLoopStackPtr;
332 void *coreLoopFramePtr;
334 //The request to master will cause this suspended virt procr to get
335 // scheduled again at some future point -- to resume, core loop jumps
336 // to the resume point (below), which causes restore of saved regs and
337 // "return" from this call.
338 animatingPr->nextInstrPt = &&ResumePt;
340 //return ownership of the virt procr and sched slot to Master virt pr
341 animatingPr->schedSlot->workIsDone = TRUE;
342 // coreIdx = callingPr->coreAnimatedBy;
344 stackPtrAddr = &(animatingPr->stackPtr);
345 framePtrAddr = &(animatingPr->framePtr);
347 jmpPt = _VMSMasterEnv->coreLoopStartPt;
348 coreLoopFramePtr = animatingPr->coreLoopFramePtr;//need this only
349 coreLoopStackPtr = animatingPr->coreLoopStackPtr;//safety
351 //Save the virt procr's stack and frame ptrs,
352 asm volatile("movl %0, %%eax; \
353 movl %%esp, (%%eax); \
354 movl %1, %%eax; \
355 movl %%ebp, (%%eax) "\
356 /* outputs */ : "=g" (stackPtrAddr), "=g" (framePtrAddr) \
357 /* inputs */ : \
358 /* clobber */ : "%eax" \
359 );
361 //=========================== Measurement stuff ========================
362 #ifdef MEAS__TIME_STAMP_SUSP
363 //record time stamp: compare to time-stamp recorded below
364 saveLowTimeStampCountInto( animatingPr->preSuspTSCLow );
365 #endif
366 //=======================================================================
368 //restore coreloop's frame ptr, then jump back to "start" of core loop
369 //Note, GCC compiles to assembly that saves esp and ebp in the stack
370 // frame -- so have to explicitly do assembly that saves to memory
371 asm volatile("movl %0, %%eax; \
372 movl %1, %%esp; \
373 movl %2, %%ebp; \
374 jmp %%eax " \
375 /* outputs */ : \
376 /* inputs */ : "m" (jmpPt), "m"(coreLoopStackPtr), "m"(coreLoopFramePtr)\
377 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
378 ); //list everything as clobbered to force GCC to save all
379 // live vars that are in regs on stack before this
380 // assembly, so that stack pointer is correct, before jmp
382 ResumePt:
383 #ifdef MEAS__TIME_STAMP_SUSP
384 //NOTE: only take low part of count -- do sanity check when take diff
385 saveLowTimeStampCountInto( animatingPr->postSuspTSCLow );
386 #endif
388 return;
389 }
394 /*
395 *This adds a request to dissipate, then suspends the processor so that the
396 * request handler will receive the request. The request handler is what
397 * does the work of freeing memory and removing the processor from the
398 * semantic environment's data structures.
399 *The request handler also is what figures out when to shutdown the VMS
400 * system -- which causes all the core loop threads to die, and returns from
401 * the call that started up VMS to perform the work.
402 *
403 *This form is a bit misleading to understand if one is trying to figure out
404 * how VMS works -- it looks like a normal function call, but inside it
405 * sends a request to the request handler and suspends the processor, which
406 * jumps out of the VMS__dissipate_procr function, and out of all nestings
407 * above it, transferring the work of dissipating to the request handler,
408 * which then does the actual work -- causing the processor that animated
409 * the call of this function to disappear and the "hanging" state of this
410 * function to just poof into thin air -- the virtual processor's trace
411 * never returns from this call, but instead the virtual processor's trace
412 * gets suspended in this call and all the virt processor's state disap-
413 * pears -- making that suspend the last thing in the virt procr's trace.
414 */
415 void
416 VMS__dissipate_procr( VirtProcr *procrToDissipate )
417 { VMSReqst *req;
419 req = malloc( sizeof(VMSReqst) );
420 // req->virtProcrFrom = callingPr;
421 req->reqType = dissipate;
422 req->nextReqst = procrToDissipate->requests;
423 procrToDissipate->requests = req;
425 VMS__suspend_procr( procrToDissipate );
426 }
429 /*This inserts the semantic-layer's request data into standard VMS carrier
430 */
431 inline void
432 VMS__add_sem_request( void *semReqData, VirtProcr *callingPr )
433 { VMSReqst *req;
435 req = malloc( sizeof(VMSReqst) );
436 // req->virtProcrFrom = callingPr;
437 req->reqType = semantic;
438 req->semReqData = semReqData;
439 req->nextReqst = callingPr->requests;
440 callingPr->requests = req;
441 }
444 /*Use this to get first request before starting request handler's loop
445 */
446 VMSReqst *
447 VMS__take_top_request_from( VirtProcr *procrWithReq )
448 { VMSReqst *req;
450 req = procrWithReq->requests;
451 if( req == NULL ) return req;
453 procrWithReq->requests = procrWithReq->requests->nextReqst;
454 return req;
455 }
457 /*A subtle bug due to freeing then accessing "next" after freed caused this
458 * form of call to be put in -- so call this at end of request handler loop
459 * that iterates through the requests.
460 */
461 VMSReqst *
462 VMS__free_top_and_give_next_request_from( VirtProcr *procrWithReq )
463 { VMSReqst *req;
465 req = procrWithReq->requests;
466 if( req == NULL ) return NULL;
468 procrWithReq->requests = procrWithReq->requests->nextReqst;
469 VMS__free_request( req );
470 return procrWithReq->requests;
471 }
474 //TODO: add a semantic-layer supplied "freer" for the semantic-data portion
475 // of a request -- IE call with both a virt procr and a fn-ptr to request
476 // freer (also maybe put sem request freer as a field in virt procr?)
477 //MeasVMS relies right now on this only freeing VMS layer of request -- the
478 // semantic portion of request is alloc'd and freed by request handler
479 void
480 VMS__free_request( VMSReqst *req )
481 {
482 free( req );
483 }
487 inline int
488 VMS__isSemanticReqst( VMSReqst *req )
489 {
490 return ( req->reqType == semantic );
491 }
494 inline void *
495 VMS__take_sem_reqst_from( VMSReqst *req )
496 {
497 return req->semReqData;
498 }
500 inline int
501 VMS__isDissipateReqst( VMSReqst *req )
502 {
503 return ( req->reqType == dissipate );
504 }
506 inline int
507 VMS__isCreateReqst( VMSReqst *req )
508 {
509 return ( req->reqType == regCreated );
510 }
512 void
513 VMS__send_req_to_register_new_procr(VirtProcr *newPr, VirtProcr *reqstingPr)
514 { VMSReqst *req;
516 req = malloc( sizeof(VMSReqst) );
517 req->reqType = regCreated;
518 req->semReqData = newPr;
519 req->nextReqst = reqstingPr->requests;
520 reqstingPr->requests = req;
522 VMS__suspend_procr( reqstingPr );
523 }
527 /*This must be called by the request handler plugin -- it cannot be called
528 * from the semantic library "dissipate processor" function -- instead, the
529 * semantic layer has to generate a request for the plug-in to call this
530 * function.
531 *The reason is that this frees the virtual processor's stack -- which is
532 * still in use inside semantic library calls!
533 *
534 *This frees or recycles all the state owned by and comprising the VMS
535 * portion of the animating virtual procr. The request handler must first
536 * free any semantic data created for the processor that didn't use the
537 * VMS_malloc mechanism. Then it calls this, which first asks the malloc
538 * system to disown any state that did use VMS_malloc, and then frees the
539 * statck and the processor-struct itself.
540 *If the dissipated processor is the sole (remaining) owner of VMS__malloc'd
541 * state, then that state gets freed (or sent to recycling) as a side-effect
542 * of dis-owning it.
543 */
544 void
545 VMS__handle_dissipate_reqst( VirtProcr *animatingPr )
546 {
547 //dis-own all locations owned by this processor, causing to be freed
548 // any locations that it is (was) sole owner of
549 //TODO: implement VMS__malloc system, including "give up ownership"
551 //The dissipate request might still be attached, so remove and free it
552 VMS__free_top_and_give_next_request_from( animatingPr );
554 //NOTE: initialData was given to the processor, so should either have
555 // been alloc'd with VMS__malloc, or freed by the level above animPr.
556 //So, all that's left to free here is the stack and the VirtProcr struc
557 // itself
558 free( animatingPr->startOfStack );
559 free( animatingPr );
560 }
563 //TODO: re-architect so that have clean separation between request handler
564 // and master loop, for dissipate, create, shutdown, and other non-semantic
565 // requests. Issue is chain: one removes requests from AppVP, one dispatches
566 // on type of request, and one handles each type.. but some types require
567 // action from both request handler and master loop -- maybe just give the
568 // request handler calls like: VMS__handle_X_request_type
570 void
571 endOSThreadFn( void *initData, VirtProcr *animatingPr );
573 /*This is called by the semantic layer's request handler when it decides its
574 * time to shut down the VMS system. Calling this causes the core loop OS
575 * threads to exit, which unblocks the entry-point function that started up
576 * VMS, and allows it to grab the result and return to the original single-
577 * threaded application.
578 *
579 *The _VMSMasterEnv is needed by this shut down function, so the create-seed-
580 * and-wait function has to free a bunch of stuff after it detects the
581 * threads have all died: the masterEnv, the thread-related locations,
582 * masterVP any AppVPs that might still be allocated and sitting in the
583 * semantic environment, or have been orphaned in the _VMSWorkQ.
584 *
585 *NOTE: the semantic plug-in is expected to use VMS__malloc_to to get all the
586 * locations it needs, and give ownership to masterVP. Then, they will be
587 * automatically freed when the masterVP is dissipated. (This happens after
588 * the core loop threads have all exited)
589 *
590 *In here,create one core-loop shut-down processor for each core loop and put
591 * them all directly into the readyToAnimateQ.
592 *Note, this function can ONLY be called after the semantic environment no
593 * longer cares if AppVPs get animated after the point this is called. In
594 * other words, this can be used as an abort, or else it should only be
595 * called when all AppVPs have finished dissipate requests -- only at that
596 * point is it sure that all results have completed.
597 */
598 void
599 VMS__handle_shutdown_reqst( void *dummy, VirtProcr *animatingPr )
600 { int coreIdx;
601 VirtProcr *shutDownPr;
603 //create the shutdown processors, one for each core loop -- put them
604 // directly into the Q -- each core will die when gets one
605 for( coreIdx=0; coreIdx < NUM_CORES; coreIdx++ )
606 {
607 shutDownPr = VMS__create_procr( &endOSThreadFn, NULL );
608 writeSRSWQ( shutDownPr, _VMSMasterEnv->readyToAnimateQs[coreIdx] );
609 }
611 }
614 /*Am trying to be cute, avoiding IF statement in coreLoop that checks for
615 * a special shutdown procr. Ended up with extra-complex shutdown sequence.
616 *This function has the sole purpose of setting the stack and framePtr
617 * to the coreLoop's stack and framePtr.. it does that then jumps to the
618 * core loop's shutdown point -- might be able to just call Pthread_exit
619 * from here, but am going back to the pthread's stack and setting everything
620 * up just as if it never jumped out, before calling pthread_exit.
621 *The end-point of core loop will free the stack and so forth of the
622 * processor that animates this function, (this fn is transfering the
623 * animator of the AppVP that is in turn animating this function over
624 * to core loop function -- note that this slices out a level of virtual
625 * processors).
626 */
627 void
628 endOSThreadFn( void *initData, VirtProcr *animatingPr )
629 { void *jmpPt, *coreLoopStackPtr, *coreLoopFramePtr;
631 jmpPt = _VMSMasterEnv->coreLoopEndPt;
632 coreLoopStackPtr = animatingPr->coreLoopStackPtr;
633 coreLoopFramePtr = animatingPr->coreLoopFramePtr;
636 asm volatile("movl %0, %%eax; \
637 movl %1, %%esp; \
638 movl %2, %%ebp; \
639 jmp %%eax " \
640 /* outputs */ : \
641 /* inputs */ : "m" (jmpPt), "m"(coreLoopStackPtr), "m"(coreLoopFramePtr)\
642 /* clobber */ : "memory", "%eax", "%ebx", "%ecx", "%edx", "%edi","%esi" \
643 );
644 }
647 /*This is called after the threads have shut down and control has returned
648 * to the semantic layer, in the entry point function in the main thread.
649 * It has to free anything allocated during VMS_init, and any other alloc'd
650 * locations that might be left over.
651 */
652 void
653 VMS__cleanup_after_shutdown()
654 {
655 SRSWQueueStruc **readyToAnimateQs;
656 int coreIdx;
657 VirtProcr **masterVPs;
658 SchedSlot ***allSchedSlots; //ptr to array of ptrs
660 readyToAnimateQs = _VMSMasterEnv->readyToAnimateQs;
661 masterVPs = _VMSMasterEnv->masterVPs;
662 allSchedSlots = _VMSMasterEnv->allSchedSlots;
664 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ )
665 {
666 freeSRSWQ( readyToAnimateQs[ coreIdx ] );
668 VMS__handle_dissipate_reqst( masterVPs[ coreIdx ] );
670 freeSchedSlots( allSchedSlots[ coreIdx ] );
671 }
673 free( _VMSMasterEnv->readyToAnimateQs );
674 free( _VMSMasterEnv->masterVPs );
675 free( _VMSMasterEnv->allSchedSlots );
677 free( _VMSMasterEnv );
678 }
681 //===========================================================================
683 inline TSCount getTSCount()
684 { unsigned int low, high;
685 TSCount out;
687 saveTimeStampCountInto( low, high );
688 out = high;
689 out = (out << 32) + low;
690 return out;
691 }