Consumer.cc (9206:f6483789d23a) Consumer.cc (9230:33eb3c8a98b9)
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{
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
37}
38
39void
40Consumer::scheduleEvent(EventManager *em, Time timeDelta)
41{
42 scheduleEventAbsolute(em, timeDelta + g_system_ptr->getTime());
43}
44
45void
46Consumer::scheduleEventAbsolute(Time timeAbs)
47{
40Consumer::scheduleEventAbsolute(Time timeAbs)
41{
48 scheduleEventAbsolute(g_system_ptr, timeAbs);
49}
50
51void
52Consumer::scheduleEventAbsolute(EventManager *em, Time timeAbs)
53{
54 Tick evt_time = g_system_ptr->clockPeriod() * timeAbs;
55 if (!alreadyScheduled(evt_time)) {
56 // This wakeup is not redundant
57 ConsumerEvent *evt = new ConsumerEvent(this);
58 assert(timeAbs > g_system_ptr->getTime());
59
60 em->schedule(evt, evt_time);
61 insertScheduledWakeupTime(evt_time);
62 }
63}
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}