PPL Logo

conv-core/conv-conds.C File Reference

Go to the source code of this file.

Data Structures

struct  _ccd_callback
 Structure to hold the requisites for a callback. More...
struct  _ccd_cblist_elem
 An element (a single callback) in a list of callbacks. More...
struct  _ccd_cblist
 A list of callbacks stored as an array and handled like a list. More...
struct  ccd_cond_callbacks
 Lists of conditional callbacks that are maintained by the scheduler. More...
struct  ccd_periodic_callbacks
 List of periodic callbacks maintained by the scheduler. More...
struct  ccd_heap_elem
 Structure used to manage callbacks in a heap. More...

Typedefs

typedef struct _ccd_callback ccd_callback
typedef struct _ccd_cblist_elem ccd_cblist_elem
typedef struct _ccd_cblist ccd_cblist

Functions

static void init_cblist (ccd_cblist *l, unsigned int ml)
 Initialize a list of callbacks.
static void expand_cblist (ccd_cblist *l, unsigned int ml)
 Expand the callback list to a max length of ml.
static void remove_elem (ccd_cblist *l, int idx)
 Remove element referred to by given list index idx.
static void remove_n_elems (ccd_cblist *l, int n)
 Remove n elements from the beginning of the list.
static int append_elem (ccd_cblist *l, CcdVoidFn fn, void *arg, int pe)
 Append callback to the given cblist, and return the index.
static void call_cblist_keep (ccd_cblist *l, double curWallTime)
 Trigger the callbacks in the provided callback list and *retain* them after they are called.
static void call_cblist_remove (ccd_cblist *l, double curWallTime)
 Trigger the callbacks in the provided callback list and *remove* them from the list after they are called.
 CpvStaticDeclare (ccd_cond_callbacks, conds)
 CpvStaticDeclare (ccd_periodic_callbacks, pcb)
 CpvDeclare (int, _ccd_numchecks)
 CpvStaticDeclare (ccd_heap_elem *, ccd_heap)
 An array of time-scheduled callbacks managed as a heap.
 CpvStaticDeclare (int, ccd_heaplen)
 The length of the callback heap.
 CpvStaticDeclare (int, ccd_heapmaxlen)
 The max allowed length of the callback heap.
static void ccd_heap_swap (int index1, int index2)
 Swap two elements on the heap.
static void expand_ccd_heap (void)
 Expand the ccd_heap to make more room.
static void ccd_heap_insert (double t, CcdVoidFn fnp, void *arg, int pe)
 Insert a new callback into the heap.
static void ccd_heap_remove (void)
 Remove the top of the heap.
static void ccd_heap_update (double curWallTime)
 Identify any (over)due callbacks that were scheduled and trigger them.
CLINKAGE void CcdCallBacksReset (void *ignored, double curWallTime)
 Called when something drastic changes-- restart ccd_num_checks.
void CcdModuleInit (char **ignored)
 Initialize the callback containers.
int CcdCallOnCondition (int condnum, CcdVoidFn fnp, void *arg)
 Register a callback function that will be triggered when the specified condition is raised the next time.
int CcdCallOnConditionOnPE (int condnum, CcdVoidFn fnp, void *arg, int pe)
 Register a callback function that will be triggered on the specified PE when the specified condition is raised the next time.
int CcdCallOnConditionKeep (int condnum, CcdVoidFn fnp, void *arg)
 Register a callback function that will be triggered *whenever* the specified condition is raised.
int CcdCallOnConditionKeepOnPE (int condnum, CcdVoidFn fnp, void *arg, int pe)
 Register a callback function that will be triggered on the specified PE *whenever* the specified condition is raised.
void CcdCancelCallOnCondition (int condnum, int idx)
 Cancel a previously registered conditional callback.
void CcdCancelCallOnConditionKeep (int condnum, int idx)
 Cancel a previously registered conditional callback.
void CcdCallFnAfterOnPE (CcdVoidFn fnp, void *arg, double deltaT, int pe)
 Register a callback function that will be triggered on the specified PE after a minimum delay of deltaT.
void CcdCallFnAfter (CcdVoidFn fnp, void *arg, double deltaT)
 Register a callback function that will be triggered after a minimum delay of deltaT.
void CcdRaiseCondition (int condnum)
 Raise a condition causing all registered callbacks corresponding to that condition to be triggered.
double CcdSetMinResolution (double newResolution, double minResolution)
 Internal helper function that updates the polling resolution for time based callbacks to minimum of two arguments and ensures appropriate counters etc are reset.
double CcdSetResolution (double newResolution)
 Set the polling resolution for time based callbacks.
double CcdResetResolution ()
 Reset the polling resolution for time based callbacks to its default value.
double CcdIncreaseResolution (double newResolution)
 "Safe" operation that only ever increases the polling resolution for time based callbacks
void CcdCallBacks (void)

Variables

static const double periodicCallInterval [CCD_PERIODIC_MAX]


Typedef Documentation

typedef struct _ccd_callback ccd_callback

typedef struct _ccd_cblist ccd_cblist


Function Documentation

static void init_cblist ( ccd_cblist l,
unsigned int  ml 
) [static]

Initialize a list of callbacks.

Alloc memory, set counters etc.

Definition at line 45 of file conv-conds.C.

References _ccd_cblist::elems, _ccd_cblist::first, _ccd_cblist::first_free, _ccd_cblist::flag, _ccd_cblist::last, _ccd_cblist::len, malloc(), _ccd_cblist::maxlen, _ccd_cblist_elem::next, and _ccd_cblist_elem::prev.

Referenced by CcdModuleInit().

Here is the call graph for this function:

Here is the caller graph for this function:

static void expand_cblist ( ccd_cblist l,
unsigned int  ml 
) [static]

Expand the callback list to a max length of ml.

Definition at line 65 of file conv-conds.C.

References _ccd_cblist::elems, _ccd_cblist::first_free, free(), _ccd_cblist::len, malloc(), _ccd_cblist::maxlen, _ccd_cblist_elem::next, and _ccd_cblist_elem::prev.

Referenced by append_elem().

Here is the call graph for this function:

Here is the caller graph for this function:

static void remove_elem ( ccd_cblist l,
int  idx 
) [static]

Remove element referred to by given list index idx.

Definition at line 87 of file conv-conds.C.

References _ccd_cblist::elems, _ccd_cblist::first, _ccd_cblist::first_free, _ccd_cblist::last, _ccd_cblist::len, _ccd_cblist_elem::next, and _ccd_cblist_elem::prev.

Referenced by CcdCancelCallOnCondition(), CcdCancelCallOnConditionKeep(), and remove_n_elems().

Here is the caller graph for this function:

static void remove_n_elems ( ccd_cblist l,
int  n 
) [static]

Remove n elements from the beginning of the list.

Definition at line 111 of file conv-conds.C.

References _ccd_cblist::first, _ccd_cblist::len, and remove_elem().

Referenced by call_cblist_remove().

Here is the call graph for this function:

Here is the caller graph for this function:

static int append_elem ( ccd_cblist l,
CcdVoidFn  fn,
void *  arg,
int  pe 
) [static]

Append callback to the given cblist, and return the index.

Definition at line 124 of file conv-conds.C.

References _ccd_callback::arg, _ccd_cblist_elem::cb, _ccd_cblist::elems, expand_cblist(), _ccd_cblist::first, _ccd_cblist::first_free, _ccd_callback::fn, idx, _ccd_cblist::last, _ccd_cblist::len, _ccd_cblist::maxlen, _ccd_cblist_elem::next, _ccd_callback::pe, and _ccd_cblist_elem::prev.

Referenced by CcdCallOnCondition(), CcdCallOnConditionKeep(), CcdCallOnConditionKeepOnPE(), and CcdCallOnConditionOnPE().

Here is the call graph for this function:

Here is the caller graph for this function:

static void call_cblist_keep ( ccd_cblist l,
double  curWallTime 
) [static]

Trigger the callbacks in the provided callback list and *retain* them after they are called.

Callbacks that are added after this function is started (e.g. callbacks registered from other callbacks) are ignored.

Note:
: It is illegal to cancel callbacks from within ccd callbacks.

Definition at line 157 of file conv-conds.C.

References _ccd_callback::arg, _ccd_cblist_elem::cb, CmiSwitchToPE, _ccd_cblist::elems, _ccd_cblist::first, _ccd_callback::fn, idx, _ccd_cblist::len, len, _ccd_cblist_elem::next, and _ccd_callback::pe.

Referenced by CcdRaiseCondition().

Here is the caller graph for this function:

static void call_cblist_remove ( ccd_cblist l,
double  curWallTime 
) [static]

Trigger the callbacks in the provided callback list and *remove* them from the list after they are called.

Callbacks that are added after this function is started (e.g. callbacks registered from other callbacks) are ignored.

Note:
: It is illegal to cancel callbacks from within ccd callbacks.

Definition at line 178 of file conv-conds.C.

References _ccd_callback::arg, _ccd_cblist_elem::cb, CmiSwitchToPE, _ccd_cblist::elems, _ccd_cblist::first, _ccd_cblist::flag, _ccd_callback::fn, idx, _ccd_cblist::last, _ccd_cblist::len, len, _ccd_cblist_elem::next, _ccd_callback::pe, _ccd_cblist_elem::prev, and remove_n_elems().

Referenced by CcdRaiseCondition().

Here is the call graph for this function:

Here is the caller graph for this function:

CpvStaticDeclare ( ccd_cond_callbacks  ,
conds   
)

CpvStaticDeclare ( ccd_periodic_callbacks  ,
pcb   
)

CpvDeclare ( int  ,
_ccd_numchecks   
)

CpvStaticDeclare ( ccd_heap_elem ,
ccd_heap   
)

An array of time-scheduled callbacks managed as a heap.

CpvStaticDeclare ( int  ,
ccd_heaplen   
)

The length of the callback heap.

CpvStaticDeclare ( int  ,
ccd_heapmaxlen   
)

The max allowed length of the callback heap.

static void ccd_heap_swap ( int  index1,
int  index2 
) [static]

Swap two elements on the heap.

Definition at line 269 of file conv-conds.C.

References h.

Referenced by ccd_heap_insert(), and ccd_heap_remove().

Here is the caller graph for this function:

static void expand_ccd_heap ( void   )  [static]

Expand the ccd_heap to make more room.

Double the heap size and copy everything over. Initial 128 is reasonably big, so expanding won't happen often.

Had a bug previously due to late expansion, should work now - Gengbin 12/4/03

Definition at line 289 of file conv-conds.C.

References CmiMyPe(), CmiPrintf(), free(), and malloc().

Referenced by ccd_heap_insert().

Here is the call graph for this function:

Here is the caller graph for this function:

static void ccd_heap_insert ( double  t,
CcdVoidFn  fnp,
void *  arg,
int  pe 
) [static]

Insert a new callback into the heap.

Definition at line 315 of file conv-conds.C.

References _ccd_callback::arg, ccd_heap_elem::cb, ccd_heap_swap(), expand_ccd_heap(), _ccd_callback::fn, h, parent(), _ccd_callback::pe, stats::time(), and ccd_heap_elem::time.

Referenced by CcdCallFnAfterOnPE().

Here is the call graph for this function:

Here is the caller graph for this function:

static void ccd_heap_remove ( void   )  [static]

Remove the top of the heap.

Definition at line 348 of file conv-conds.C.

References ccd_heap_swap(), h, parent(), and stats::time().

Referenced by ccd_heap_update().

Here is the call graph for this function:

Here is the caller graph for this function:

static void ccd_heap_update ( double  curWallTime  )  [static]

Identify any (over)due callbacks that were scheduled and trigger them.

Definition at line 381 of file conv-conds.C.

References _ccd_callback::arg, ccd_heap_elem::cb, cb, ccd_heap_remove(), CmiSwitchToPE, _ccd_callback::fn, h, and stats::time().

Referenced by CcdCallBacks().

Here is the call graph for this function:

Here is the caller graph for this function:

void CcdCallBacksReset ( void *  ignored,
double  curWallTime 
)

Called when something drastic changes-- restart ccd_num_checks.

Definition at line 639 of file conv-conds.C.

References ccd_periodic_callbacks::lastCheck, and ccd_periodic_callbacks::nSkip.

Referenced by CcdModuleInit(), and CcdSetMinResolution().

Here is the caller graph for this function:

int CcdCallOnCondition ( int  condnum,
CcdVoidFn  fnp,
void *  arg 
)

Register a callback function that will be triggered when the specified condition is raised the next time.

Definition at line 450 of file conv-conds.C.

References append_elem().

Referenced by _initCharm(), _messageLoggingInit(), _qdHandler(), CIdleTimeoutInit(), CkMemCheckPT::CkMemCheckPT(), CkMessageDetailReplay::CkMessageDetailReplay(), CldGraphModuleInit(), CQdHandler(), CQdRegisterCallback(), heartBeatCheckHandler(), heartBeatPartner(), CkMemCheckPT::isMaster(), partnerFailureHandler(), CkMemCheckPT::pup(), and CkArray::setupSpringCleaning().

Here is the call graph for this function:

Here is the caller graph for this function:

int CcdCallOnConditionOnPE ( int  condnum,
CcdVoidFn  fnp,
void *  arg,
int  pe 
)

Register a callback function that will be triggered on the specified PE when the specified condition is raised the next time.

Definition at line 460 of file conv-conds.C.

References append_elem().

Here is the call graph for this function:

int CcdCallOnConditionKeep ( int  condnum,
CcdVoidFn  fnp,
void *  arg 
)

int CcdCallOnConditionKeepOnPE ( int  condnum,
CcdVoidFn  fnp,
void *  arg,
int  pe 
)

Register a callback function that will be triggered on the specified PE *whenever* the specified condition is raised.

Definition at line 480 of file conv-conds.C.

References append_elem().

Here is the call graph for this function:

void CcdCancelCallOnCondition ( int  condnum,
int  idx 
)

Cancel a previously registered conditional callback.

Definition at line 490 of file conv-conds.C.

References remove_elem().

Referenced by CkArray::~CkArray().

Here is the call graph for this function:

Here is the caller graph for this function:

void CcdCancelCallOnConditionKeep ( int  condnum,
int  idx 
)

Cancel a previously registered conditional callback.

Definition at line 500 of file conv-conds.C.

References remove_elem().

Referenced by AMPI_Uninstall_idle_timer(), LBMachineUtil::StatsOff(), traceCommonInit(), and LV3D0_ClientManager_toMaster::~LV3D0_ClientManager_toMaster().

Here is the call graph for this function:

Here is the caller graph for this function:

void CcdCallFnAfterOnPE ( CcdVoidFn  fnp,
void *  arg,
double  deltaT,
int  pe 
)

Register a callback function that will be triggered on the specified PE after a minimum delay of deltaT.

Definition at line 511 of file conv-conds.C.

References ccd_heap_insert(), and CmiWallTimer().

Referenced by CcdCallFnAfter(), CldBalancePeriod(), controlPointManager::controlPointManager(), MetaBalancer::periodicCall(), periodicProcessControlPoints(), and LBDB::batsyncer::resumeFromSync().

Here is the call graph for this function:

Here is the caller graph for this function:

void CcdCallFnAfter ( CcdVoidFn  fnp,
void *  arg,
double  deltaT 
)

Register a callback function that will be triggered after a minimum delay of deltaT.

Definition at line 522 of file conv-conds.C.

References CcdCallFnAfterOnPE().

Referenced by _qdHandler(), checkpointAlarm(), CkDieNow(), CldAverageHandler(), CWeb_Collect(), TCharm::evacuate(), CkMemCheckPT::isMaster(), killLocal(), on_idle(), processRaiseEvacFile(), readFaultFile(), readKillFile(), MeshStreamer< dtype >::registerPeriodicProgressFunction(), and startMlogCheckpoint().

Here is the call graph for this function:

Here is the caller graph for this function:

void CcdRaiseCondition ( int  condnum  ) 

Raise a condition causing all registered callbacks corresponding to that condition to be triggered.

Definition at line 532 of file conv-conds.C.

References call_cblist_keep(), call_cblist_remove(), and CmiWallTimer().

Referenced by CcdCallBacks(), CQdAnnounceHandler(), CsdBeginIdle(), CsdEndIdle(), CsdStillIdle(), and LrtsInitCpuTopo().

Here is the call graph for this function:

Here is the caller graph for this function:

double CcdSetMinResolution ( double  newResolution,
double  minResolution 
)

Internal helper function that updates the polling resolution for time based callbacks to minimum of two arguments and ensures appropriate counters etc are reset.

Definition at line 546 of file conv-conds.C.

References CcdCallBacksReset(), CmiWallTimer(), and ccd_periodic_callbacks::resolution.

Referenced by CcdIncreaseResolution(), and CcdSetResolution().

Here is the call graph for this function:

Here is the caller graph for this function:

double CcdSetResolution ( double  newResolution  ) 

Set the polling resolution for time based callbacks.

Definition at line 563 of file conv-conds.C.

References CcdSetMinResolution().

Here is the call graph for this function:

double CcdResetResolution ( void   ) 

Reset the polling resolution for time based callbacks to its default value.

Definition at line 570 of file conv-conds.C.

References ccd_periodic_callbacks::resolution.

double CcdIncreaseResolution ( double  newResolution  ) 

"Safe" operation that only ever increases the polling resolution for time based callbacks

Definition at line 583 of file conv-conds.C.

References CcdSetMinResolution().

Here is the call graph for this function:

void CcdCallBacks ( void   ) 

Definition at line 591 of file conv-conds.C.

References ccd_heap_update(), CcdRaiseCondition(), CmiWallTimer(), int, ccd_periodic_callbacks::lastCheck, ccd_periodic_callbacks::nextCall, ccd_periodic_callbacks::nSkip, periodicCallInterval, and ccd_periodic_callbacks::resolution.

Referenced by CsdBeginIdle().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const double periodicCallInterval[CCD_PERIODIC_MAX] [static]

Initial value:

{0.001, 0.010, 0.100, 1.0, 5.0, 10.0, 60.0, 2*60.0, 5*60.0, 10*60.0, 3600.0, 12*3600.0, 24*3600.0}

Definition at line 225 of file conv-conds.C.

Referenced by CcdCallBacks(), and CcdModuleInit().


Generated on Mon Sep 21 08:00:21 2020 for Charm++ by  doxygen 1.5.5