Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /branches/vis12/src/compiler/c-target/fragments/c-body.in
ViewVC logotype

View of /branches/vis12/src/compiler/c-target/fragments/c-body.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1862 - (download) (annotate)
Sun Apr 22 19:45:47 2012 UTC (8 years, 9 months ago) by jhr
File size: 1691 byte(s)
  Switch to using a biffMsg struct to record errors in the world.
/***** Runtime options *****/

//! Set verbose mode
void @PREFIX@SetVerbose (@PREFIX@World_t *wrld, bool mode)
{
    wrld->verboseFlg = mode;
}

//! Get verbose mode
bool @PREFIX@GetVerbose (@PREFIX@World_t *wrld)
{
    return wrld->verboseFlg;
}

#ifdef DIDEROT_TARGET_PARALLEL

//! Set number of workers; 0 means natural number for target (i.e., number of cores)
void @PREFIX@SetNumWorkers (@PREFIX@World_t *wrld, uint32_t nw)
{
    if (nw == 0)
	wrld->sched->numWorkers = wrld->sched->cpuInfo.numHWCores;
    else
	wrld->sched->numWorkers = nw;
}

//! Get number of workers
uint32_t @PREFIX@GetNumWorkers (@PREFIX@World_t *wrld)
{
    return wrld->sched->numWorkers;
}

#endif /* DIDEROT_TARGET_PARALLEL */

/***** World query operations *****/

//! Return the total number of strands (active+stable) in the world
uint32_t @PREFIX@NumStrands (@PREFIX@World_t *wrld)
{
    return wrld->numStrands;
}

//! Return the total number of active strands
uint32_t @PREFIX@NumActive (@PREFIX@World_t *wrld)
{
#if defined(DIDEROT_TARGET_C)
    return wrld->numActive;
#elif defined(DIDEROT_TARGET_PARALLEL)
    return wrld->sched->numActive;
#else
#  error bogus target
#endif
}

//! Return the total number of stable strands
uint32_t @PREFIX@NumStable (@PREFIX@World_t *wrld)
{
    return 0; /* FIXME */
}

//! Return true if there are any recorded error conditions
bool @PREFIX@AnyErrors (@PREFIX@World_t *wrld)
{
    return (wrld->errors->errNum > 0);
}

//! Return the pending error message (if any).  This call clears the pending error
//! state.
char *@PREFIX@GetErrors (@PREFIX@World_t *wrld)
{
    char *msg = biffMsgStrGet (wrld->errors);
    biffMsgClear (wrld->errors);
    return msg;
}

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0