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 --- 32 unchanged lines hidden (view full) --- 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), 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 56 // clear themselves out after the scheduler goes away. 57 clear(); --- 202 unchanged lines hidden (view full) --- 260 deschedule(&readyEvent); 261 } 262} 263 264void 265Scheduler::runReady() 266{ 267 bool empty = readyList.empty(); |
268 lastReadyTick = getCurTick(); |
269 270 // The evaluation phase. 271 do { 272 yield(); 273 } while (!readyList.empty()); 274 |
275 if (!empty) { |
276 _numCycles++; |
277 _changeStamp++; 278 } |
279 280 // The update phase. 281 update(); 282 283 // The delta phase. 284 for (auto &e: deltas) 285 e->run(); 286 deltas.clear(); --- 45 unchanged lines hidden (view full) --- 332 scMain = Fiber::currentFiber(); 333 334 _started = true; 335 _paused = false; 336 _stopped = false; 337 runToTime = run_to_time; 338 339 maxTick = max_tick; |
340 lastReadyTick = getCurTick(); |
341 342 if (initDone) { 343 if (!runToTime && starved()) 344 scheduleStarvationEvent(); 345 kernel->status(::sc_core::SC_RUNNING); 346 } 347 348 schedule(&maxTickEvent, maxTick); --- 48 unchanged lines hidden --- |