scheduler.hh (13067:3d6ef32002ef) scheduler.hh (13069:d894ba8f881c)
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

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

220 scheduleReadyEvent();
221 return;
222 }
223
224 // Timed notification/timeout.
225 TimeSlot *&ts = timeSlots[tick];
226 if (!ts) {
227 ts = new TimeSlot;
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

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

220 scheduleReadyEvent();
221 return;
222 }
223
224 // Timed notification/timeout.
225 TimeSlot *&ts = timeSlots[tick];
226 if (!ts) {
227 ts = new TimeSlot;
228 if (initDone)
229 eq->schedule(ts, tick);
230 else
231 eventsToSchedule[ts] = tick;
228 schedule(ts, tick);
232 }
233 ts->events.insert(event);
234 }
235
236 // For descheduling delayed/timed notifications/timeouts.
237 void
238 deschedule(ScEvent *event)
239 {

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

250 "Descheduling event at time with no events.");
251 TimeSlot *ts = tsit->second;
252 ScEvents &events = ts->events;
253 events.erase(event);
254 event->deschedule();
255
256 // If no more events are happening at this time slot, get rid of it.
257 if (events.empty()) {
229 }
230 ts->events.insert(event);
231 }
232
233 // For descheduling delayed/timed notifications/timeouts.
234 void
235 deschedule(ScEvent *event)
236 {

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

247 "Descheduling event at time with no events.");
248 TimeSlot *ts = tsit->second;
249 ScEvents &events = ts->events;
250 events.erase(event);
251 event->deschedule();
252
253 // If no more events are happening at this time slot, get rid of it.
254 if (events.empty()) {
258 if (initDone)
259 eq->deschedule(ts);
260 else
261 eventsToSchedule.erase(ts);
255 deschedule(ts);
262 timeSlots.erase(tsit);
263 }
264 }
265
266 void
267 completeTimeSlot(TimeSlot *ts)
268 {
269 assert(ts == timeSlots.begin()->second);

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

323 static Priority StopPriority = DefaultPriority - 1;
324 static Priority PausePriority = DefaultPriority + 1;
325 static Priority MaxTickPriority = DefaultPriority + 2;
326 static Priority ReadyPriority = DefaultPriority + 3;
327 static Priority StarvationPriority = ReadyPriority;
328
329 EventQueue *eq;
330
256 timeSlots.erase(tsit);
257 }
258 }
259
260 void
261 completeTimeSlot(TimeSlot *ts)
262 {
263 assert(ts == timeSlots.begin()->second);

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

317 static Priority StopPriority = DefaultPriority - 1;
318 static Priority PausePriority = DefaultPriority + 1;
319 static Priority MaxTickPriority = DefaultPriority + 2;
320 static Priority ReadyPriority = DefaultPriority + 3;
321 static Priority StarvationPriority = ReadyPriority;
322
323 EventQueue *eq;
324
325 // For gem5 style events.
326 void
327 schedule(::Event *event, Tick tick)
328 {
329 if (initDone)
330 eq->schedule(event, tick);
331 else
332 eventsToSchedule[event] = tick;
333 }
334
335 void schedule(::Event *event) { schedule(event, getCurTick()); }
336
337 void
338 deschedule(::Event *event)
339 {
340 if (initDone)
341 eq->deschedule(event);
342 else
343 eventsToSchedule.erase(event);
344 }
345
331 ScEvents deltas;
332 TimeSlots timeSlots;
333
334 void runReady();
335 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent;
336 void scheduleReadyEvent();
337
338 void pause();

--- 52 unchanged lines hidden ---
346 ScEvents deltas;
347 TimeSlots timeSlots;
348
349 void runReady();
350 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent;
351 void scheduleReadyEvent();
352
353 void pause();

--- 52 unchanged lines hidden ---