Deleted Added
sdiff udiff text old ( 13074:51b5e342f327 ) new ( 13076:c9e2a8bfe907 )
full compact
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
58 // Delta notifications.
59 for (auto &e: deltas)
60 e->deschedule();
61
62 // Timed notifications.
63 for (auto &ts: timeSlots) {
64 for (auto &e: ts.second->events)
65 e->deschedule();
66 delete ts.second;
67 ts.second = nullptr;
68 }
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
276 if (readyEvent.scheduled())
277 eq->deschedule(&readyEvent);
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) {
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();
352 }
353 eq->schedule(&stopEvent, eq->getCurTick());
354}
355
356Scheduler scheduler;
357
358} // namespace sc_gem5