scheduler.hh (13203:76ee4971fd9e) scheduler.hh (13209:aad30faa966b)
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

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

189
190 // Schedule an update for a given channel.
191 void requestUpdate(Channel *c);
192
193 // Run the given process immediately, preempting whatever may be running.
194 void
195 runNow(Process *p)
196 {
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

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

189
190 // Schedule an update for a given channel.
191 void requestUpdate(Channel *c);
192
193 // Run the given process immediately, preempting whatever may be running.
194 void
195 runNow(Process *p)
196 {
197 // This function may put a process on the wrong list, ie a method on
198 // the process list or vice versa. That's fine since that's just a
199 // performance optimization, and the important thing here is how the
200 // processes are ordered.
197 // This function may put a process on the wrong list, ie a thread
198 // the method list. That's fine since that's just a performance
199 // optimization, and the important thing here is how the processes are
200 // ordered.
201
202 // If a process is running, schedule it/us to run again.
203 if (_current)
201
202 // If a process is running, schedule it/us to run again.
203 if (_current)
204 readyList->pushFirst(_current);
204 readyListMethods.pushFirst(_current);
205 // Schedule p to run first.
205 // Schedule p to run first.
206 readyList->pushFirst(p);
206 readyListMethods.pushFirst(p);
207 yield();
208 }
209
210 // Set an event queue for scheduling events.
211 void setEventQueue(EventQueue *_eq) { eq = _eq; }
212
213 // Get the current time according to gem5.
214 Tick getCurTick() { return eq ? eq->getCurTick() : 0; }

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

385 eq->deschedule(event);
386 else
387 eventsToSchedule.erase(event);
388 }
389
390 ScEvents deltas;
391 TimeSlots timeSlots;
392
207 yield();
208 }
209
210 // Set an event queue for scheduling events.
211 void setEventQueue(EventQueue *_eq) { eq = _eq; }
212
213 // Get the current time according to gem5.
214 Tick getCurTick() { return eq ? eq->getCurTick() : 0; }

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

385 eq->deschedule(event);
386 else
387 eventsToSchedule.erase(event);
388 }
389
390 ScEvents deltas;
391 TimeSlots timeSlots;
392
393 Process *
394 getNextReady()
395 {
396 Process *p = readyListMethods.getNext();
397 return p ? p : readyListThreads.getNext();
398 }
399
393 void runReady();
394 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent;
395 void scheduleReadyEvent();
396
397 void pause();
398 void stop();
399 EventWrapper<Scheduler, &Scheduler::pause> pauseEvent;
400 EventWrapper<Scheduler, &Scheduler::stop> stopEvent;

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

436 Process *_current;
437
438 bool initDone;
439 bool runToTime;
440 bool runOnce;
441
442 ProcessList initList;
443
400 void runReady();
401 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent;
402 void scheduleReadyEvent();
403
404 void pause();
405 void stop();
406 EventWrapper<Scheduler, &Scheduler::pause> pauseEvent;
407 EventWrapper<Scheduler, &Scheduler::stop> stopEvent;

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

443 Process *_current;
444
445 bool initDone;
446 bool runToTime;
447 bool runOnce;
448
449 ProcessList initList;
450
444 ProcessList *readyList;
445 ProcessList readyListMethods;
446 ProcessList readyListThreads;
447
448 ChannelList updateList;
449
450 std::map<::Event *, Tick> eventsToSchedule;
451};
452

--- 27 unchanged lines hidden ---
451 ProcessList readyListMethods;
452 ProcessList readyListThreads;
453
454 ChannelList updateList;
455
456 std::map<::Event *, Tick> eventsToSchedule;
457};
458

--- 27 unchanged lines hidden ---