summaryrefslogtreecommitdiff
path: root/src/mem/ruby/profiler
diff options
context:
space:
mode:
authorBrandon Potter <brandon.potter@amd.com>2015-07-10 16:05:23 -0500
committerBrandon Potter <brandon.potter@amd.com>2015-07-10 16:05:23 -0500
commitf9a370f1728fe5d752fa6962ba23774eec8c883e (patch)
treea81a0331b75c72ec801d1ecf1ce62a8bc6f3d112 /src/mem/ruby/profiler
parentc38f5098b152ea1e1dde96220d3f9e50d3411780 (diff)
downloadgem5-f9a370f1728fe5d752fa6962ba23774eec8c883e.tar.xz
ruby: replace global g_system_ptr with per-object pointers
This is another step in the process of removing global variables from Ruby to enable multiple RubySystem instances in a single simulation. With possibly multiple RubySystem objects, we can no longer use a global variable to find "the" RubySystem object. Instead, each Ruby component has to carry a pointer to the RubySystem object to which it belongs.
Diffstat (limited to 'src/mem/ruby/profiler')
-rw-r--r--src/mem/ruby/profiler/AddressProfiler.cc18
-rw-r--r--src/mem/ruby/profiler/AddressProfiler.hh8
-rw-r--r--src/mem/ruby/profiler/Profiler.cc5
-rw-r--r--src/mem/ruby/profiler/Profiler.hh2
4 files changed, 17 insertions, 16 deletions
diff --git a/src/mem/ruby/profiler/AddressProfiler.cc b/src/mem/ruby/profiler/AddressProfiler.cc
index 0d5d135eb..a2e41ee76 100644
--- a/src/mem/ruby/profiler/AddressProfiler.cc
+++ b/src/mem/ruby/profiler/AddressProfiler.cc
@@ -32,7 +32,6 @@
#include "mem/protocol/RubyRequest.hh"
#include "mem/ruby/profiler/AddressProfiler.hh"
#include "mem/ruby/profiler/Profiler.hh"
-#include "mem/ruby/system/System.hh"
using namespace std;
typedef AddressProfiler::AddressMap AddressMap;
@@ -64,7 +63,7 @@ lookupTraceForAddress(const Address& addr, AddressMap& record_map)
void
printSorted(ostream& out, int num_of_sequencers, const AddressMap &record_map,
- string description)
+ string description, Profiler *profiler)
{
const int records_printed = 100;
@@ -82,7 +81,7 @@ printSorted(ostream& out, int num_of_sequencers, const AddressMap &record_map,
out << "Total_entries_" << description << ": " << record_map.size()
<< endl;
- if (g_system_ptr->getProfiler()->getAllInstructions())
+ if (profiler->getAllInstructions())
out << "Total_Instructions_" << description << ": " << misses << endl;
else
out << "Total_data_misses_" << description << ": " << misses << endl;
@@ -143,7 +142,8 @@ printSorted(ostream& out, int num_of_sequencers, const AddressMap &record_map,
<< endl;
}
-AddressProfiler::AddressProfiler(int num_of_sequencers)
+AddressProfiler::AddressProfiler(int num_of_sequencers, Profiler *profiler)
+ : m_profiler(profiler)
{
m_num_of_sequencers = num_of_sequencers;
clearStats();
@@ -183,20 +183,20 @@ AddressProfiler::printStats(ostream& out) const
out << "---------------" << endl;
out << endl;
printSorted(out, m_num_of_sequencers, m_dataAccessTrace,
- "block_address");
+ "block_address", m_profiler);
out << endl;
out << "Hot MacroData Blocks" << endl;
out << "--------------------" << endl;
out << endl;
printSorted(out, m_num_of_sequencers, m_macroBlockAccessTrace,
- "macroblock_address");
+ "macroblock_address", m_profiler);
out << "Hot Instructions" << endl;
out << "----------------" << endl;
out << endl;
printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace,
- "pc_address");
+ "pc_address", m_profiler);
}
if (m_all_instructions) {
@@ -205,7 +205,7 @@ AddressProfiler::printStats(ostream& out) const
out << "-------------------------" << endl;
out << endl;
printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace,
- "pc_address");
+ "pc_address", m_profiler);
out << endl;
}
@@ -222,7 +222,7 @@ AddressProfiler::printStats(ostream& out) const
out << endl;
printSorted(out, m_num_of_sequencers, m_retryProfileMap,
- "block_address");
+ "block_address", m_profiler);
out << endl;
}
}
diff --git a/src/mem/ruby/profiler/AddressProfiler.hh b/src/mem/ruby/profiler/AddressProfiler.hh
index 9bf1d517d..ff9b39e81 100644
--- a/src/mem/ruby/profiler/AddressProfiler.hh
+++ b/src/mem/ruby/profiler/AddressProfiler.hh
@@ -35,9 +35,9 @@
#include "mem/protocol/AccessType.hh"
#include "mem/protocol/RubyRequest.hh"
#include "mem/ruby/common/Address.hh"
-#include "mem/ruby/common/Global.hh"
#include "mem/ruby/common/Histogram.hh"
#include "mem/ruby/profiler/AccessTraceForAddress.hh"
+#include "mem/ruby/profiler/Profiler.hh"
class Set;
@@ -47,7 +47,7 @@ class AddressProfiler
typedef m5::hash_map<Address, AccessTraceForAddress> AddressMap;
public:
- AddressProfiler(int num_of_sequencers);
+ AddressProfiler(int num_of_sequencers, Profiler *profiler);
~AddressProfiler();
void printStats(std::ostream& out) const;
@@ -87,6 +87,8 @@ class AddressProfiler
Histogram m_getx_sharing_histogram;
Histogram m_gets_sharing_histogram;
+ Profiler *m_profiler;
+
//added by SS
bool m_hot_lines;
bool m_all_instructions;
@@ -100,7 +102,7 @@ AccessTraceForAddress& lookupTraceForAddress(const Address& addr,
void printSorted(std::ostream& out, int num_of_sequencers,
const AddressProfiler::AddressMap &record_map,
- std::string description);
+ std::string description, Profiler *profiler);
inline std::ostream&
operator<<(std::ostream& out, const AddressProfiler& obj)
diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc
index f078ef2c1..070db6807 100644
--- a/src/mem/ruby/profiler/Profiler.cc
+++ b/src/mem/ruby/profiler/Profiler.cc
@@ -56,7 +56,6 @@
#include "mem/ruby/profiler/AddressProfiler.hh"
#include "mem/ruby/profiler/Profiler.hh"
#include "mem/ruby/system/Sequencer.hh"
-#include "mem/ruby/system/System.hh"
using namespace std;
using m5::stl_helpers::operator<<;
@@ -66,12 +65,12 @@ Profiler::Profiler(const RubySystemParams *p)
m_hot_lines = p->hot_lines;
m_all_instructions = p->all_instructions;
- m_address_profiler_ptr = new AddressProfiler(p->num_of_sequencers);
+ m_address_profiler_ptr = new AddressProfiler(p->num_of_sequencers, this);
m_address_profiler_ptr->setHotLines(m_hot_lines);
m_address_profiler_ptr->setAllInstructions(m_all_instructions);
if (m_all_instructions) {
- m_inst_profiler_ptr = new AddressProfiler(p->num_of_sequencers);
+ m_inst_profiler_ptr = new AddressProfiler(p->num_of_sequencers, this);
m_inst_profiler_ptr->setHotLines(m_hot_lines);
m_inst_profiler_ptr->setAllInstructions(m_all_instructions);
}
diff --git a/src/mem/ruby/profiler/Profiler.hh b/src/mem/ruby/profiler/Profiler.hh
index 07d1411c0..5b1c9fe1e 100644
--- a/src/mem/ruby/profiler/Profiler.hh
+++ b/src/mem/ruby/profiler/Profiler.hh
@@ -66,7 +66,7 @@ class AddressProfiler;
class Profiler
{
public:
- Profiler(const RubySystemParams *);
+ Profiler(const RubySystemParams *params);
~Profiler();
void wakeup();