//! start/stop the overall counting ov eps (don't write to logCount, //! just print to screen void TraceCounter::beginOverview() { DEBUGF(("%d/%d DEBUG: beginOverview\n", CmiMyPe(), CmiNumPes())); if ((genStart_=start_counters(counter1_->code, counter2_->code))<0) { CmiPrintf("genStart=%d counter1=%d counter2=%d\n", genStart_, counter1_->code, counter2_->code); CmiAbort("ERROR: start_counters() in beginOverview\n"); } startEP_=TraceTimer(); DEBUGF(("%d/%d DEBUG: beginOverview\n", CmiMyPe(), CmiNumPes())); dirty_ = true; }
//! begin/end execution of a Charm++ entry point //! NOTE: begin/endPack and begin/endUnpack can be called in between //! a beginExecute and its corresponding endExecute. void TraceCounter::beginExecute ( int event, int msgType, int ep, int srcPe, int mlen, CmiObjId *idx ) { DEBUGF(("%d/%d DEBUG: beginExecute EP %d\n", CmiMyPe(), CmiNumPes(), ep)); if (!traceOn_ || overview_) { return; } execEP_=ep; if (status_!= IDLE) { static bool print = true; if (print) { print = false; if (CmiMyPe()==0) { CmiPrintf("WARN: %d beginExecute called when status not IDLE!\n", CmiMyPe()); } } return; } else { status_=WORKING; } if ((genStart_=start_counters(counter1_->code, counter2_->code))<0) { CmiPrintf("genStart=%d counter1=%d counter2=%d\n", genStart_, counter1_->code, counter2_->code); CmiAbort("ERROR: start_counters() in beginExecute\n"); } startEP_=TraceTimer(); DEBUGF(("%d/%d DEBUG: beginExecute EP %d genStart %d\n", CmiMyPe(), CmiNumPes(), ep, genStart_)); }
/* * StartOS API call. * This service is called to start the operating system in a specific mode. */ void os_StartOS(AppModeType appmode) { os_ipl save_ipl; OS_SAVE_IPL(save_ipl); /* Save IPL on entry so can restore on exit, side-effect: assigns back to save_ipl */ ENTER_KERNEL_DIRECT(); /* Set IPL to kernel level while setting up OS variables etc. */ OS_API_TRACE_START_OS(); INIT_STACKCHECK_TO_OFF(); /* Make sure stack checking is turned off so that when/if dispatch() is called there are no stack errors * Note that this requires the kernel stack (i.e. main()'s stack) is big enough to support this call to * StartOS plus a call to dispatch() and the entry into the subsequent task */ #ifndef NDEBUG assert_initialized(); /* assert the C runtime startup has setup all vars to startup state */ #endif /* Saving a jmp_buf (os_startosenv) so that the entire OS can be terminated via a longjmp call inside a ShutdownOS call */ /* $Req: artf1216 artf1219 $ */ if (SETJMP(os_startosenv) == 0) { /* This half of the 'if' is the half that is the run-on continuation */ /* $Req: artf1214 artf1094 $ */ os_appmode = appmode; /* Store application mode in which the OS was started */ /* setup the tasks and alarms that are to be autostarted for the given app mode */ start_tasks(appmode); /* Initialize all counters in the system to start running */ start_counters(); /* Autostart alarms */ if(appmode->start_alarms_singleton) { appmode->start_alarms_singleton(appmode); } if(appmode->start_alarms_multi) { appmode->start_alarms_multi(appmode); } /* Autostarted schedule tables are autostarted implicitly by the underlying alarms being autostarted */ #ifdef STACK_CHECKING os_curtos = OS_KS_TOP; #endif /* Call startup hook if required to do so */ /* $Req: artf1215 $ */ if (os_flags.startuphook) { /* check if need to call the startuphook handler */ /* hook needs calling */ ENABLE_STACKCHECK(); /* enable stack checking */ /* @todo check that we really need to raise IPL to lock out all interrupts (both CAT1 and CAT2) within the hook */ OS_SET_IPL_MAX(); /* raise IPL to lock out all interrupts (both CAT1 and CAT2) within the hook */ MARK_OUT_KERNEL(); /* drop out of the kernel, keeping IPL at max level */ /* $Req: artf1117 $ */ StartupHook(); /* call the hook routine with IPL set to kernel level and stack checking on */ MARK_IN_KERNEL(); /* go back into the kernel */ OS_SET_IPL_KERNEL(); /* set IPL back to kernel level */ DISABLE_STACKCHECK(); /* disable stack checking */ } /* Start the scheduling activity */ if (TASK_SWITCH_PENDING(os_curpri)) { os_ks_dispatch(); } ENABLE_STACKCHECK(); LEAVE_KERNEL(); /* now running as the body of the os_idle task, with IPL at level 0 and priority of IDLEPRI */ /* $Req: artf1116 $ */ /* Note that interrupts will be enabled prior to here because the os_ks_dispatch() call above * might switch to running autostarted tasks, which will lower interrupts to level 0 */ for ( ; ; ) { os_idle(); /* call the os_idle task entry function */ } NOT_REACHED(); } else { /* This half of the 'if' is the half that is RETURNING from a longjmp */ /* We have come back from a ShutdownOS() call */ } /* Reached here because ShutdownOS(E_OK) was called. * * $Req: artf1219 $ */ assert(KERNEL_LOCKED()); assert(STACKCHECK_OFF()); /* Stack checking turned off prior to longjmp in shutdown() */ /* Would normally stop the counters, reinitialise the kernel variables, etc. in case StartOS() were to be called again, * but OS424 (artf1375) requires that StartOS() doesn't return, but instead goes into an infinite loop. * Similarly, OS425 (artf1376) requires that interrupts are disabled before entering the loop. * * If StartOS() is ever required to return to caller, see revision 568 of this file (startos.c) for the * original code that did this. * * $Req: artf1375 $ * $Req: artf1376 $ */ OS_SET_IPL_MAX(); for(;;) ; }