scheduler.cc (13145:5291e0747c7c) scheduler.cc (13154:f86c71dac456)
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

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

39{
40
41Scheduler::Scheduler() :
42 eq(nullptr), readyEvent(this, false, ReadyPriority),
43 pauseEvent(this, false, PausePriority),
44 stopEvent(this, false, StopPriority),
45 scMain(nullptr),
46 starvationEvent(this, false, StarvationPriority),
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

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

39{
40
41Scheduler::Scheduler() :
42 eq(nullptr), readyEvent(this, false, ReadyPriority),
43 pauseEvent(this, false, PausePriority),
44 stopEvent(this, false, StopPriority),
45 scMain(nullptr),
46 starvationEvent(this, false, StarvationPriority),
47 _started(false), _paused(false), _stopped(false),
47 _started(false), _paused(false), _stopped(false), _stopNow(false),
48 maxTickEvent(this, false, MaxTickPriority),
49 _numCycles(0), _changeStamp(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

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

184 _current->excWrapper = nullptr;
185 ew->throw_it();
186 }
187}
188
189void
190Scheduler::ready(Process *p)
191{
48 maxTickEvent(this, false, MaxTickPriority),
49 _numCycles(0), _changeStamp(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

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

184 _current->excWrapper = nullptr;
185 ew->throw_it();
186 }
187}
188
189void
190Scheduler::ready(Process *p)
191{
192 if (_stopNow)
193 return;
194
192 // Clump methods together to minimize context switching.
193 static bool cluster_methods = false;
194
195 if (cluster_methods && p->procKind() == ::sc_core::SC_METHOD_PROC_)
196 readyList.pushFirst(p);
197 else
198 readyList.pushLast(p);
199

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

272 yield();
273 } while (!readyList.empty());
274
275 if (!empty) {
276 _numCycles++;
277 _changeStamp++;
278 }
279
195 // Clump methods together to minimize context switching.
196 static bool cluster_methods = false;
197
198 if (cluster_methods && p->procKind() == ::sc_core::SC_METHOD_PROC_)
199 readyList.pushFirst(p);
200 else
201 readyList.pushLast(p);
202

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

275 yield();
276 } while (!readyList.empty());
277
278 if (!empty) {
279 _numCycles++;
280 _changeStamp++;
281 }
282
283 if (_stopNow)
284 return;
285
280 // The update phase.
281 update();
282
283 // The delta phase.
284 while (!deltas.empty())
285 deltas.front()->run();
286
287 if (!runToTime && starved())

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

378
379void
380Scheduler::scheduleStop(bool finish_delta)
381{
382 if (stopEvent.scheduled())
383 return;
384
385 if (!finish_delta) {
286 // The update phase.
287 update();
288
289 // The delta phase.
290 while (!deltas.empty())
291 deltas.front()->run();
292
293 if (!runToTime && starved())

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

384
385void
386Scheduler::scheduleStop(bool finish_delta)
387{
388 if (stopEvent.scheduled())
389 return;
390
391 if (!finish_delta) {
392 _stopNow = true;
386 // If we're not supposed to finish the delta cycle, flush all
387 // pending activity.
388 clear();
389 }
390 schedule(&stopEvent);
391}
392
393Scheduler scheduler;
394
395} // namespace sc_gem5
393 // If we're not supposed to finish the delta cycle, flush all
394 // pending activity.
395 clear();
396 }
397 schedule(&stopEvent);
398}
399
400Scheduler scheduler;
401
402} // namespace sc_gem5