diff options
Diffstat (limited to 'src/mem/ruby/profiler')
-rw-r--r-- | src/mem/ruby/profiler/Profiler.cc | 26 | ||||
-rw-r--r-- | src/mem/ruby/profiler/Profiler.hh | 19 | ||||
-rw-r--r-- | src/mem/ruby/profiler/StoreTrace.cc | 6 | ||||
-rw-r--r-- | src/mem/ruby/profiler/StoreTrace.hh | 1 |
4 files changed, 31 insertions, 21 deletions
diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc index c3c337a3c..2ab68d249 100644 --- a/src/mem/ruby/profiler/Profiler.cc +++ b/src/mem/ruby/profiler/Profiler.cc @@ -67,7 +67,7 @@ static double process_memory_total(); static double process_memory_resident(); Profiler::Profiler(const Params *p) - : SimObject(p) + : SimObject(p), m_event(this) { m_inst_profiler_ptr = NULL; m_address_profiler_ptr = NULL; @@ -113,13 +113,13 @@ Profiler::wakeup() for (int i = 0; i < m_num_of_sequencers; i++) { perProcCycleCount[i] = - g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1; + g_system_ptr->getTime() - m_cycles_executed_at_start[i] + 1; // The +1 allows us to avoid division by zero } ostream &out = *m_periodic_output_file_ptr; - out << "ruby_cycles: " << g_eventQueue_ptr->getTime()-m_ruby_start << endl + out << "ruby_cycles: " << g_system_ptr->getTime()-m_ruby_start << endl << "mbytes_resident: " << process_memory_resident() << endl << "mbytes_total: " << process_memory_total() << endl; @@ -137,7 +137,7 @@ Profiler::wakeup() } //g_system_ptr->getNetwork()->printStats(out); - g_eventQueue_ptr->scheduleEvent(this, m_stats_period); + schedule(m_event, curTick() + m_stats_period * g_system_ptr->getClock()); } void @@ -151,7 +151,7 @@ Profiler::setPeriodicStatsFile(const string& filename) } m_periodic_output_file_ptr = new ofstream(filename.c_str()); - g_eventQueue_ptr->scheduleEvent(this, 1); + schedule(m_event, curTick() + g_system_ptr->getClock()); } void @@ -161,7 +161,7 @@ Profiler::setPeriodicStatsInterval(integer_t period) << " Ruby cycles" << endl; m_stats_period = period; - g_eventQueue_ptr->scheduleEvent(this, 1); + schedule(m_event, curTick() + g_system_ptr->getClock()); } void @@ -185,7 +185,7 @@ Profiler::printStats(ostream& out, bool short_stats) double minutes = seconds / 60.0; double hours = minutes / 60.0; double days = hours / 24.0; - Time ruby_cycles = g_eventQueue_ptr->getTime()-m_ruby_start; + Time ruby_cycles = g_system_ptr->getTime()-m_ruby_start; if (!short_stats) { out << "Elapsed_time_in_seconds: " << seconds << endl; @@ -208,7 +208,7 @@ Profiler::printStats(ostream& out, bool short_stats) out << "Virtual_time_in_days: " << days << endl; out << endl; - out << "Ruby_current_time: " << g_eventQueue_ptr->getTime() << endl; + out << "Ruby_current_time: " << g_system_ptr->getTime() << endl; out << "Ruby_start_time: " << m_ruby_start << endl; out << "Ruby_cycles: " << ruby_cycles << endl; out << endl; @@ -227,7 +227,7 @@ Profiler::printStats(ostream& out, bool short_stats) for (int i = 0; i < m_num_of_sequencers; i++) { perProcCycleCount[i] = - g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1; + g_system_ptr->getTime() - m_cycles_executed_at_start[i] + 1; // The +1 allows us to avoid division by zero } @@ -437,14 +437,14 @@ Profiler::printResourceUsage(ostream& out) const void Profiler::clearStats() { - m_ruby_start = g_eventQueue_ptr->getTime(); + m_ruby_start = g_system_ptr->getTime(); m_cycles_executed_at_start.resize(m_num_of_sequencers); for (int i = 0; i < m_num_of_sequencers; i++) { if (g_system_ptr == NULL) { m_cycles_executed_at_start[i] = 0; } else { - m_cycles_executed_at_start[i] = g_system_ptr->getCycleCount(i); + m_cycles_executed_at_start[i] = g_system_ptr->getTime(); } } @@ -524,7 +524,7 @@ Profiler::clearStats() //g_eventQueue_ptr->triggerAllEvents(); // update the start time - m_ruby_start = g_eventQueue_ptr->getTime(); + m_ruby_start = g_system_ptr->getTime(); } void @@ -723,7 +723,7 @@ Profiler::rubyWatch(int id) uint64 tr = 0; Address watch_address = Address(tr); - DPRINTFN("%7s %3s RUBY WATCH %d\n", g_eventQueue_ptr->getTime(), id, + DPRINTFN("%7s %3s RUBY WATCH %d\n", g_system_ptr->getTime(), id, watch_address); // don't care about success or failure diff --git a/src/mem/ruby/profiler/Profiler.hh b/src/mem/ruby/profiler/Profiler.hh index 7945b6c73..58043dfaf 100644 --- a/src/mem/ruby/profiler/Profiler.hh +++ b/src/mem/ruby/profiler/Profiler.hh @@ -58,7 +58,6 @@ #include "mem/protocol/RubyAccessMode.hh" #include "mem/protocol/RubyRequestType.hh" #include "mem/ruby/common/Address.hh" -#include "mem/ruby/common/Consumer.hh" #include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Histogram.hh" #include "mem/ruby/common/Set.hh" @@ -70,7 +69,7 @@ class RubyRequest; class AddressProfiler; -class Profiler : public SimObject, public Consumer +class Profiler : public SimObject { public: typedef RubyProfilerParams Params; @@ -244,6 +243,20 @@ class Profiler : public SimObject, public Consumer bool m_all_instructions; int m_num_of_sequencers; + + protected: + class ProfileEvent : public Event + { + public: + ProfileEvent(Profiler *_profiler) + { + profiler = _profiler; + } + private: + void process() { profiler->wakeup(); } + Profiler *profiler; + }; + ProfileEvent m_event; }; inline std::ostream& @@ -255,5 +268,3 @@ operator<<(std::ostream& out, const Profiler& obj) } #endif // __MEM_RUBY_PROFILER_PROFILER_HH__ - - diff --git a/src/mem/ruby/profiler/StoreTrace.cc b/src/mem/ruby/profiler/StoreTrace.cc index bcd90ab9d..84b05ea86 100644 --- a/src/mem/ruby/profiler/StoreTrace.cc +++ b/src/mem/ruby/profiler/StoreTrace.cc @@ -26,8 +26,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "mem/ruby/eventqueue/RubyEventQueue.hh" #include "mem/ruby/profiler/StoreTrace.hh" +#include "sim/core.hh" using namespace std; @@ -105,7 +105,7 @@ StoreTrace::clearSummary() void StoreTrace::store(NodeID node) { - Time current = g_eventQueue_ptr->getTime(); + Tick current = curTick(); assert((m_last_writer == -1) || (m_last_writer == node)); @@ -127,7 +127,7 @@ void StoreTrace::downgrade(NodeID node) { if (node == m_last_writer) { - Time current = g_eventQueue_ptr->getTime(); + Time current = curTick(); assert(m_stores_this_interval != 0); assert(m_last_store != 0); assert(m_first_store != 0); diff --git a/src/mem/ruby/profiler/StoreTrace.hh b/src/mem/ruby/profiler/StoreTrace.hh index 9c0945c15..293871723 100644 --- a/src/mem/ruby/profiler/StoreTrace.hh +++ b/src/mem/ruby/profiler/StoreTrace.hh @@ -32,7 +32,6 @@ #include <iostream> #include "mem/ruby/common/Address.hh" -#include "mem/ruby/common/Global.hh" #include "mem/ruby/common/Histogram.hh" class StoreTrace |