replicode
Classes | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
r_exec::ModelBase Class Reference

#include <model_base.h>

Collaboration diagram for r_exec::ModelBase:
Collaboration graph

Classes

class  MEntry
 

Public Member Functions

void load (Code *mdl)
 
void get_models (r_code::list< P< Code > > &models)
 
Codecheck_existence (Code *mdl)
 caveat: mdl is unpacked; return (a) NULL if the model is in the black list, (b) a model in the white list if the mdl has been registered there or (c) the mdl itself if not in the model base, in which case the mdl is added to the white list. More...
 
void check_existence (Code *m0, Code *m1, Code *&_m0, Code *&_m1)
 
void register_mdl_failure (Code *mdl)
 
void register_mdl_timeout (Code *mdl)
 

Static Public Member Functions

static ModelBaseGet ()
 

Private Types

typedef std::unordered_set< MEntry, typename MEntry::Hash, typename MEntry::EqualMdlSet
 

Private Member Functions

void set_thz (uint64_t thz)
 called by _Mem::start(); set to secondary_thz. More...
 
void trim_objects ()
 called by _Mem::GC(). More...
 
 ModelBase ()
 

Private Attributes

std::mutex m_mdlMutex
 
uint64_t thz
 
MdlSet black_list
 mdls are already packed when inserted (they come from the white list). More...
 
MdlSet white_list
 mdls are packed just before insertion. More...
 

Static Private Attributes

static ModelBaseSingleton = NULL
 

Friends

class _Mem
 

Detailed Description

TPX guess models: this list is meant for TPXs to (a) avoid re-guessing known failed models and, (b) avoid producing the same models in case they run concurrently. The black list contains bad models (models that were killed). This list is trimmed down on a time basis (black_thz) by the garbage collector. Each bad model is tagged with the last time it was successfully compared to. GC is performed by comparing this time to the thz. The white list contains models that are still alive and is trimmed down when models time out. Models are packed before insertion in the white list.

Member Typedef Documentation

typedef std::unordered_set<MEntry, typename MEntry::Hash, typename MEntry::Equal> r_exec::ModelBase::MdlSet
private

Constructor & Destructor Documentation

r_exec::ModelBase::ModelBase ( )
private

Member Function Documentation

Code * r_exec::ModelBase::check_existence ( Code mdl)

caveat: mdl is unpacked; return (a) NULL if the model is in the black list, (b) a model in the white list if the mdl has been registered there or (c) the mdl itself if not in the model base, in which case the mdl is added to the white list.

Here is the call graph for this function:

Here is the caller graph for this function:

void r_exec::ModelBase::check_existence ( Code m0,
Code m1,
Code *&  _m0,
Code *&  _m1 
)

m1 is a requirement on m0; _m0 and _m1 are the return values as defined above; m0 added only if m1 is not black listed. m0 and m1 unpacked.

Here is the call graph for this function:

ModelBase * r_exec::ModelBase::Get ( )
static

Here is the caller graph for this function:

void r_exec::ModelBase::get_models ( r_code::list< P< Code > > &  models)

Here is the caller graph for this function:

void r_exec::ModelBase::load ( Code mdl)

called by _Mem::load(); models with no views go to the black_list. mdl is already packed.

Here is the caller graph for this function:

void r_exec::ModelBase::register_mdl_failure ( Code mdl)

moves the mdl from the white to the black list; happens to bad models. mdl is packed.

Here is the caller graph for this function:

void r_exec::ModelBase::register_mdl_timeout ( Code mdl)

deletes the mdl from the white list; happen to models that have been unused for primary_thz. mdl is packed.

Here is the caller graph for this function:

void r_exec::ModelBase::set_thz ( uint64_t  thz)
inlineprivate

called by _Mem::start(); set to secondary_thz.

Here is the caller graph for this function:

void r_exec::ModelBase::trim_objects ( )
private

called by _Mem::GC().

Here is the call graph for this function:

Friends And Related Function Documentation

friend class _Mem
friend

Member Data Documentation

MdlSet r_exec::ModelBase::black_list
private

mdls are already packed when inserted (they come from the white list).

std::mutex r_exec::ModelBase::m_mdlMutex
private
ModelBase * r_exec::ModelBase::Singleton = NULL
staticprivate
uint64_t r_exec::ModelBase::thz
private
MdlSet r_exec::ModelBase::white_list
private

mdls are packed just before insertion.


The documentation for this class was generated from the following files: