scheduler.hh (12985:ec84697e4e63) | scheduler.hh (12987:97fbdee919d8) |
---|---|
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 --- 201 unchanged lines hidden (view full) --- 210 211 // Tell the scheduler than an event fired for bookkeeping purposes. 212 void 213 eventHappened() 214 { 215 auto it = pendingTicks.begin(); 216 if (--it->second == 0) 217 pendingTicks.erase(it); | 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 --- 201 unchanged lines hidden (view full) --- 210 211 // Tell the scheduler than an event fired for bookkeeping purposes. 212 void 213 eventHappened() 214 { 215 auto it = pendingTicks.begin(); 216 if (--it->second == 0) 217 pendingTicks.erase(it); |
218 219 if (starved() && !runToTime) 220 scheduleStarvationEvent(); |
|
218 } 219 220 // Pending activity ignores gem5 activity, much like how a systemc 221 // simulation wouldn't know about asynchronous external events (socket IO 222 // for instance) that might happen before time advances in a pure 223 // systemc simulation. Also the spec lists what specific types of pending 224 // activity needs to be counted, which obviously doesn't include gem5 225 // events. --- 46 unchanged lines hidden (view full) --- 272 273 private: 274 typedef const EventBase::Priority Priority; 275 static Priority DefaultPriority = EventBase::Default_Pri; 276 277 static Priority StopPriority = DefaultPriority - 1; 278 static Priority PausePriority = DefaultPriority + 1; 279 static Priority ReadyPriority = DefaultPriority + 2; | 221 } 222 223 // Pending activity ignores gem5 activity, much like how a systemc 224 // simulation wouldn't know about asynchronous external events (socket IO 225 // for instance) that might happen before time advances in a pure 226 // systemc simulation. Also the spec lists what specific types of pending 227 // activity needs to be counted, which obviously doesn't include gem5 228 // events. --- 46 unchanged lines hidden (view full) --- 275 276 private: 277 typedef const EventBase::Priority Priority; 278 static Priority DefaultPriority = EventBase::Default_Pri; 279 280 static Priority StopPriority = DefaultPriority - 1; 281 static Priority PausePriority = DefaultPriority + 1; 282 static Priority ReadyPriority = DefaultPriority + 2; |
283 static Priority StarvationPriority = ReadyPriority; |
|
280 static Priority MaxTickPriority = DefaultPriority + 3; 281 282 EventQueue *eq; 283 std::map<Tick, int> pendingTicks; 284 285 void runReady(); 286 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent; 287 void scheduleReadyEvent(); 288 289 void pause(); 290 void stop(); 291 EventWrapper<Scheduler, &Scheduler::pause> pauseEvent; 292 EventWrapper<Scheduler, &Scheduler::stop> stopEvent; 293 Fiber *scMain; 294 | 284 static Priority MaxTickPriority = DefaultPriority + 3; 285 286 EventQueue *eq; 287 std::map<Tick, int> pendingTicks; 288 289 void runReady(); 290 EventWrapper<Scheduler, &Scheduler::runReady> readyEvent; 291 void scheduleReadyEvent(); 292 293 void pause(); 294 void stop(); 295 EventWrapper<Scheduler, &Scheduler::pause> pauseEvent; 296 EventWrapper<Scheduler, &Scheduler::stop> stopEvent; 297 Fiber *scMain; 298 |
299 bool 300 starved() 301 { 302 return (readyList.empty() && updateList.empty() && 303 (pendingTicks.empty() || 304 pendingTicks.begin()->first > maxTick) && 305 initList.empty()); 306 } 307 EventWrapper<Scheduler, &Scheduler::pause> starvationEvent; 308 void scheduleStarvationEvent(); 309 |
|
295 bool _started; 296 bool _paused; 297 bool _stopped; 298 299 Tick maxTick; 300 EventWrapper<Scheduler, &Scheduler::pause> maxTickEvent; 301 302 uint64_t _numCycles; 303 304 Process *_current; 305 306 bool initReady; | 310 bool _started; 311 bool _paused; 312 bool _stopped; 313 314 Tick maxTick; 315 EventWrapper<Scheduler, &Scheduler::pause> maxTickEvent; 316 317 uint64_t _numCycles; 318 319 Process *_current; 320 321 bool initReady; |
322 bool runToTime; |
|
307 308 ProcessList initList; 309 ProcessList toFinalize; 310 ProcessList readyList; 311 312 ChannelList updateList; 313 314 std::map<::Event *, Tick> eventsToSchedule; 315}; 316 317extern Scheduler scheduler; 318 319} // namespace sc_gem5 320 321#endif // __SYSTEMC_CORE_SCHEDULER_H__ | 323 324 ProcessList initList; 325 ProcessList toFinalize; 326 ProcessList readyList; 327 328 ChannelList updateList; 329 330 std::map<::Event *, Tick> eventsToSchedule; 331}; 332 333extern Scheduler scheduler; 334 335} // namespace sc_gem5 336 337#endif // __SYSTEMC_CORE_SCHEDULER_H__ |