summaryrefslogtreecommitdiff
path: root/src/mem/ruby/profiler
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2010-01-29 20:29:17 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2010-01-29 20:29:17 -0800
commit98c94cfe3ce83634f3bad79ca18263f42e36ca6a (patch)
treeb299448162932c5574b87238a3b02a01efd14db6 /src/mem/ruby/profiler
parentb43994ba45b7805da0d1d9600e5cbb8332057403 (diff)
downloadgem5-98c94cfe3ce83634f3bad79ca18263f42e36ca6a.tar.xz
ruby: Convert most Ruby objects to M5 SimObjects.
The necessary companion conversion of Ruby objects generated by SLICC are converted to M5 SimObjects in the following patch, so this patch alone does not compile. Conversion of Garnet network models is also handled in a separate patch; that code is temporarily disabled from compiling to allow testing of interim code.
Diffstat (limited to 'src/mem/ruby/profiler')
-rw-r--r--src/mem/ruby/profiler/Profiler.cc27
-rw-r--r--src/mem/ruby/profiler/Profiler.hh10
-rw-r--r--src/mem/ruby/profiler/Profiler.py8
-rw-r--r--src/mem/ruby/profiler/SConscript2
4 files changed, 30 insertions, 17 deletions
diff --git a/src/mem/ruby/profiler/Profiler.cc b/src/mem/ruby/profiler/Profiler.cc
index d5c47825f..c6fbd1aa4 100644
--- a/src/mem/ruby/profiler/Profiler.cc
+++ b/src/mem/ruby/profiler/Profiler.cc
@@ -63,6 +63,8 @@
#include "mem/ruby/common/Debug.hh"
#include "mem/protocol/MachineType.hh"
+#include "mem/ruby/system/System.hh"
+
// Allows use of times() library call, which determines virtual runtime
#include <sys/times.h>
@@ -71,9 +73,9 @@ extern std::ostream * debug_cout_ptr;
static double process_memory_total();
static double process_memory_resident();
-Profiler::Profiler(const string & name)
+Profiler::Profiler(const Params *p)
+ : SimObject(p)
{
- m_name = name;
m_requestProfileMap_ptr = new Map<string, int>;
m_inst_profiler_ptr = NULL;
@@ -83,6 +85,10 @@ Profiler::Profiler(const string & name)
m_stats_period = 1000000; // Default
m_periodic_output_file_ptr = &cerr;
+ m_hot_lines = p->hot_lines;
+ m_all_instructions = p->all_instructions;
+
+ RubySystem::m_profiler_ptr = this;
}
Profiler::~Profiler()
@@ -136,17 +142,6 @@ void Profiler::init(const vector<string> & argv, vector<string> memory_control_n
m_hot_lines = false;
m_all_instructions = false;
- for (size_t i=0; i<argv.size(); i+=2) {
- if ( argv[i] == "hot_lines") {
- m_hot_lines = (argv[i+1]=="true");
- } else if ( argv[i] == "all_instructions") {
- m_all_instructions = (argv[i+1]=="true");
- }else {
- cerr << "WARNING: Profiler: Unkown configuration parameter: " << argv[i] << endl;
- assert(false);
- }
- }
-
m_address_profiler_ptr = new AddressProfiler;
m_address_profiler_ptr -> setHotLines(m_hot_lines);
m_address_profiler_ptr -> setAllInstructions(m_all_instructions);
@@ -849,3 +844,9 @@ void Profiler::profileMemArbWait(string name, int cycles) { assert(m_memory_co
void Profiler::profileMemRandBusy(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memRandBusy++; }
void Profiler::profileMemNotOld(string name) { assert(m_memory_control_profilers.count(name) == 1); m_memory_control_profilers[name] -> m_memNotOld++; }
+
+Profiler *
+RubyProfilerParams::create()
+{
+ return new Profiler(this);
+}
diff --git a/src/mem/ruby/profiler/Profiler.hh b/src/mem/ruby/profiler/Profiler.hh
index 673051db3..8bc8de591 100644
--- a/src/mem/ruby/profiler/Profiler.hh
+++ b/src/mem/ruby/profiler/Profiler.hh
@@ -71,6 +71,9 @@
#include "mem/protocol/GenericRequestType.hh"
#include "mem/ruby/system/MemoryControl.hh"
+#include "params/RubyProfiler.hh"
+#include "sim/sim_object.hh"
+
class CacheMsg;
class AddressProfiler;
@@ -99,10 +102,11 @@ struct memory_control_profiler {
};
-class Profiler : public Consumer {
+class Profiler : public SimObject, public Consumer {
public:
// Constructors
- Profiler(const string & name);
+ typedef RubyProfilerParams Params;
+ Profiler(const Params *);
void init(const vector<string> & argv, vector<string> memory_control_names);
@@ -260,8 +264,6 @@ private:
//added by SS
bool m_hot_lines;
bool m_all_instructions;
- string m_name;
-
};
// Output operator declaration
diff --git a/src/mem/ruby/profiler/Profiler.py b/src/mem/ruby/profiler/Profiler.py
new file mode 100644
index 000000000..7923f28f1
--- /dev/null
+++ b/src/mem/ruby/profiler/Profiler.py
@@ -0,0 +1,8 @@
+from m5.params import *
+from m5.SimObject import SimObject
+
+class RubyProfiler(SimObject):
+ type = 'RubyProfiler'
+ cxx_class = 'Profiler'
+ hot_lines = Param.Bool(False, "")
+ all_instructions = Param.Bool(False, "")
diff --git a/src/mem/ruby/profiler/SConscript b/src/mem/ruby/profiler/SConscript
index 008a36a29..41481e3ca 100644
--- a/src/mem/ruby/profiler/SConscript
+++ b/src/mem/ruby/profiler/SConscript
@@ -33,6 +33,8 @@ Import('*')
if not env['RUBY']:
Return()
+SimObject('Profiler.py')
+
Source('AccessTraceForAddress.cc')
Source('AddressProfiler.cc')
Source('CacheProfiler.cc')