scheduler.cc (13074:51b5e342f327) | scheduler.cc (13076:c9e2a8bfe907) |
---|---|
1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright --- 40 unchanged lines hidden (view full) --- 49 _numCycles(0), _current(nullptr), initDone(false), 50 runOnce(false) 51{} 52 53Scheduler::~Scheduler() 54{ 55 // Clear out everything that belongs to us to make sure nobody tries to 56 // clear themselves out after the scheduler goes away. | 1/* 2 * Copyright 2018 Google, Inc. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer; 8 * redistributions in binary form must reproduce the above copyright --- 40 unchanged lines hidden (view full) --- 49 _numCycles(0), _current(nullptr), initDone(false), 50 runOnce(false) 51{} 52 53Scheduler::~Scheduler() 54{ 55 // Clear out everything that belongs to us to make sure nobody tries to 56 // clear themselves out after the scheduler goes away. |
57 clear(); 58} |
|
57 | 59 |
60void 61Scheduler::clear() 62{ |
|
58 // Delta notifications. 59 for (auto &e: deltas) 60 e->deschedule(); | 63 // Delta notifications. 64 for (auto &e: deltas) 65 e->deschedule(); |
66 deltas.clear(); |
|
61 62 // Timed notifications. | 67 68 // Timed notifications. |
63 for (auto &ts: timeSlots) { 64 for (auto &e: ts.second->events) | 69 for (auto &tsp: timeSlots) { 70 TimeSlot *&ts = tsp.second; 71 for (auto &e: ts->events) |
65 e->deschedule(); | 72 e->deschedule(); |
66 delete ts.second; 67 ts.second = nullptr; | 73 eq->deschedule(ts); |
68 } | 74 } |
75 timeSlots.clear(); |
|
69 70 // gem5 events. 71 if (readyEvent.scheduled()) 72 eq->deschedule(&readyEvent); 73 if (pauseEvent.scheduled()) 74 eq->deschedule(&pauseEvent); 75 if (stopEvent.scheduled()) 76 eq->deschedule(&stopEvent); --- 191 unchanged lines hidden (view full) --- 268} 269 270void 271Scheduler::stop() 272{ 273 _stopped = true; 274 kernel->stop(); 275 | 76 77 // gem5 events. 78 if (readyEvent.scheduled()) 79 eq->deschedule(&readyEvent); 80 if (pauseEvent.scheduled()) 81 eq->deschedule(&pauseEvent); 82 if (stopEvent.scheduled()) 83 eq->deschedule(&stopEvent); --- 191 unchanged lines hidden (view full) --- 275} 276 277void 278Scheduler::stop() 279{ 280 _stopped = true; 281 kernel->stop(); 282 |
276 if (readyEvent.scheduled()) 277 eq->deschedule(&readyEvent); | 283 clear(); |
278 279 runOnce = false; 280 scMain->run(); 281} 282 283void 284Scheduler::start(Tick max_tick, bool run_to_time) 285{ --- 47 unchanged lines hidden (view full) --- 333 334void 335Scheduler::scheduleStop(bool finish_delta) 336{ 337 if (stopEvent.scheduled()) 338 return; 339 340 if (!finish_delta) { | 284 285 runOnce = false; 286 scMain->run(); 287} 288 289void 290Scheduler::start(Tick max_tick, bool run_to_time) 291{ --- 47 unchanged lines hidden (view full) --- 339 340void 341Scheduler::scheduleStop(bool finish_delta) 342{ 343 if (stopEvent.scheduled()) 344 return; 345 346 if (!finish_delta) { |
341 // If we're not supposed to finish the delta cycle, flush the list 342 // of ready processes, scheduled updates, and delta notifications. 343 Process *p; 344 while ((p = readyList.getNext())) 345 p->popListNode(); 346 Channel *c; 347 while ((c = updateList.getNext())) 348 c->popListNode(); 349 for (auto &e: deltas) 350 e->deschedule(); 351 deltas.clear(); | 347 // If we're not supposed to finish the delta cycle, flush all 348 // pending activity. 349 clear(); |
352 } 353 eq->schedule(&stopEvent, eq->getCurTick()); 354} 355 356Scheduler scheduler; 357 358} // namespace sc_gem5 | 350 } 351 eq->schedule(&stopEvent, eq->getCurTick()); 352} 353 354Scheduler scheduler; 355 356} // namespace sc_gem5 |