scheduler.cc (13069:d894ba8f881c) scheduler.cc (13072:f2b83208ab54)
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

--- 36 unchanged lines hidden (view full) ---

45 scMain(nullptr),
46 starvationEvent(this, false, StarvationPriority),
47 _started(false), _paused(false), _stopped(false),
48 maxTickEvent(this, false, MaxTickPriority),
49 _numCycles(0), _current(nullptr), initDone(false),
50 runOnce(false)
51{}
52
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

--- 36 unchanged lines hidden (view full) ---

45 scMain(nullptr),
46 starvationEvent(this, false, StarvationPriority),
47 _started(false), _paused(false), _stopped(false),
48 maxTickEvent(this, false, MaxTickPriority),
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);
77 if (starvationEvent.scheduled())
78 eq->deschedule(&starvationEvent);
79 if (maxTickEvent.scheduled())
80 eq->deschedule(&maxTickEvent);
81
82 Process *p;
83 while ((p = toFinalize.getNext()))
84 p->popListNode();
85 while ((p = initList.getNext()))
86 p->popListNode();
87 while ((p = readyList.getNext()))
88 p->popListNode();
89
90 Channel *c;
91 while ((c = updateList.getNext()))
92 c->popListNode();
93}
94
53void
54Scheduler::initPhase()
55{
56 for (Process *p = toFinalize.getNext(); p; p = toFinalize.getNext()) {
57 p->finalize();
58 p->popListNode();
59 }
60

--- 252 unchanged lines hidden ---
95void
96Scheduler::initPhase()
97{
98 for (Process *p = toFinalize.getNext(); p; p = toFinalize.getNext()) {
99 p->finalize();
100 p->popListNode();
101 }
102

--- 252 unchanged lines hidden ---