diff options
Diffstat (limited to 'src/cpu/base.cc')
-rw-r--r-- | src/cpu/base.cc | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/cpu/base.cc b/src/cpu/base.cc index 78b25caf8..6f76b8c6f 100644 --- a/src/cpu/base.cc +++ b/src/cpu/base.cc @@ -248,7 +248,9 @@ BaseCPU::BaseCPU(Params *p, bool is_checker) if (FullSystem) { if (params()->profile) - profileEvent = new ProfileEvent(this, params()->profile); + profileEvent = new EventFunctionWrapper( + [this]{ processProfileEvent(); }, + name()); } tracer = params()->tracer; @@ -658,21 +660,15 @@ BaseCPU::flushTLBs() } } - -BaseCPU::ProfileEvent::ProfileEvent(BaseCPU *_cpu, Tick _interval) - : cpu(_cpu), interval(_interval) -{ } - void -BaseCPU::ProfileEvent::process() +BaseCPU::processProfileEvent() { - ThreadID size = cpu->threadContexts.size(); - for (ThreadID i = 0; i < size; ++i) { - ThreadContext *tc = cpu->threadContexts[i]; - tc->profileSample(); - } + ThreadID size = threadContexts.size(); + + for (ThreadID i = 0; i < size; ++i) + threadContexts[i]->profileSample(); - cpu->schedule(this, curTick() + interval); + schedule(profileEvent, curTick() + params()->profile); } void |