2009-05-11 19:38:43 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
This file has been modified by Kevin Moore and Dan Nussbaum of the
|
|
|
|
Scalable Systems Research Group at Sun Microsystems Laboratories
|
|
|
|
(http://research.sun.com/scalable/) to support the Adaptive
|
|
|
|
Transactional Memory Test Platform (ATMTP).
|
|
|
|
|
|
|
|
Please send email to atmtp-interest@sun.com with feedback, questions, or
|
|
|
|
to request future announcements about ATMTP.
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
|
|
|
|
File modification date: 2008-02-23
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
|
clang/gcc: Fix compilation issues with clang 3.0 and gcc 4.6
This patch addresses a number of minor issues that cause problems when
compiling with clang >= 3.0 and gcc >= 4.6. Most importantly, it
avoids using the deprecated ext/hash_map and instead uses
unordered_map (and similarly so for the hash_set). To make use of the
new STL containers, g++ and clang has to be invoked with "-std=c++0x",
and this is now added for all gcc versions >= 4.6, and for clang >=
3.0. For gcc >= 4.3 and <= 4.5 and clang <= 3.0 we use the tr1
unordered_map to avoid the deprecation warning.
The addition of c++0x in turn causes a few problems, as the
compiler is more stringent and adds a number of new warnings. Below,
the most important issues are enumerated:
1) the use of namespaces is more strict, e.g. for isnan, and all
headers opening the entire namespace std are now fixed.
2) another other issue caused by the more stringent compiler is the
narrowing of the embedded python, which used to be a char array,
and is now unsigned char since there were values larger than 128.
3) a particularly odd issue that arose with the new c++0x behaviour is
found in range.hh, where the operator< causes gcc to complain about
the template type parsing (the "<" is interpreted as the beginning
of a template argument), and the problem seems to be related to the
begin/end members introduced for the range-type iteration, which is
a new feature in c++11.
As a minor update, this patch also fixes the build flags for the clang
debug target that used to be shared with gcc and incorrectly use
"-ggdb".
2012-04-14 11:43:31 +02:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <unistd.h>
|
2010-03-11 03:33:11 +01:00
|
|
|
|
2010-06-11 08:17:07 +02:00
|
|
|
#include <algorithm>
|
2011-01-10 20:11:20 +01:00
|
|
|
#include <fstream>
|
2010-06-11 08:17:07 +02:00
|
|
|
|
|
|
|
#include "base/stl_helpers.hh"
|
2010-04-02 20:20:32 +02:00
|
|
|
#include "base/str.hh"
|
2010-03-24 06:49:43 +01:00
|
|
|
#include "mem/protocol/MachineType.hh"
|
2011-04-15 19:44:06 +02:00
|
|
|
#include "mem/protocol/RubyRequest.hh"
|
2010-03-24 06:49:43 +01:00
|
|
|
#include "mem/ruby/network/Network.hh"
|
|
|
|
#include "mem/ruby/profiler/AddressProfiler.hh"
|
|
|
|
#include "mem/ruby/profiler/Profiler.hh"
|
2013-03-22 21:53:25 +01:00
|
|
|
#include "mem/ruby/system/Sequencer.hh"
|
2010-03-24 06:49:43 +01:00
|
|
|
#include "mem/ruby/system/System.hh"
|
2010-01-30 05:29:17 +01:00
|
|
|
|
2010-04-02 20:20:32 +02:00
|
|
|
using namespace std;
|
2010-06-11 08:17:07 +02:00
|
|
|
using m5::stl_helpers::operator<<;
|
2010-04-02 20:20:32 +02:00
|
|
|
|
2010-01-30 05:29:17 +01:00
|
|
|
Profiler::Profiler(const Params *p)
|
2013-06-09 14:29:59 +02:00
|
|
|
: SimObject(p)
|
2009-05-11 19:38:43 +02:00
|
|
|
{
|
2010-03-24 06:49:43 +01:00
|
|
|
m_inst_profiler_ptr = NULL;
|
|
|
|
m_address_profiler_ptr = NULL;
|
|
|
|
m_real_time_start_time = time(NULL); // Not reset in clearStats()
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
m_hot_lines = p->hot_lines;
|
|
|
|
m_all_instructions = p->all_instructions;
|
2010-01-30 05:29:17 +01:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
m_num_of_sequencers = p->num_of_sequencers;
|
2010-01-30 05:29:21 +01:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
m_hot_lines = false;
|
|
|
|
m_all_instructions = false;
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
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);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
if (m_all_instructions) {
|
|
|
|
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);
|
|
|
|
}
|
2011-07-01 02:49:26 +02:00
|
|
|
|
|
|
|
p->ruby_system->registerProfiler(this);
|
2009-07-07 00:49:47 +02:00
|
|
|
}
|
|
|
|
|
2010-01-30 05:29:20 +01:00
|
|
|
Profiler::~Profiler()
|
|
|
|
{
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
Profiler::print(ostream& out) const
|
2009-05-11 19:38:43 +02:00
|
|
|
{
|
2010-03-24 06:49:43 +01:00
|
|
|
out << "[Profiler]";
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
|
2013-02-11 04:26:22 +01:00
|
|
|
void
|
2013-03-22 21:53:25 +01:00
|
|
|
Profiler::printRequestProfile(ostream &out) const
|
2013-02-11 04:26:22 +01:00
|
|
|
{
|
|
|
|
out << "Request vs. RubySystem State Profile" << endl;
|
|
|
|
out << "--------------------------------" << endl;
|
|
|
|
out << endl;
|
|
|
|
|
|
|
|
map<string, uint64_t> m_requestProfileMap;
|
|
|
|
uint64_t m_requests = 0;
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < MachineType_NUM; i++) {
|
|
|
|
for (map<uint32_t, AbstractController*>::iterator it =
|
|
|
|
g_abs_controls[i].begin();
|
|
|
|
it != g_abs_controls[i].end(); ++it) {
|
|
|
|
|
|
|
|
AbstractController *ctr = (*it).second;
|
|
|
|
map<string, uint64_t> mp = ctr->getRequestProfileMap();
|
|
|
|
|
|
|
|
for (map<string, uint64_t>::iterator jt = mp.begin();
|
|
|
|
jt != mp.end(); ++jt) {
|
|
|
|
|
|
|
|
map<string, uint64_t>::iterator kt =
|
|
|
|
m_requestProfileMap.find((*jt).first);
|
|
|
|
if (kt != m_requestProfileMap.end()) {
|
|
|
|
(*kt).second += (*jt).second;
|
|
|
|
} else {
|
|
|
|
m_requestProfileMap[(*jt).first] = (*jt).second;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
m_requests += ctr->getRequestCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
map<string, uint64_t>::const_iterator i = m_requestProfileMap.begin();
|
|
|
|
map<string, uint64_t>::const_iterator end = m_requestProfileMap.end();
|
|
|
|
for (; i != end; ++i) {
|
|
|
|
const string &key = i->first;
|
|
|
|
uint64_t count = i->second;
|
|
|
|
|
|
|
|
double percent = (100.0 * double(count)) / double(m_requests);
|
|
|
|
vector<string> items;
|
|
|
|
tokenize(items, key, ':');
|
|
|
|
vector<string>::iterator j = items.begin();
|
|
|
|
vector<string>::iterator end = items.end();
|
|
|
|
for (; j != end; ++i)
|
|
|
|
out << setw(10) << *j;
|
|
|
|
out << setw(11) << count;
|
|
|
|
out << setw(14) << percent << endl;
|
|
|
|
}
|
|
|
|
out << endl;
|
|
|
|
}
|
|
|
|
|
2013-02-11 04:26:22 +01:00
|
|
|
void
|
2013-03-22 21:53:25 +01:00
|
|
|
Profiler::printDelayProfile(ostream &out) const
|
2013-02-11 04:26:22 +01:00
|
|
|
{
|
|
|
|
out << "Message Delayed Cycles" << endl;
|
|
|
|
out << "----------------------" << endl;
|
|
|
|
|
|
|
|
uint32_t numVNets = Network::getNumberOfVirtualNetworks();
|
|
|
|
Histogram delayHistogram;
|
|
|
|
std::vector<Histogram> delayVCHistogram(numVNets);
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < MachineType_NUM; i++) {
|
|
|
|
for (map<uint32_t, AbstractController*>::iterator it =
|
|
|
|
g_abs_controls[i].begin();
|
|
|
|
it != g_abs_controls[i].end(); ++it) {
|
|
|
|
|
|
|
|
AbstractController *ctr = (*it).second;
|
|
|
|
delayHistogram.add(ctr->getDelayHist());
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < numVNets; i++) {
|
|
|
|
delayVCHistogram[i].add(ctr->getDelayVCHist(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out << "Total_delay_cycles: " << delayHistogram << endl;
|
|
|
|
|
|
|
|
for (int i = 0; i < numVNets; i++) {
|
|
|
|
out << " virtual_network_" << i << "_delay_cycles: "
|
|
|
|
<< delayVCHistogram[i] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-22 21:53:25 +01:00
|
|
|
void
|
|
|
|
Profiler::printOutstandingReqProfile(ostream &out) const
|
|
|
|
{
|
|
|
|
Histogram sequencerRequests;
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < MachineType_NUM; i++) {
|
|
|
|
for (map<uint32_t, AbstractController*>::iterator it =
|
|
|
|
g_abs_controls[i].begin();
|
|
|
|
it != g_abs_controls[i].end(); ++it) {
|
|
|
|
|
|
|
|
AbstractController *ctr = (*it).second;
|
|
|
|
Sequencer *seq = ctr->getSequencer();
|
|
|
|
if (seq != NULL) {
|
|
|
|
sequencerRequests.add(seq->getOutstandReqHist());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out << "sequencer_requests_outstanding: "
|
|
|
|
<< sequencerRequests << endl;
|
|
|
|
}
|
|
|
|
|
2013-06-25 07:32:03 +02:00
|
|
|
void
|
|
|
|
Profiler::printMissLatencyProfile(ostream &out) const
|
|
|
|
{
|
|
|
|
// Collate the miss latencies histograms from all the sequencers
|
|
|
|
Histogram latency_hist;
|
|
|
|
std::vector<Histogram> type_latency_hist(RubyRequestType_NUM);
|
|
|
|
|
|
|
|
Histogram hit_latency_hist;
|
|
|
|
std::vector<Histogram> hit_type_latency_hist(RubyRequestType_NUM);
|
|
|
|
|
|
|
|
std::vector<Histogram> hit_mach_latency_hist(MachineType_NUM);
|
|
|
|
std::vector<std::vector<Histogram> >
|
|
|
|
hit_type_mach_latency_hist(RubyRequestType_NUM,
|
|
|
|
std::vector<Histogram>(MachineType_NUM));
|
|
|
|
|
|
|
|
Histogram miss_latency_hist;
|
|
|
|
std::vector<Histogram> miss_type_latency_hist(RubyRequestType_NUM);
|
|
|
|
|
|
|
|
std::vector<Histogram> miss_mach_latency_hist(MachineType_NUM);
|
|
|
|
std::vector<std::vector<Histogram> >
|
|
|
|
miss_type_mach_latency_hist(RubyRequestType_NUM,
|
|
|
|
std::vector<Histogram>(MachineType_NUM));
|
|
|
|
|
|
|
|
std::vector<Histogram> issue_to_initial_delay_hist(MachineType_NUM);
|
|
|
|
std::vector<Histogram> initial_to_forward_delay_hist(MachineType_NUM);
|
|
|
|
std::vector<Histogram>
|
|
|
|
forward_to_first_response_delay_hist(MachineType_NUM);
|
|
|
|
std::vector<Histogram>
|
|
|
|
first_response_to_completion_delay_hist(MachineType_NUM);
|
|
|
|
std::vector<uint64_t> incomplete_times(MachineType_NUM);
|
|
|
|
|
|
|
|
for (uint32_t i = 0; i < MachineType_NUM; i++) {
|
|
|
|
for (map<uint32_t, AbstractController*>::iterator it =
|
|
|
|
g_abs_controls[i].begin();
|
|
|
|
it != g_abs_controls[i].end(); ++it) {
|
|
|
|
|
|
|
|
AbstractController *ctr = (*it).second;
|
|
|
|
Sequencer *seq = ctr->getSequencer();
|
|
|
|
if (seq != NULL) {
|
|
|
|
// add all the latencies
|
|
|
|
latency_hist.add(seq->getLatencyHist());
|
|
|
|
hit_latency_hist.add(seq->getHitLatencyHist());
|
|
|
|
miss_latency_hist.add(seq->getMissLatencyHist());
|
|
|
|
|
|
|
|
// add the per request type latencies
|
|
|
|
for (uint32_t j = 0; j < RubyRequestType_NUM; ++j) {
|
|
|
|
type_latency_hist[j]
|
|
|
|
.add(seq->getTypeLatencyHist(j));
|
|
|
|
hit_type_latency_hist[j]
|
|
|
|
.add(seq->getHitTypeLatencyHist(j));
|
|
|
|
miss_type_latency_hist[j]
|
|
|
|
.add(seq->getMissTypeLatencyHist(j));
|
|
|
|
}
|
|
|
|
|
|
|
|
// add the per machine type miss latencies
|
|
|
|
for (uint32_t j = 0; j < MachineType_NUM; ++j) {
|
|
|
|
hit_mach_latency_hist[j]
|
|
|
|
.add(seq->getHitMachLatencyHist(j));
|
|
|
|
miss_mach_latency_hist[j]
|
|
|
|
.add(seq->getMissMachLatencyHist(j));
|
|
|
|
|
|
|
|
issue_to_initial_delay_hist[j].add(
|
|
|
|
seq->getIssueToInitialDelayHist(MachineType(j)));
|
|
|
|
|
|
|
|
initial_to_forward_delay_hist[j].add(
|
|
|
|
seq->getInitialToForwardDelayHist(MachineType(j)));
|
|
|
|
forward_to_first_response_delay_hist[j].add(seq->
|
|
|
|
getForwardRequestToFirstResponseHist(MachineType(j)));
|
|
|
|
|
|
|
|
first_response_to_completion_delay_hist[j].add(seq->
|
|
|
|
getFirstResponseToCompletionDelayHist(MachineType(j)));
|
|
|
|
incomplete_times[j] +=
|
|
|
|
seq->getIncompleteTimes(MachineType(j));
|
|
|
|
}
|
|
|
|
|
|
|
|
// add the per (request, machine) type miss latencies
|
|
|
|
for (uint32_t j = 0; j < RubyRequestType_NUM; j++) {
|
|
|
|
for (uint32_t k = 0; k < MachineType_NUM; k++) {
|
|
|
|
hit_type_mach_latency_hist[j][k].add(
|
|
|
|
seq->getHitTypeMachLatencyHist(j,k));
|
|
|
|
miss_type_mach_latency_hist[j][k].add(
|
|
|
|
seq->getMissTypeMachLatencyHist(j,k));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out << "latency: " << latency_hist << endl;
|
|
|
|
for (int i = 0; i < RubyRequestType_NUM; i++) {
|
|
|
|
if (type_latency_hist[i].size() > 0) {
|
|
|
|
out << "latency: " << RubyRequestType(i) << ": "
|
|
|
|
<< type_latency_hist[i] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out << "hit latency: " << hit_latency_hist << endl;
|
|
|
|
for (int i = 0; i < RubyRequestType_NUM; i++) {
|
|
|
|
if (hit_type_latency_hist[i].size() > 0) {
|
|
|
|
out << "hit latency: " << RubyRequestType(i) << ": "
|
|
|
|
<< hit_type_latency_hist[i] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < MachineType_NUM; i++) {
|
|
|
|
if (hit_mach_latency_hist[i].size() > 0) {
|
|
|
|
out << "hit latency: " << MachineType(i) << ": "
|
|
|
|
<< hit_mach_latency_hist[i] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < RubyRequestType_NUM; i++) {
|
|
|
|
for (int j = 0; j < MachineType_NUM; j++) {
|
|
|
|
if (hit_type_mach_latency_hist[i][j].size() > 0) {
|
|
|
|
out << "hit latency: " << RubyRequestType(i)
|
|
|
|
<< ": " << MachineType(j) << ": "
|
|
|
|
<< hit_type_mach_latency_hist[i][j] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out << "miss latency: " << miss_latency_hist << endl;
|
|
|
|
for (int i = 0; i < RubyRequestType_NUM; i++) {
|
|
|
|
if (miss_type_latency_hist[i].size() > 0) {
|
|
|
|
out << "miss latency: " << RubyRequestType(i) << ": "
|
|
|
|
<< miss_type_latency_hist[i] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < MachineType_NUM; i++) {
|
|
|
|
if (miss_mach_latency_hist[i].size() > 0) {
|
|
|
|
out << "miss latency: " << MachineType(i) << ": "
|
|
|
|
<< miss_mach_latency_hist[i] << endl;
|
|
|
|
|
|
|
|
out << "miss latency: " << MachineType(i)
|
|
|
|
<< "::issue_to_initial_request: "
|
|
|
|
<< issue_to_initial_delay_hist[i] << endl;
|
|
|
|
out << "miss latency: " << MachineType(i)
|
|
|
|
<< "::initial_to_forward_request: "
|
|
|
|
<< initial_to_forward_delay_hist[i] << endl;
|
|
|
|
out << "miss latency: " << MachineType(i)
|
|
|
|
<< "::forward_to_first_response: "
|
|
|
|
<< forward_to_first_response_delay_hist[i] << endl;
|
|
|
|
out << "miss latency: " << MachineType(i)
|
|
|
|
<< "::first_response_to_completion: "
|
|
|
|
<< first_response_to_completion_delay_hist[i] << endl;
|
|
|
|
out << "incomplete times: " << incomplete_times[i] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < RubyRequestType_NUM; i++) {
|
|
|
|
for (int j = 0; j < MachineType_NUM; j++) {
|
|
|
|
if (miss_type_mach_latency_hist[i][j].size() > 0) {
|
|
|
|
out << "miss latency: " << RubyRequestType(i)
|
|
|
|
<< ": " << MachineType(j) << ": "
|
|
|
|
<< miss_type_mach_latency_hist[i][j] << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
out << endl;
|
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
Profiler::printStats(ostream& out, bool short_stats)
|
2009-05-11 19:38:43 +02:00
|
|
|
{
|
|
|
|
out << endl;
|
2010-03-24 06:49:43 +01:00
|
|
|
if (short_stats) {
|
|
|
|
out << "SHORT ";
|
|
|
|
}
|
|
|
|
out << "Profiler Stats" << endl;
|
|
|
|
out << "--------------" << endl;
|
|
|
|
|
2013-02-11 04:43:17 +01:00
|
|
|
Cycles ruby_cycles = g_system_ptr->curCycle()-m_ruby_start;
|
2010-03-24 06:49:43 +01:00
|
|
|
|
2013-02-11 04:43:17 +01:00
|
|
|
out << "Ruby_current_time: " << g_system_ptr->curCycle() << endl;
|
2010-03-24 06:49:43 +01:00
|
|
|
out << "Ruby_start_time: " << m_ruby_start << endl;
|
|
|
|
out << "Ruby_cycles: " << ruby_cycles << endl;
|
|
|
|
out << endl;
|
|
|
|
|
|
|
|
if (!short_stats) {
|
|
|
|
out << "Busy Controller Counts:" << endl;
|
2013-02-11 04:26:22 +01:00
|
|
|
for (uint32_t i = 0; i < MachineType_NUM; i++) {
|
|
|
|
uint32_t size = MachineType_base_count((MachineType)i);
|
|
|
|
|
|
|
|
for (uint32_t j = 0; j < size; j++) {
|
2010-03-24 06:49:43 +01:00
|
|
|
MachineID machID;
|
|
|
|
machID.type = (MachineType)i;
|
|
|
|
machID.num = j;
|
2013-02-11 04:26:22 +01:00
|
|
|
|
|
|
|
AbstractController *ctr =
|
|
|
|
(*(g_abs_controls[i].find(j))).second;
|
|
|
|
out << machID << ":" << ctr->getFullyBusyCycles() << " ";
|
2010-03-24 06:49:43 +01:00
|
|
|
if ((j + 1) % 8 == 0) {
|
|
|
|
out << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
out << endl;
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
2010-03-24 06:49:43 +01:00
|
|
|
out << endl;
|
|
|
|
|
|
|
|
out << "Busy Bank Count:" << m_busyBankCount << endl;
|
|
|
|
out << endl;
|
|
|
|
|
2013-03-22 21:53:25 +01:00
|
|
|
printOutstandingReqProfile(out);
|
2010-03-24 06:49:43 +01:00
|
|
|
out << endl;
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
if (!short_stats) {
|
|
|
|
out << "All Non-Zero Cycle Demand Cache Accesses" << endl;
|
|
|
|
out << "----------------------------------------" << endl;
|
2013-06-25 07:32:03 +02:00
|
|
|
printMissLatencyProfile(out);
|
2010-03-24 06:49:43 +01:00
|
|
|
|
|
|
|
if (m_all_sharing_histogram.size() > 0) {
|
|
|
|
out << "all_sharing: " << m_all_sharing_histogram << endl;
|
|
|
|
out << "read_sharing: " << m_read_sharing_histogram << endl;
|
|
|
|
out << "write_sharing: " << m_write_sharing_histogram << endl;
|
|
|
|
|
|
|
|
out << "all_sharing_percent: ";
|
|
|
|
m_all_sharing_histogram.printPercent(out);
|
|
|
|
out << endl;
|
|
|
|
|
|
|
|
out << "read_sharing_percent: ";
|
|
|
|
m_read_sharing_histogram.printPercent(out);
|
|
|
|
out << endl;
|
|
|
|
|
|
|
|
out << "write_sharing_percent: ";
|
|
|
|
m_write_sharing_histogram.printPercent(out);
|
|
|
|
out << endl;
|
|
|
|
|
|
|
|
int64 total_miss = m_cache_to_cache + m_memory_to_cache;
|
|
|
|
out << "all_misses: " << total_miss << endl;
|
|
|
|
out << "cache_to_cache_misses: " << m_cache_to_cache << endl;
|
|
|
|
out << "memory_to_cache_misses: " << m_memory_to_cache << endl;
|
|
|
|
out << "cache_to_cache_percent: "
|
|
|
|
<< 100.0 * (double(m_cache_to_cache) / double(total_miss))
|
|
|
|
<< endl;
|
|
|
|
out << "memory_to_cache_percent: "
|
|
|
|
<< 100.0 * (double(m_memory_to_cache) / double(total_miss))
|
|
|
|
<< endl;
|
|
|
|
out << endl;
|
|
|
|
}
|
|
|
|
|
2013-02-11 04:26:22 +01:00
|
|
|
printRequestProfile(out);
|
2010-03-24 06:49:43 +01:00
|
|
|
|
|
|
|
if (!m_all_instructions) {
|
|
|
|
m_address_profiler_ptr->printStats(out);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_all_instructions) {
|
|
|
|
m_inst_profiler_ptr->printStats(out);
|
|
|
|
}
|
|
|
|
|
|
|
|
out << endl;
|
2013-02-11 04:26:22 +01:00
|
|
|
printDelayProfile(out);
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
2010-03-24 06:49:43 +01:00
|
|
|
}
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
Profiler::clearStats()
|
|
|
|
{
|
2013-02-11 04:43:17 +01:00
|
|
|
m_ruby_start = g_system_ptr->curCycle();
|
2012-11-02 18:18:25 +01:00
|
|
|
m_real_time_start_time = time(NULL);
|
2010-03-24 06:49:43 +01:00
|
|
|
|
|
|
|
m_busyBankCount = 0;
|
|
|
|
m_read_sharing_histogram.clear();
|
|
|
|
m_write_sharing_histogram.clear();
|
|
|
|
m_all_sharing_histogram.clear();
|
|
|
|
m_cache_to_cache = 0;
|
|
|
|
m_memory_to_cache = 0;
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
// update the start time
|
2013-02-11 04:43:17 +01:00
|
|
|
m_ruby_start = g_system_ptr->curCycle();
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
2011-03-22 12:41:54 +01:00
|
|
|
Profiler::addAddressTraceSample(const RubyRequest& msg, NodeID id)
|
2009-05-11 19:38:43 +02:00
|
|
|
{
|
2011-03-20 00:34:59 +01:00
|
|
|
if (msg.getType() != RubyRequestType_IFETCH) {
|
2010-03-24 06:49:43 +01:00
|
|
|
// Note: The following line should be commented out if you
|
|
|
|
// want to use the special profiling that is part of the GS320
|
|
|
|
// protocol
|
|
|
|
|
|
|
|
// NOTE: Unless PROFILE_HOT_LINES is enabled, nothing will be
|
|
|
|
// profiled by the AddressProfiler
|
|
|
|
m_address_profiler_ptr->
|
|
|
|
addTraceSample(msg.getLineAddress(), msg.getProgramCounter(),
|
|
|
|
msg.getType(), msg.getAccessMode(), id, false);
|
|
|
|
}
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
Profiler::profileSharing(const Address& addr, AccessType type,
|
|
|
|
NodeID requestor, const Set& sharers,
|
|
|
|
const Set& owner)
|
2009-05-11 19:38:43 +02:00
|
|
|
{
|
2010-03-24 06:49:43 +01:00
|
|
|
Set set_contacted(owner);
|
|
|
|
if (type == AccessType_Write) {
|
|
|
|
set_contacted.addSet(sharers);
|
|
|
|
}
|
|
|
|
set_contacted.remove(requestor);
|
|
|
|
int number_contacted = set_contacted.count();
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
if (type == AccessType_Write) {
|
|
|
|
m_write_sharing_histogram.add(number_contacted);
|
2009-05-11 19:38:43 +02:00
|
|
|
} else {
|
2010-03-24 06:49:43 +01:00
|
|
|
m_read_sharing_histogram.add(number_contacted);
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
2010-03-24 06:49:43 +01:00
|
|
|
m_all_sharing_histogram.add(number_contacted);
|
2009-05-11 19:38:43 +02:00
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
if (number_contacted == 0) {
|
|
|
|
m_memory_to_cache++;
|
|
|
|
} else {
|
|
|
|
m_cache_to_cache++;
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
Profiler::bankBusy()
|
2009-05-11 19:38:43 +02:00
|
|
|
{
|
2010-03-24 06:49:43 +01:00
|
|
|
m_busyBankCount++;
|
2009-05-11 19:38:43 +02:00
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
void
|
|
|
|
Profiler::rubyWatch(int id)
|
|
|
|
{
|
2010-03-22 05:22:20 +01:00
|
|
|
uint64 tr = 0;
|
2009-07-07 00:49:47 +02:00
|
|
|
Address watch_address = Address(tr);
|
2010-03-24 06:49:43 +01:00
|
|
|
|
2013-02-11 04:43:17 +01:00
|
|
|
DPRINTFN("%7s %3s RUBY WATCH %d\n", g_system_ptr->curCycle(), id,
|
2011-01-10 20:11:20 +01:00
|
|
|
watch_address);
|
2009-07-07 00:49:47 +02:00
|
|
|
|
2010-06-11 08:17:07 +02:00
|
|
|
// don't care about success or failure
|
|
|
|
m_watch_address_set.insert(watch_address);
|
2009-07-07 00:49:47 +02:00
|
|
|
}
|
|
|
|
|
2010-03-24 06:49:43 +01:00
|
|
|
bool
|
|
|
|
Profiler::watchAddress(Address addr)
|
|
|
|
{
|
2010-06-11 08:17:07 +02:00
|
|
|
return m_watch_address_set.count(addr) > 0;
|
2009-07-07 00:49:47 +02:00
|
|
|
}
|
|
|
|
|
2010-01-30 05:29:17 +01:00
|
|
|
Profiler *
|
|
|
|
RubyProfilerParams::create()
|
|
|
|
{
|
|
|
|
return new Profiler(this);
|
|
|
|
}
|