#include <scheduler.h>
Inheritance diagram for Scheduler:


Public Member Functions | |
| void | schedule (Handler *, Event *, double delay) |
| virtual void | run () |
| virtual void | cancel (Event *)=0 |
| virtual void | insert (Event *)=0 |
| virtual Event * | lookup (scheduler_uid_t uid)=0 |
| virtual Event * | deque ()=0 |
| virtual const Event * | head ()=0 |
| double | clock () const |
| virtual void | sync () |
| virtual double | start () |
| virtual void | reset () |
Static Public Member Functions | |
| Scheduler & | instance () |
Protected Member Functions | |
| void | dumpq () |
| void | dispatch (Event *) |
| void | dispatch (Event *, double) |
| Scheduler () | |
| virtual | ~Scheduler () |
| int | command (int argc, const char *const *argv) |
Protected Attributes | |
| double | clock_ |
| int | halted_ |
Static Protected Attributes | |
| Scheduler * | instance_ |
| scheduler_uid_t | uid_ = 1 |
|
|
Definition at line 63 of file scheduler.cc. References SCHED_START.
|
|
|
Definition at line 67 of file scheduler.cc. References instance_.
00067 {
00068 instance_ = NULL ;
00069 }
|
|
|
|
||||||||||||
|
Definition at line 188 of file scheduler.cc. References at_handler, cancel(), clock(), MemTrace::diff(), dumpq(), halted_, instance_, lookup(), AtEvent::proc_, reset(), run(), schedule(), STRTOUID, Event::uid_, and UID_PRINTF_FORMAT.
00189 {
00190 Tcl& tcl = Tcl::instance();
00191 if (instance_ == 0)
00192 instance_ = this;
00193 if (argc == 2) {
00194 if (strcmp(argv[1], "run") == 0) {
00195 /* set global to 0 before calling object reset methods */
00196 reset(); // sets clock to zero
00197 run();
00198 return (TCL_OK);
00199 } else if (strcmp(argv[1], "now") == 0) {
00200 sprintf(tcl.buffer(), "%.17g", clock());
00201 tcl.result(tcl.buffer());
00202 return (TCL_OK);
00203 } else if (strcmp(argv[1], "resume") == 0) {
00204 halted_ = 0;
00205 run();
00206 return (TCL_OK);
00207 } else if (strcmp(argv[1], "halt") == 0) {
00208 halted_ = 1;
00209 return (TCL_OK);
00210
00211 } else if (strcmp(argv[1], "clearMemTrace") == 0) {
00212 #ifdef MEMDEBUG_SIMULATIONS
00213 extern MemTrace *globalMemTrace;
00214 if (globalMemTrace)
00215 globalMemTrace->diff("Sim.");
00216 #endif
00217 return (TCL_OK);
00218 } else if (strcmp(argv[1], "is-running") == 0) {
00219 sprintf(tcl.buffer(), "%d", !halted_);
00220 return (TCL_OK);
00221 } else if (strcmp(argv[1], "dumpq") == 0) {
00222 if (!halted_) {
00223 fprintf(stderr, "Scheduler: dumpq only allowed while halted\n");
00224 tcl.result("0");
00225 return (TCL_ERROR);
00226 }
00227 dumpq();
00228 return (TCL_OK);
00229 }
00230 } else if (argc == 3) {
00231 if (strcmp(argv[1], "at") == 0 ||
00232 strcmp(argv[1], "cancel") == 0) {
00233 Event* p = lookup(STRTOUID(argv[2]));
00234 if (p != 0) {
00235 /*XXX make sure it really is an atevent*/
00236 cancel(p);
00237 AtEvent* ae = (AtEvent*)p;
00238 delete ae;
00239 }
00240 } else if (strcmp(argv[1], "at-now") == 0) {
00241 const char* proc = argv[2];
00242
00243 // "at [$ns now]" may not work because of tcl's
00244 // string number resolution
00245 AtEvent* e = new AtEvent;
00246 int n = strlen(proc);
00247 e->proc_ = new char[n + 1];
00248 strcpy(e->proc_, proc);
00249 schedule(&at_handler, e, 0);
00250 sprintf(tcl.buffer(), UID_PRINTF_FORMAT, e->uid_);
00251 tcl.result(tcl.buffer());
00252 }
00253 return (TCL_OK);
00254 } else if (argc == 4) {
00255 if (strcmp(argv[1], "at") == 0) {
00256 /* t < 0 means relative time: delay = -t */
00257 double delay, t = atof(argv[2]);
00258 const char* proc = argv[3];
00259
00260 AtEvent* e = new AtEvent;
00261 int n = strlen(proc);
00262 e->proc_ = new char[n + 1];
00263 strcpy(e->proc_, proc);
00264 delay = (t < 0) ? -t : t - clock();
00265 if (delay < 0) {
00266 tcl.result("can't schedule command in past");
00267 return (TCL_ERROR);
00268 }
00269 schedule(&at_handler, e, delay);
00270 sprintf(tcl.buffer(), UID_PRINTF_FORMAT, e->uid_);
00271 tcl.result(tcl.buffer());
00272 return (TCL_OK);
00273 }
00274 }
00275 return (TclObject::command(argc, argv));
00276 }
|
Here is the call graph for this function:

|
|
Implemented in ListScheduler, HeapScheduler, CalendarScheduler, and SplayScheduler. |
|
||||||||||||
|
Definition at line 140 of file scheduler.cc. References abort(), clock_, Handler::handle(), Event::handler_, and Event::uid_.
|
Here is the call graph for this function:

|
|
Definition at line 153 of file scheduler.cc. References Event::time_. Referenced by RealTimeScheduler::run(), and run().
|
|
|
Definition at line 279 of file scheduler.cc. References clock(), deque(), Event::handler_, Event::time_, Event::uid_, and UID_PRINTF_FORMAT. Referenced by command().
|
Here is the call graph for this function:

|
|
Implemented in ListScheduler, HeapScheduler, CalendarScheduler, and SplayScheduler. |
|
|
Implemented in ListScheduler, HeapScheduler, CalendarScheduler, and SplayScheduler. Referenced by schedule(). |
|
|
|
Implemented in ListScheduler, HeapScheduler, CalendarScheduler, and SplayScheduler. Referenced by command(), and SemanticPacketQueue::filterAcks(). |
|
|
Reimplemented in RealTimeScheduler. Definition at line 182 of file scheduler.cc. References clock_, and SCHED_START. Referenced by command().
00183 {
00184 clock_ = SCHED_START;
00185 }
|
|
|
Reimplemented in RealTimeScheduler. Definition at line 118 of file scheduler.cc. References deque(), dispatch(), halted_, and instance_. Referenced by command().
00119 {
00120 instance_ = this;
00121 Event *p;
00122 /*
00123 * The order is significant: if halted_ is checked later,
00124 * event p could be lost when the simulator resumes.
00125 * Patch by Thomas Kaemer <Thomas.Kaemer@eas.iis.fhg.de>.
00126 */
00127 while (!halted_ && (p = deque())) {
00128 dispatch(p, p->time_);
00129 }
00130 }
|
Here is the call graph for this function:

|
||||||||||||||||
Here is the call graph for this function:

|
|
Definition at line 94 of file scheduler.h. References SCHED_START.
00094 { // start time
00095 return SCHED_START;
00096 }
|
|
|
Reimplemented in RealTimeScheduler. Definition at line 93 of file scheduler.h. Referenced by TapAgent::dispatch().
00093 {};
|
|
|
Definition at line 105 of file scheduler.h. Referenced by clock(), dispatch(), RealTimeScheduler::reset(), reset(), RealTimeScheduler::run(), schedule(), and RealTimeScheduler::sync(). |
|
|
Definition at line 106 of file scheduler.h. Referenced by command(), RealTimeScheduler::run(), and run(). |
|
|
Definition at line 55 of file scheduler.cc. Referenced by command(), RealTimeScheduler::run(), run(), and ~Scheduler(). |
|
|
Definition at line 56 of file scheduler.cc. Referenced by schedule(). |
1.3.3