1/*
2 * Copyright (c) 2012 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 19 unchanged lines hidden (view full) ---

28
29#include "mem/ruby/common/Consumer.hh"
30#include "mem/ruby/common/Global.hh"
31#include "mem/ruby/system/System.hh"
32
33void
34Consumer::scheduleEvent(Time timeDelta)
35{
36 scheduleEvent(g_system_ptr, timeDelta);
36 scheduleEventAbsolute(timeDelta + g_system_ptr->getTime());
37}
38
39void
40Consumer::scheduleEvent(EventManager *em, Time timeDelta)
41{
42 scheduleEventAbsolute(em, timeDelta + g_system_ptr->getTime());
43}
44
45void
40Consumer::scheduleEventAbsolute(Time timeAbs)
41{
48 scheduleEventAbsolute(g_system_ptr, timeAbs);
49}
50
51void
52Consumer::scheduleEventAbsolute(EventManager *em, Time timeAbs)
53{
42 Tick evt_time = g_system_ptr->clockPeriod() * timeAbs;
43 if (!alreadyScheduled(evt_time)) {
44 // This wakeup is not redundant
45 ConsumerEvent *evt = new ConsumerEvent(this);
46 assert(timeAbs > g_system_ptr->getTime());
47
48 em->schedule(evt, evt_time);
49 insertScheduledWakeupTime(evt_time);
50 }
51}