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 schedule(ts, tick); |
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()) { |
255 deschedule(ts); |
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 |
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 --- |