ranksPerDimm = dir_cntrls[0].memBuffer.ranks_per_dimm
dimmsPerChannel = dir_cntrls[0].memBuffer.dimms_per_channel
- ruby_profiler = RubyProfiler(mem_cntrl_count = mcCount,
+ ruby_profiler = RubyProfiler(num_of_sequencers = len(cpu_sequencers),
+ mem_cntrl_count = mcCount,
banks_per_rank = banksPerRank,
ranks_per_dimm = ranksPerDimm,
dimms_per_channel = dimmsPerChannel)
Set::Set()
{
m_p_nArray = NULL;
- setSize(RubySystem::getNumberOfSequencers());
+ m_nArrayLen = 0;
+ m_nSize = 0;
}
// copy constructor
#include "mem/ruby/profiler/Profiler.hh"
// Helper functions
-static AccessTraceForAddress& lookupTraceForAddress(const Address& addr, Map<Address, AccessTraceForAddress>* record_map);
-static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description);
+static AccessTraceForAddress& lookupTraceForAddress(const Address& addr,
+ Map<Address,
+ AccessTraceForAddress>* record_map);
-AddressProfiler::AddressProfiler()
+static void printSorted(ostream& out,
+ int num_of_sequencers,
+ const Map<Address, AccessTraceForAddress>* record_map,
+ string description);
+
+AddressProfiler::AddressProfiler(int num_of_sequencers)
{
m_dataAccessTrace = new Map<Address, AccessTraceForAddress>;
m_macroBlockAccessTrace = new Map<Address, AccessTraceForAddress>;
m_programCounterAccessTrace = new Map<Address, AccessTraceForAddress>;
m_retryProfileMap = new Map<Address, AccessTraceForAddress>;
+ m_num_of_sequencers = num_of_sequencers;
clearStats();
}
out << "Hot Data Blocks" << endl;
out << "---------------" << endl;
out << endl;
- printSorted(out, m_dataAccessTrace, "block_address");
+ printSorted(out, m_num_of_sequencers, m_dataAccessTrace, "block_address");
out << endl;
out << "Hot MacroData Blocks" << endl;
out << "--------------------" << endl;
out << endl;
- printSorted(out, m_macroBlockAccessTrace, "macroblock_address");
+ printSorted(out, m_num_of_sequencers, m_macroBlockAccessTrace, "macroblock_address");
out << "Hot Instructions" << endl;
out << "----------------" << endl;
out << endl;
- printSorted(out, m_programCounterAccessTrace, "pc_address");
+ printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, "pc_address");
}
if (m_all_instructions){
out << "All Instructions Profile:" << endl;
out << "-------------------------" << endl;
out << endl;
- printSorted(out, m_programCounterAccessTrace, "pc_address");
+ printSorted(out, m_num_of_sequencers, m_programCounterAccessTrace, "pc_address");
out << endl;
}
m_retryProfileHisto.printPercent(out);
out << endl;
- printSorted(out, m_retryProfileMap, "block_address");
+ printSorted(out, m_num_of_sequencers, m_retryProfileMap, "block_address");
out << endl;
}
// ***** Normal Functions ******
-static void printSorted(ostream& out, const Map<Address, AccessTraceForAddress>* record_map, string description)
+static void printSorted(ostream& out,
+ int num_of_sequencers,
+ const Map<Address, AccessTraceForAddress>* record_map,
+ string description)
{
const int records_printed = 100;
// Allows us to track how many lines where touched by n processors
Vector<int64> m_touched_vec;
Vector<int64> m_touched_weighted_vec;
- m_touched_vec.setSize(RubySystem::getNumberOfSequencers()+1);
- m_touched_weighted_vec.setSize(RubySystem::getNumberOfSequencers()+1);
+ m_touched_vec.setSize(num_of_sequencers+1);
+ m_touched_weighted_vec.setSize(num_of_sequencers+1);
for (int i=0; i<m_touched_vec.size(); i++) {
m_touched_vec[i] = 0;
m_touched_weighted_vec[i] = 0;
class AddressProfiler {
public:
// Constructors
- AddressProfiler();
+ AddressProfiler(int num_of_sequencers);
// Destructor
~AddressProfiler();
bool m_hot_lines;
bool m_all_instructions;
+ int m_num_of_sequencers;
};
// Output operator declaration
m_hot_lines = p->hot_lines;
m_all_instructions = p->all_instructions;
+ m_num_of_sequencers = p->num_of_sequencers;
+
//
// Initialize the memory controller profiler structs
//
m_hot_lines = false;
m_all_instructions = false;
- m_address_profiler_ptr = new AddressProfiler;
+ m_address_profiler_ptr = new AddressProfiler(m_num_of_sequencers);
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;
+ m_inst_profiler_ptr = new AddressProfiler(m_num_of_sequencers);
m_inst_profiler_ptr -> setHotLines(m_hot_lines);
m_inst_profiler_ptr -> setAllInstructions(m_all_instructions);
}
// FIXME - avoid the repeated code
Vector<integer_t> perProcCycleCount;
- perProcCycleCount.setSize(RubySystem::getNumberOfSequencers());
+ perProcCycleCount.setSize(m_num_of_sequencers);
- for(int i=0; i < RubySystem::getNumberOfSequencers(); i++) {
+ for(int i=0; i < m_num_of_sequencers; i++) {
perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
// The +1 allows us to avoid division by zero
}
Vector<double> perProcMissesPerTrans;
- perProcCycleCount.setSize(RubySystem::getNumberOfSequencers());
- perProcCyclesPerTrans.setSize(RubySystem::getNumberOfSequencers());
- perProcMissesPerTrans.setSize(RubySystem::getNumberOfSequencers());
+ perProcCycleCount.setSize(m_num_of_sequencers);
+ perProcCyclesPerTrans.setSize(m_num_of_sequencers);
+ perProcMissesPerTrans.setSize(m_num_of_sequencers);
- for(int i=0; i < RubySystem::getNumberOfSequencers(); i++) {
+ for(int i=0; i < m_num_of_sequencers; i++) {
perProcCycleCount[i] = g_system_ptr->getCycleCount(i) - m_cycles_executed_at_start[i] + 1;
// The +1 allows us to avoid division by zero
integer_t transactions_started = m_perProcStartTransaction.sum();
integer_t transactions_ended = m_perProcEndTransaction.sum();
- double cycles_per_transaction = (transactions_ended != 0) ? (RubySystem::getNumberOfSequencers() * double(ruby_cycles)) / double(transactions_ended) : 0;
+ double cycles_per_transaction = (transactions_ended != 0) ? (m_num_of_sequencers * double(ruby_cycles)) / double(transactions_ended) : 0;
double misses_per_transaction = (transactions_ended != 0) ? double(total_misses) / double(transactions_ended) : 0;
out << "Total_misses: " << total_misses << endl;
{
m_ruby_start = g_eventQueue_ptr->getTime();
- m_cycles_executed_at_start.setSize(RubySystem::getNumberOfSequencers());
- for (int i=0; i < RubySystem::getNumberOfSequencers(); i++) {
+ m_cycles_executed_at_start.setSize(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_perProcTotalMisses.setSize(RubySystem::getNumberOfSequencers());
- m_perProcUserMisses.setSize(RubySystem::getNumberOfSequencers());
- m_perProcSupervisorMisses.setSize(RubySystem::getNumberOfSequencers());
- m_perProcStartTransaction.setSize(RubySystem::getNumberOfSequencers());
- m_perProcEndTransaction.setSize(RubySystem::getNumberOfSequencers());
+ m_perProcTotalMisses.setSize(m_num_of_sequencers);
+ m_perProcUserMisses.setSize(m_num_of_sequencers);
+ m_perProcSupervisorMisses.setSize(m_num_of_sequencers);
+ m_perProcStartTransaction.setSize(m_num_of_sequencers);
+ m_perProcEndTransaction.setSize(m_num_of_sequencers);
- for(int i=0; i < RubySystem::getNumberOfSequencers(); i++) {
+ for(int i=0; i < m_num_of_sequencers; i++) {
m_perProcTotalMisses[i] = 0;
m_perProcUserMisses[i] = 0;
m_perProcSupervisorMisses[i] = 0;
//added by SS
bool m_hot_lines;
bool m_all_instructions;
+
+ int m_num_of_sequencers;
};
// Output operator declaration
cxx_class = 'Profiler'
hot_lines = Param.Bool(False, "")
all_instructions = Param.Bool(False, "")
+ num_of_sequencers = Param.Int("")
mem_cntrl_count = Param.Int(0, "")
banks_per_rank = Param.Int("")
ranks_per_dimm = Param.Int("")
static RubyEventQueue* getEventQueue() { return g_eventQueue_ptr; }
- static int getNumberOfDirectories() { return m_directories.size(); }
- static int getNumberOfSequencers() { return m_sequencers.size(); }
-
Profiler* getProfiler() {assert(m_profiler_ptr != NULL); return m_profiler_ptr; }
static Tracer* getTracer() { assert(m_tracer_ptr != NULL); return m_tracer_ptr; }
static MemoryVector* getMemoryVector() { assert(m_mem_vec_ptr != NULL); return m_mem_vec_ptr;}