SimEventQueueDebug.C
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038 #include "Simulation/SimEventQueueDebug.H"
00039
00040 #include "Simulation/SimEvents.H"
00041 #include "rutz/demangle.h"
00042
00043
00044 SimEventQueueDebug::SimEventQueueDebug(OptionManager& mgr,
00045 const std::string& descrName,
00046 const std::string& tagName,
00047 const SimTime starttime) :
00048 SimEventQueue(mgr, descrName, tagName, starttime)
00049 { }
00050
00051
00052 SimEventQueueDebug::~SimEventQueueDebug()
00053 { }
00054
00055
00056 SimStatus SimEventQueueDebug::evolve()
00057 {
00058 LINFO("*** Queue contents before evolve() at t=%fms:", t.msecs());
00059
00060 SeqData::const_iterator itr = itsQueue.begin(), stop = itsQueue.end();
00061 while (itr != stop) {
00062 const char *rname = itr->first.c_str();
00063 const RealmData *rd = &(itr->second);
00064 const SeqEntryVec *seq = &(rd->events);
00065
00066 if (seq->size()) {
00067 SeqEntryVec::const_iterator e = seq->begin(), stop = seq->end();
00068
00069 while (e != stop) {
00070 LINFO("*** [%s] %s posted at t=%fms [done by: %s]",
00071 rname, e->second->toString().c_str(),
00072 e->first.msecs(), e->second->getDoneList().c_str());
00073 ++e;
00074 }
00075 } else LINFO("*** [Queue is empty]");
00076
00077 ++itr;
00078 }
00079 return SimEventQueue::evolve();
00080 }
00081
00082
00083 void SimEventQueueDebug::clear()
00084 {
00085 LINFO("Clearing the event queue...");
00086 SimEventQueue::clear();
00087 }
00088
00089
00090 void SimEventQueueDebug::resetTime(const SimTime& tim)
00091 {
00092 LINFO("Resetting time to %fms and clearing queue...", tim.msecs());
00093 SimEventQueue::resetTime(tim);
00094 }
00095
00096
00097 void SimEventQueueDebug::prune(const SimTime& tt)
00098 {
00099 LINFO("Pruning events with t < %fms", tt.msecs());
00100 SimEventQueue::prune(tt);
00101 }
00102
00103
00104 void SimEventQueueDebug::postHelper(const std::type_info& etype,
00105 const rutz::shared_ptr<SimEvent>& e)
00106 {
00107 LINFO("%s, t=%fms", e->toString().c_str(), t.msecs());
00108 }
00109
00110
00111
00112 void
00113 SimEventQueueDebug::checkHelper(const std::type_info& etype,
00114 const rutz::shared_ptr<SimEvent>& e,
00115 const SimModule* caller,
00116 const SimEventQueueFlag flags,
00117 const SimModule* eventsrc)
00118 {
00119 if (eventsrc)
00120 LINFO("%s:%s: Returning [%s] (request narrowed down to %s)",
00121 caller ? caller->descriptiveName().c_str() :
00122 "[Anonymous Caller]", rutz::demangled_name(etype),
00123 e.is_valid() ? e->toString().c_str() : "No match",
00124 eventsrc->descriptiveName().c_str());
00125 else
00126 LINFO("%s:%s: Returning [%s]",
00127 caller ? caller->descriptiveName().c_str() :
00128 "[Anonymous Caller]", rutz::demangled_name(etype),
00129 e.is_valid() ? e->toString().c_str() : "No match");
00130
00131 }
00132
00133
00134
00135
00136
00137
00138