From a503a24d97b29ef246330e95dab77669a0a4256c Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 22 Sep 2018 04:51:29 -0700 Subject: [PATCH] systemc: Don't schedule the ready event unnecessarily. If we're already going to process the thing we'd be scheduling it to process, just let the existing invocation get to it. Change-Id: Ifeebc80903065567fc0eed02beefec6156b22ff7 Reviewed-on: https://gem5-review.googlesource.com/c/12964 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/core/scheduler.cc | 10 +++++++--- src/systemc/core/scheduler.hh | 9 ++++++--- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 9deb07733..ae1aa899f 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -193,7 +193,8 @@ Scheduler::ready(Process *p) else readyListThreads.pushLast(p); - scheduleReadyEvent(); + if (!inEvaluate()) + scheduleReadyEvent(); } void @@ -234,7 +235,8 @@ void Scheduler::requestUpdate(Channel *c) { updateList.pushLast(c); - scheduleReadyEvent(); + if (!inEvaluate()) + scheduleReadyEvent(); } void @@ -274,8 +276,10 @@ Scheduler::runReady() _changeStamp++; } - if (_stopNow) + if (_stopNow) { + status(StatusOther); return; + } runUpdate(); runDelta(); diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh index ad1467ea1..8015260a3 100644 --- a/src/systemc/core/scheduler.hh +++ b/src/systemc/core/scheduler.hh @@ -231,7 +231,8 @@ class Scheduler // Delta notification/timeout. if (delay.value() == 0) { event->schedule(deltas, tick); - scheduleReadyEvent(); + if (!inEvaluate() && !inUpdate()) + scheduleReadyEvent(); return; } @@ -331,8 +332,9 @@ class Scheduler enum Status { StatusOther = 0, - StatusDelta, + StatusEvaluate, StatusUpdate, + StatusDelta, StatusTiming, StatusPaused, StatusStopped @@ -343,8 +345,9 @@ class Scheduler bool paused() { return status() == StatusPaused; } bool stopped() { return status() == StatusStopped; } - bool inDelta() { return status() == StatusDelta; } + bool inEvaluate() { return status() == StatusEvaluate; } bool inUpdate() { return status() == StatusUpdate; } + bool inDelta() { return status() == StatusDelta; } bool inTiming() { return status() == StatusTiming; } uint64_t changeStamp() { return _changeStamp; } -- 2.30.2