Profiler.cc revision 11309
16145Snate@binkert.org/*
210012Snilay@cs.wisc.edu * Copyright (c) 1999-2013 Mark D. Hill and David A. Wood
36145Snate@binkert.org * All rights reserved.
46145Snate@binkert.org *
56145Snate@binkert.org * Redistribution and use in source and binary forms, with or without
66145Snate@binkert.org * modification, are permitted provided that the following conditions are
76145Snate@binkert.org * met: redistributions of source code must retain the above copyright
86145Snate@binkert.org * notice, this list of conditions and the following disclaimer;
96145Snate@binkert.org * redistributions in binary form must reproduce the above copyright
106145Snate@binkert.org * notice, this list of conditions and the following disclaimer in the
116145Snate@binkert.org * documentation and/or other materials provided with the distribution;
126145Snate@binkert.org * neither the name of the copyright holders nor the names of its
136145Snate@binkert.org * contributors may be used to endorse or promote products derived from
146145Snate@binkert.org * this software without specific prior written permission.
156145Snate@binkert.org *
166145Snate@binkert.org * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
176145Snate@binkert.org * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
186145Snate@binkert.org * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
196145Snate@binkert.org * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
206145Snate@binkert.org * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
216145Snate@binkert.org * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
226145Snate@binkert.org * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
236145Snate@binkert.org * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
246145Snate@binkert.org * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
256145Snate@binkert.org * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
266145Snate@binkert.org * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
276145Snate@binkert.org */
286145Snate@binkert.org
296145Snate@binkert.org/*
306145Snate@binkert.org   This file has been modified by Kevin Moore and Dan Nussbaum of the
316145Snate@binkert.org   Scalable Systems Research Group at Sun Microsystems Laboratories
326145Snate@binkert.org   (http://research.sun.com/scalable/) to support the Adaptive
336145Snate@binkert.org   Transactional Memory Test Platform (ATMTP).
346145Snate@binkert.org
356145Snate@binkert.org   Please send email to atmtp-interest@sun.com with feedback, questions, or
366145Snate@binkert.org   to request future announcements about ATMTP.
376145Snate@binkert.org
386145Snate@binkert.org   ----------------------------------------------------------------------
396145Snate@binkert.org
406145Snate@binkert.org   File modification date: 2008-02-23
416145Snate@binkert.org
426145Snate@binkert.org   ----------------------------------------------------------------------
436145Snate@binkert.org*/
446145Snate@binkert.org
4511309Sdavid.hashe@amd.com#include "mem/ruby/profiler/Profiler.hh"
4611309Sdavid.hashe@amd.com
478946Sandreas.hansson@arm.com#include <sys/types.h>
488946Sandreas.hansson@arm.com#include <unistd.h>
497002Snate@binkert.org
507454Snate@binkert.org#include <algorithm>
517832Snate@binkert.org#include <fstream>
527454Snate@binkert.org
537454Snate@binkert.org#include "base/stl_helpers.hh"
547056Snate@binkert.org#include "base/str.hh"
557048Snate@binkert.org#include "mem/protocol/MachineType.hh"
568229Snate@binkert.org#include "mem/protocol/RubyRequest.hh"
577048Snate@binkert.org#include "mem/ruby/network/Network.hh"
587048Snate@binkert.org#include "mem/ruby/profiler/AddressProfiler.hh"
5911309Sdavid.hashe@amd.com#include "mem/ruby/system/GPUCoalescer.hh"
609598Snilay@cs.wisc.edu#include "mem/ruby/system/Sequencer.hh"
616876Ssteve.reinhardt@amd.com
627055Snate@binkert.orgusing namespace std;
637454Snate@binkert.orgusing m5::stl_helpers::operator<<;
647055Snate@binkert.org
6510920Sbrandon.potter@amd.comProfiler::Profiler(const RubySystemParams *p, RubySystem *rs)
6611172Snilay@cs.wisc.edu    : m_ruby_system(rs), m_hot_lines(p->hot_lines),
6711172Snilay@cs.wisc.edu      m_all_instructions(p->all_instructions),
6811172Snilay@cs.wisc.edu      m_num_vnets(p->number_of_virtual_networks)
696145Snate@binkert.org{
7010919Sbrandon.potter@amd.com    m_address_profiler_ptr = new AddressProfiler(p->num_of_sequencers, this);
717048Snate@binkert.org    m_address_profiler_ptr->setHotLines(m_hot_lines);
727048Snate@binkert.org    m_address_profiler_ptr->setAllInstructions(m_all_instructions);
736285Snate@binkert.org
747048Snate@binkert.org    if (m_all_instructions) {
7510919Sbrandon.potter@amd.com        m_inst_profiler_ptr = new AddressProfiler(p->num_of_sequencers, this);
767048Snate@binkert.org        m_inst_profiler_ptr->setHotLines(m_hot_lines);
777048Snate@binkert.org        m_inst_profiler_ptr->setAllInstructions(m_all_instructions);
787048Snate@binkert.org    }
796285Snate@binkert.org}
806285Snate@binkert.org
816889SBrad.Beckmann@amd.comProfiler::~Profiler()
826889SBrad.Beckmann@amd.com{
837048Snate@binkert.org}
847048Snate@binkert.org
857048Snate@binkert.orgvoid
8610012Snilay@cs.wisc.eduProfiler::regStats(const std::string &pName)
877048Snate@binkert.org{
8810012Snilay@cs.wisc.edu    if (!m_all_instructions) {
8910012Snilay@cs.wisc.edu        m_address_profiler_ptr->regStats(pName);
9010012Snilay@cs.wisc.edu    }
9110012Snilay@cs.wisc.edu
9210012Snilay@cs.wisc.edu    if (m_all_instructions) {
9310012Snilay@cs.wisc.edu        m_inst_profiler_ptr->regStats(pName);
9410012Snilay@cs.wisc.edu    }
9510012Snilay@cs.wisc.edu
9610012Snilay@cs.wisc.edu    delayHistogram
9710012Snilay@cs.wisc.edu        .init(10)
9810012Snilay@cs.wisc.edu        .name(pName + ".delayHist")
9910012Snilay@cs.wisc.edu        .desc("delay histogram for all message")
10010012Snilay@cs.wisc.edu        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
10110012Snilay@cs.wisc.edu
10211172Snilay@cs.wisc.edu    for (int i = 0; i < m_num_vnets; i++) {
10310012Snilay@cs.wisc.edu        delayVCHistogram.push_back(new Stats::Histogram());
10410012Snilay@cs.wisc.edu        delayVCHistogram[i]
10510012Snilay@cs.wisc.edu            ->init(10)
10610012Snilay@cs.wisc.edu            .name(pName + csprintf(".delayVCHist.vnet_%i", i))
10710012Snilay@cs.wisc.edu            .desc(csprintf("delay histogram for vnet_%i", i))
10810012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
10910012Snilay@cs.wisc.edu    }
11010012Snilay@cs.wisc.edu
11111309Sdavid.hashe@amd.com    m_outstandReqHistSeqr
11210012Snilay@cs.wisc.edu        .init(10)
11311309Sdavid.hashe@amd.com        .name(pName + ".outstanding_req_hist_seqr")
11410012Snilay@cs.wisc.edu        .desc("")
11510012Snilay@cs.wisc.edu        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
11610012Snilay@cs.wisc.edu
11711309Sdavid.hashe@amd.com    m_outstandReqHistCoalsr
11810012Snilay@cs.wisc.edu        .init(10)
11911309Sdavid.hashe@amd.com        .name(pName + ".outstanding_req_hist_coalsr")
12010012Snilay@cs.wisc.edu        .desc("")
12110012Snilay@cs.wisc.edu        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
12210012Snilay@cs.wisc.edu
12311309Sdavid.hashe@amd.com    m_latencyHistSeqr
12410012Snilay@cs.wisc.edu        .init(10)
12511309Sdavid.hashe@amd.com        .name(pName + ".latency_hist_seqr")
12610012Snilay@cs.wisc.edu        .desc("")
12710012Snilay@cs.wisc.edu        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
12810012Snilay@cs.wisc.edu
12911309Sdavid.hashe@amd.com    m_latencyHistCoalsr
13010012Snilay@cs.wisc.edu        .init(10)
13111309Sdavid.hashe@amd.com        .name(pName + ".latency_hist_coalsr")
13211309Sdavid.hashe@amd.com        .desc("")
13311309Sdavid.hashe@amd.com        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
13411309Sdavid.hashe@amd.com
13511309Sdavid.hashe@amd.com    m_hitLatencyHistSeqr
13611309Sdavid.hashe@amd.com        .init(10)
13711309Sdavid.hashe@amd.com        .name(pName + ".hit_latency_hist_seqr")
13811309Sdavid.hashe@amd.com        .desc("")
13911309Sdavid.hashe@amd.com        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
14011309Sdavid.hashe@amd.com
14111309Sdavid.hashe@amd.com    m_missLatencyHistSeqr
14211309Sdavid.hashe@amd.com        .init(10)
14311309Sdavid.hashe@amd.com        .name(pName + ".miss_latency_hist_seqr")
14411309Sdavid.hashe@amd.com        .desc("")
14511309Sdavid.hashe@amd.com        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
14611309Sdavid.hashe@amd.com
14711309Sdavid.hashe@amd.com    m_missLatencyHistCoalsr
14811309Sdavid.hashe@amd.com        .init(10)
14911309Sdavid.hashe@amd.com        .name(pName + ".miss_latency_hist_coalsr")
15010012Snilay@cs.wisc.edu        .desc("")
15110012Snilay@cs.wisc.edu        .flags(Stats::nozero | Stats::pdf | Stats::oneline);
15210012Snilay@cs.wisc.edu
15310012Snilay@cs.wisc.edu    for (int i = 0; i < RubyRequestType_NUM; i++) {
15411309Sdavid.hashe@amd.com        m_typeLatencyHistSeqr.push_back(new Stats::Histogram());
15511309Sdavid.hashe@amd.com        m_typeLatencyHistSeqr[i]
15610012Snilay@cs.wisc.edu            ->init(10)
15711309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.latency_hist_seqr",
15810012Snilay@cs.wisc.edu                                    RubyRequestType(i)))
15910012Snilay@cs.wisc.edu            .desc("")
16010012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
16110012Snilay@cs.wisc.edu
16211309Sdavid.hashe@amd.com        m_typeLatencyHistCoalsr.push_back(new Stats::Histogram());
16311309Sdavid.hashe@amd.com        m_typeLatencyHistCoalsr[i]
16410012Snilay@cs.wisc.edu            ->init(10)
16511309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.latency_hist_coalsr",
16610012Snilay@cs.wisc.edu                                    RubyRequestType(i)))
16710012Snilay@cs.wisc.edu            .desc("")
16810012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
16910012Snilay@cs.wisc.edu
17011309Sdavid.hashe@amd.com        m_hitTypeLatencyHistSeqr.push_back(new Stats::Histogram());
17111309Sdavid.hashe@amd.com        m_hitTypeLatencyHistSeqr[i]
17210012Snilay@cs.wisc.edu            ->init(10)
17311309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.hit_latency_hist_seqr",
17411309Sdavid.hashe@amd.com                                    RubyRequestType(i)))
17511309Sdavid.hashe@amd.com            .desc("")
17611309Sdavid.hashe@amd.com            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
17711309Sdavid.hashe@amd.com
17811309Sdavid.hashe@amd.com        m_missTypeLatencyHistSeqr.push_back(new Stats::Histogram());
17911309Sdavid.hashe@amd.com        m_missTypeLatencyHistSeqr[i]
18011309Sdavid.hashe@amd.com            ->init(10)
18111309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.miss_latency_hist_seqr",
18211309Sdavid.hashe@amd.com                                    RubyRequestType(i)))
18311309Sdavid.hashe@amd.com            .desc("")
18411309Sdavid.hashe@amd.com            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
18511309Sdavid.hashe@amd.com
18611309Sdavid.hashe@amd.com        m_missTypeLatencyHistCoalsr.push_back(new Stats::Histogram());
18711309Sdavid.hashe@amd.com        m_missTypeLatencyHistCoalsr[i]
18811309Sdavid.hashe@amd.com            ->init(10)
18911309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.miss_latency_hist_coalsr",
19010012Snilay@cs.wisc.edu                                    RubyRequestType(i)))
19110012Snilay@cs.wisc.edu            .desc("")
19210012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
19310012Snilay@cs.wisc.edu    }
19410012Snilay@cs.wisc.edu
19510012Snilay@cs.wisc.edu    for (int i = 0; i < MachineType_NUM; i++) {
19611309Sdavid.hashe@amd.com        m_hitMachLatencyHistSeqr.push_back(new Stats::Histogram());
19711309Sdavid.hashe@amd.com        m_hitMachLatencyHistSeqr[i]
19810012Snilay@cs.wisc.edu            ->init(10)
19911309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.hit_mach_latency_hist_seqr",
20010012Snilay@cs.wisc.edu                                    MachineType(i)))
20110012Snilay@cs.wisc.edu            .desc("")
20210012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
20310012Snilay@cs.wisc.edu
20411309Sdavid.hashe@amd.com        m_missMachLatencyHistSeqr.push_back(new Stats::Histogram());
20511309Sdavid.hashe@amd.com        m_missMachLatencyHistSeqr[i]
20610012Snilay@cs.wisc.edu            ->init(10)
20711309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.miss_mach_latency_hist_seqr",
20810012Snilay@cs.wisc.edu                                    MachineType(i)))
20910012Snilay@cs.wisc.edu            .desc("")
21010012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
21110012Snilay@cs.wisc.edu
21211309Sdavid.hashe@amd.com        m_missMachLatencyHistCoalsr.push_back(new Stats::Histogram());
21311309Sdavid.hashe@amd.com        m_missMachLatencyHistCoalsr[i]
21411309Sdavid.hashe@amd.com            ->init(10)
21511309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.miss_mach_latency_hist_coalsr",
21611309Sdavid.hashe@amd.com                                    MachineType(i)))
21711309Sdavid.hashe@amd.com            .desc("")
21811309Sdavid.hashe@amd.com            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
21911309Sdavid.hashe@amd.com
22011309Sdavid.hashe@amd.com        m_IssueToInitialDelayHistSeqr.push_back(new Stats::Histogram());
22111309Sdavid.hashe@amd.com        m_IssueToInitialDelayHistSeqr[i]
22210012Snilay@cs.wisc.edu            ->init(10)
22310012Snilay@cs.wisc.edu            .name(pName + csprintf(
22411309Sdavid.hashe@amd.com                ".%s.miss_latency_hist_seqr.issue_to_initial_request",
22510012Snilay@cs.wisc.edu                MachineType(i)))
22610012Snilay@cs.wisc.edu            .desc("")
22710012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
22810012Snilay@cs.wisc.edu
22911309Sdavid.hashe@amd.com        m_IssueToInitialDelayHistCoalsr.push_back(new Stats::Histogram());
23011309Sdavid.hashe@amd.com        m_IssueToInitialDelayHistCoalsr[i]
23110012Snilay@cs.wisc.edu            ->init(10)
23211309Sdavid.hashe@amd.com            .name(pName + csprintf(
23311309Sdavid.hashe@amd.com                ".%s.miss_latency_hist_coalsr.issue_to_initial_request",
23411309Sdavid.hashe@amd.com                MachineType(i)))
23511309Sdavid.hashe@amd.com            .desc("")
23611309Sdavid.hashe@amd.com            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
23711309Sdavid.hashe@amd.com
23811309Sdavid.hashe@amd.com        m_InitialToForwardDelayHistSeqr.push_back(new Stats::Histogram());
23911309Sdavid.hashe@amd.com        m_InitialToForwardDelayHistSeqr[i]
24011309Sdavid.hashe@amd.com            ->init(10)
24111309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.miss_latency_hist_seqr.initial_to_forward",
24210012Snilay@cs.wisc.edu                                   MachineType(i)))
24310012Snilay@cs.wisc.edu            .desc("")
24410012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
24510012Snilay@cs.wisc.edu
24611309Sdavid.hashe@amd.com        m_InitialToForwardDelayHistCoalsr.push_back(new Stats::Histogram());
24711309Sdavid.hashe@amd.com        m_InitialToForwardDelayHistCoalsr[i]
24811309Sdavid.hashe@amd.com            ->init(10)
24911309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.miss_latency_hist_coalsr.initial_to_forward",
25011309Sdavid.hashe@amd.com                                   MachineType(i)))
25111309Sdavid.hashe@amd.com            .desc("")
25211309Sdavid.hashe@amd.com            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
25311309Sdavid.hashe@amd.com
25411309Sdavid.hashe@amd.com        m_ForwardToFirstResponseDelayHistSeqr.push_back(new Stats::Histogram());
25511309Sdavid.hashe@amd.com        m_ForwardToFirstResponseDelayHistSeqr[i]
25610012Snilay@cs.wisc.edu            ->init(10)
25710012Snilay@cs.wisc.edu            .name(pName + csprintf(
25811309Sdavid.hashe@amd.com                ".%s.miss_latency_hist_seqr.forward_to_first_response",
25910012Snilay@cs.wisc.edu                MachineType(i)))
26010012Snilay@cs.wisc.edu            .desc("")
26110012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
26210012Snilay@cs.wisc.edu
26311309Sdavid.hashe@amd.com        m_ForwardToFirstResponseDelayHistCoalsr.push_back(new Stats::Histogram());
26411309Sdavid.hashe@amd.com        m_ForwardToFirstResponseDelayHistCoalsr[i]
26510012Snilay@cs.wisc.edu            ->init(10)
26610012Snilay@cs.wisc.edu            .name(pName + csprintf(
26711309Sdavid.hashe@amd.com                ".%s.miss_latency_hist_coalsr.forward_to_first_response",
26810012Snilay@cs.wisc.edu                MachineType(i)))
26910012Snilay@cs.wisc.edu            .desc("")
27010012Snilay@cs.wisc.edu            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
27110012Snilay@cs.wisc.edu
27211309Sdavid.hashe@amd.com        m_FirstResponseToCompletionDelayHistSeqr.push_back(new Stats::Histogram());
27311309Sdavid.hashe@amd.com        m_FirstResponseToCompletionDelayHistSeqr[i]
27411309Sdavid.hashe@amd.com            ->init(10)
27511309Sdavid.hashe@amd.com            .name(pName + csprintf(
27611309Sdavid.hashe@amd.com                ".%s.miss_latency_hist_seqr.first_response_to_completion",
27711309Sdavid.hashe@amd.com                MachineType(i)))
27811309Sdavid.hashe@amd.com            .desc("")
27911309Sdavid.hashe@amd.com            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
28011309Sdavid.hashe@amd.com
28111309Sdavid.hashe@amd.com        m_FirstResponseToCompletionDelayHistCoalsr.push_back(new Stats::Histogram());
28211309Sdavid.hashe@amd.com        m_FirstResponseToCompletionDelayHistCoalsr[i]
28311309Sdavid.hashe@amd.com            ->init(10)
28411309Sdavid.hashe@amd.com            .name(pName + csprintf(
28511309Sdavid.hashe@amd.com                ".%s.miss_latency_hist_coalsr.first_response_to_completion",
28611309Sdavid.hashe@amd.com                MachineType(i)))
28711309Sdavid.hashe@amd.com            .desc("")
28811309Sdavid.hashe@amd.com            .flags(Stats::nozero | Stats::pdf | Stats::oneline);
28911309Sdavid.hashe@amd.com
29011309Sdavid.hashe@amd.com        m_IncompleteTimesSeqr[i]
29111309Sdavid.hashe@amd.com            .name(pName + csprintf(".%s.incomplete_times_seqr", MachineType(i)))
29210012Snilay@cs.wisc.edu            .desc("")
29310012Snilay@cs.wisc.edu            .flags(Stats::nozero);
29410012Snilay@cs.wisc.edu    }
29510012Snilay@cs.wisc.edu
29610012Snilay@cs.wisc.edu    for (int i = 0; i < RubyRequestType_NUM; i++) {
29711309Sdavid.hashe@amd.com        m_hitTypeMachLatencyHistSeqr.push_back(std::vector<Stats::Histogram *>());
29811309Sdavid.hashe@amd.com        m_missTypeMachLatencyHistSeqr.push_back(std::vector<Stats::Histogram *>());
29911309Sdavid.hashe@amd.com        m_missTypeMachLatencyHistCoalsr.push_back(std::vector<Stats::Histogram *>());
30010012Snilay@cs.wisc.edu
30110012Snilay@cs.wisc.edu        for (int j = 0; j < MachineType_NUM; j++) {
30211309Sdavid.hashe@amd.com            m_hitTypeMachLatencyHistSeqr[i].push_back(new Stats::Histogram());
30311309Sdavid.hashe@amd.com            m_hitTypeMachLatencyHistSeqr[i][j]
30410012Snilay@cs.wisc.edu                ->init(10)
30511309Sdavid.hashe@amd.com                .name(pName + csprintf(".%s.%s.hit_type_mach_latency_hist_seqr",
30610012Snilay@cs.wisc.edu                                       RubyRequestType(i), MachineType(j)))
30710012Snilay@cs.wisc.edu                .desc("")
30810012Snilay@cs.wisc.edu                .flags(Stats::nozero | Stats::pdf | Stats::oneline);
30910012Snilay@cs.wisc.edu
31011309Sdavid.hashe@amd.com            m_missTypeMachLatencyHistSeqr[i].push_back(new Stats::Histogram());
31111309Sdavid.hashe@amd.com            m_missTypeMachLatencyHistSeqr[i][j]
31210012Snilay@cs.wisc.edu                ->init(10)
31311309Sdavid.hashe@amd.com                .name(pName + csprintf(".%s.%s.miss_type_mach_latency_hist_seqr",
31411309Sdavid.hashe@amd.com                                       RubyRequestType(i), MachineType(j)))
31511309Sdavid.hashe@amd.com                .desc("")
31611309Sdavid.hashe@amd.com                .flags(Stats::nozero | Stats::pdf | Stats::oneline);
31711309Sdavid.hashe@amd.com
31811309Sdavid.hashe@amd.com            m_missTypeMachLatencyHistCoalsr[i].push_back(new Stats::Histogram());
31911309Sdavid.hashe@amd.com            m_missTypeMachLatencyHistCoalsr[i][j]
32011309Sdavid.hashe@amd.com                ->init(10)
32111309Sdavid.hashe@amd.com                .name(pName + csprintf(".%s.%s.miss_type_mach_latency_hist_coalsr",
32210012Snilay@cs.wisc.edu                                       RubyRequestType(i), MachineType(j)))
32310012Snilay@cs.wisc.edu                .desc("")
32410012Snilay@cs.wisc.edu                .flags(Stats::nozero | Stats::pdf | Stats::oneline);
32510012Snilay@cs.wisc.edu        }
32610012Snilay@cs.wisc.edu    }
3277048Snate@binkert.org}
3287048Snate@binkert.org
3297048Snate@binkert.orgvoid
33010012Snilay@cs.wisc.eduProfiler::collateStats()
3319496Snilay@cs.wisc.edu{
33210012Snilay@cs.wisc.edu    if (!m_all_instructions) {
33310012Snilay@cs.wisc.edu        m_address_profiler_ptr->collateStats();
3349496Snilay@cs.wisc.edu    }
3359496Snilay@cs.wisc.edu
33610012Snilay@cs.wisc.edu    if (m_all_instructions) {
33710012Snilay@cs.wisc.edu        m_inst_profiler_ptr->collateStats();
3389496Snilay@cs.wisc.edu    }
3399497Snilay@cs.wisc.edu
3409497Snilay@cs.wisc.edu    for (uint32_t i = 0; i < MachineType_NUM; i++) {
3419497Snilay@cs.wisc.edu        for (map<uint32_t, AbstractController*>::iterator it =
34210920Sbrandon.potter@amd.com                  m_ruby_system->m_abstract_controls[i].begin();
34310920Sbrandon.potter@amd.com             it != m_ruby_system->m_abstract_controls[i].end(); ++it) {
3449497Snilay@cs.wisc.edu
3459497Snilay@cs.wisc.edu            AbstractController *ctr = (*it).second;
3469497Snilay@cs.wisc.edu            delayHistogram.add(ctr->getDelayHist());
3479497Snilay@cs.wisc.edu
34811172Snilay@cs.wisc.edu            for (uint32_t i = 0; i < m_num_vnets; i++) {
34910012Snilay@cs.wisc.edu                delayVCHistogram[i]->add(ctr->getDelayVCHist(i));
3509497Snilay@cs.wisc.edu            }
3519497Snilay@cs.wisc.edu        }
3529497Snilay@cs.wisc.edu    }
3539497Snilay@cs.wisc.edu
3549598Snilay@cs.wisc.edu    for (uint32_t i = 0; i < MachineType_NUM; i++) {
3559598Snilay@cs.wisc.edu        for (map<uint32_t, AbstractController*>::iterator it =
35610920Sbrandon.potter@amd.com                m_ruby_system->m_abstract_controls[i].begin();
35710920Sbrandon.potter@amd.com                it != m_ruby_system->m_abstract_controls[i].end(); ++it) {
3589598Snilay@cs.wisc.edu
3599598Snilay@cs.wisc.edu            AbstractController *ctr = (*it).second;
36011308Santhony.gutierrez@amd.com            Sequencer *seq = ctr->getCPUSequencer();
3619598Snilay@cs.wisc.edu            if (seq != NULL) {
36211309Sdavid.hashe@amd.com                m_outstandReqHistSeqr.add(seq->getOutstandReqHist());
36311309Sdavid.hashe@amd.com            }
36411309Sdavid.hashe@amd.com            GPUCoalescer *coal = ctr->getGPUCoalescer();
36511309Sdavid.hashe@amd.com            if (coal != NULL) {
36611309Sdavid.hashe@amd.com                m_outstandReqHistCoalsr.add(coal->getOutstandReqHist());
3679598Snilay@cs.wisc.edu            }
3689598Snilay@cs.wisc.edu        }
3699598Snilay@cs.wisc.edu    }
3709598Snilay@cs.wisc.edu
3719773Snilay@cs.wisc.edu    for (uint32_t i = 0; i < MachineType_NUM; i++) {
3729773Snilay@cs.wisc.edu        for (map<uint32_t, AbstractController*>::iterator it =
37310920Sbrandon.potter@amd.com                m_ruby_system->m_abstract_controls[i].begin();
37410920Sbrandon.potter@amd.com                it != m_ruby_system->m_abstract_controls[i].end(); ++it) {
3759773Snilay@cs.wisc.edu
3769773Snilay@cs.wisc.edu            AbstractController *ctr = (*it).second;
37711308Santhony.gutierrez@amd.com            Sequencer *seq = ctr->getCPUSequencer();
3789773Snilay@cs.wisc.edu            if (seq != NULL) {
3799773Snilay@cs.wisc.edu                // add all the latencies
38011309Sdavid.hashe@amd.com                m_latencyHistSeqr.add(seq->getLatencyHist());
38111309Sdavid.hashe@amd.com                m_hitLatencyHistSeqr.add(seq->getHitLatencyHist());
38211309Sdavid.hashe@amd.com                m_missLatencyHistSeqr.add(seq->getMissLatencyHist());
3839773Snilay@cs.wisc.edu
3849773Snilay@cs.wisc.edu                // add the per request type latencies
3859773Snilay@cs.wisc.edu                for (uint32_t j = 0; j < RubyRequestType_NUM; ++j) {
38611309Sdavid.hashe@amd.com                    m_typeLatencyHistSeqr[j]
38710012Snilay@cs.wisc.edu                        ->add(seq->getTypeLatencyHist(j));
38811309Sdavid.hashe@amd.com                    m_hitTypeLatencyHistSeqr[j]
38910012Snilay@cs.wisc.edu                        ->add(seq->getHitTypeLatencyHist(j));
39011309Sdavid.hashe@amd.com                    m_missTypeLatencyHistSeqr[j]
39110012Snilay@cs.wisc.edu                        ->add(seq->getMissTypeLatencyHist(j));
3929773Snilay@cs.wisc.edu                }
3939773Snilay@cs.wisc.edu
3949773Snilay@cs.wisc.edu                // add the per machine type miss latencies
3959773Snilay@cs.wisc.edu                for (uint32_t j = 0; j < MachineType_NUM; ++j) {
39611309Sdavid.hashe@amd.com                    m_hitMachLatencyHistSeqr[j]
39710012Snilay@cs.wisc.edu                        ->add(seq->getHitMachLatencyHist(j));
39811309Sdavid.hashe@amd.com                    m_missMachLatencyHistSeqr[j]
39910012Snilay@cs.wisc.edu                        ->add(seq->getMissMachLatencyHist(j));
4009773Snilay@cs.wisc.edu
40111309Sdavid.hashe@amd.com                    m_IssueToInitialDelayHistSeqr[j]->add(
4029773Snilay@cs.wisc.edu                        seq->getIssueToInitialDelayHist(MachineType(j)));
4039773Snilay@cs.wisc.edu
40411309Sdavid.hashe@amd.com                    m_InitialToForwardDelayHistSeqr[j]->add(
4059773Snilay@cs.wisc.edu                        seq->getInitialToForwardDelayHist(MachineType(j)));
40611309Sdavid.hashe@amd.com                    m_ForwardToFirstResponseDelayHistSeqr[j]->add(seq->
4079773Snilay@cs.wisc.edu                        getForwardRequestToFirstResponseHist(MachineType(j)));
4089773Snilay@cs.wisc.edu
40911309Sdavid.hashe@amd.com                    m_FirstResponseToCompletionDelayHistSeqr[j]->add(seq->
41010012Snilay@cs.wisc.edu                        getFirstResponseToCompletionDelayHist(
41110012Snilay@cs.wisc.edu                            MachineType(j)));
41211309Sdavid.hashe@amd.com                    m_IncompleteTimesSeqr[j] +=
4139773Snilay@cs.wisc.edu                        seq->getIncompleteTimes(MachineType(j));
4149773Snilay@cs.wisc.edu                }
4159773Snilay@cs.wisc.edu
4169773Snilay@cs.wisc.edu                // add the per (request, machine) type miss latencies
4179773Snilay@cs.wisc.edu                for (uint32_t j = 0; j < RubyRequestType_NUM; j++) {
4189773Snilay@cs.wisc.edu                    for (uint32_t k = 0; k < MachineType_NUM; k++) {
41911309Sdavid.hashe@amd.com                        m_hitTypeMachLatencyHistSeqr[j][k]->add(
42010012Snilay@cs.wisc.edu                                seq->getHitTypeMachLatencyHist(j,k));
42111309Sdavid.hashe@amd.com                        m_missTypeMachLatencyHistSeqr[j][k]->add(
42210012Snilay@cs.wisc.edu                                seq->getMissTypeMachLatencyHist(j,k));
4239773Snilay@cs.wisc.edu                    }
4249773Snilay@cs.wisc.edu                }
4259773Snilay@cs.wisc.edu            }
42611309Sdavid.hashe@amd.com
42711309Sdavid.hashe@amd.com            GPUCoalescer *coal = ctr->getGPUCoalescer();
42811309Sdavid.hashe@amd.com            if (coal != NULL) {
42911309Sdavid.hashe@amd.com                // add all the latencies
43011309Sdavid.hashe@amd.com                m_latencyHistCoalsr.add(coal->getLatencyHist());
43111309Sdavid.hashe@amd.com                m_missLatencyHistCoalsr.add(coal->getMissLatencyHist());
43211309Sdavid.hashe@amd.com
43311309Sdavid.hashe@amd.com                // add the per request type latencies
43411309Sdavid.hashe@amd.com                for (uint32_t j = 0; j < RubyRequestType_NUM; ++j) {
43511309Sdavid.hashe@amd.com                    m_typeLatencyHistCoalsr[j]
43611309Sdavid.hashe@amd.com                        ->add(coal->getTypeLatencyHist(j));
43711309Sdavid.hashe@amd.com                    m_missTypeLatencyHistCoalsr[j]
43811309Sdavid.hashe@amd.com                        ->add(coal->getMissTypeLatencyHist(j));
43911309Sdavid.hashe@amd.com                }
44011309Sdavid.hashe@amd.com
44111309Sdavid.hashe@amd.com                // add the per machine type miss latencies
44211309Sdavid.hashe@amd.com                for (uint32_t j = 0; j < MachineType_NUM; ++j) {
44311309Sdavid.hashe@amd.com                    m_missMachLatencyHistCoalsr[j]
44411309Sdavid.hashe@amd.com                        ->add(coal->getMissMachLatencyHist(j));
44511309Sdavid.hashe@amd.com
44611309Sdavid.hashe@amd.com                    m_IssueToInitialDelayHistCoalsr[j]->add(
44711309Sdavid.hashe@amd.com                        coal->getIssueToInitialDelayHist(MachineType(j)));
44811309Sdavid.hashe@amd.com
44911309Sdavid.hashe@amd.com                    m_InitialToForwardDelayHistCoalsr[j]->add(
45011309Sdavid.hashe@amd.com                        coal->getInitialToForwardDelayHist(MachineType(j)));
45111309Sdavid.hashe@amd.com                    m_ForwardToFirstResponseDelayHistCoalsr[j]->add(coal->
45211309Sdavid.hashe@amd.com                        getForwardRequestToFirstResponseHist(MachineType(j)));
45311309Sdavid.hashe@amd.com
45411309Sdavid.hashe@amd.com                    m_FirstResponseToCompletionDelayHistCoalsr[j]->add(coal->
45511309Sdavid.hashe@amd.com                        getFirstResponseToCompletionDelayHist(
45611309Sdavid.hashe@amd.com                            MachineType(j)));
45711309Sdavid.hashe@amd.com                }
45811309Sdavid.hashe@amd.com
45911309Sdavid.hashe@amd.com                // add the per (request, machine) type miss latencies
46011309Sdavid.hashe@amd.com                for (uint32_t j = 0; j < RubyRequestType_NUM; j++) {
46111309Sdavid.hashe@amd.com                    for (uint32_t k = 0; k < MachineType_NUM; k++) {
46211309Sdavid.hashe@amd.com                        m_missTypeMachLatencyHistCoalsr[j][k]->add(
46311309Sdavid.hashe@amd.com                                coal->getMissTypeMachLatencyHist(j,k));
46411309Sdavid.hashe@amd.com                    }
46511309Sdavid.hashe@amd.com                }
46611309Sdavid.hashe@amd.com            }
4679773Snilay@cs.wisc.edu        }
4689773Snilay@cs.wisc.edu    }
4696145Snate@binkert.org}
4706145Snate@binkert.org
4717048Snate@binkert.orgvoid
4728174Snilay@cs.wisc.eduProfiler::addAddressTraceSample(const RubyRequest& msg, NodeID id)
4736145Snate@binkert.org{
4748165Snilay@cs.wisc.edu    if (msg.getType() != RubyRequestType_IFETCH) {
4757048Snate@binkert.org        // Note: The following line should be commented out if you
4767048Snate@binkert.org        // want to use the special profiling that is part of the GS320
4777048Snate@binkert.org        // protocol
4786145Snate@binkert.org
4797048Snate@binkert.org        // NOTE: Unless PROFILE_HOT_LINES is enabled, nothing will be
4807048Snate@binkert.org        // profiled by the AddressProfiler
4817048Snate@binkert.org        m_address_profiler_ptr->
4827048Snate@binkert.org            addTraceSample(msg.getLineAddress(), msg.getProgramCounter(),
4837048Snate@binkert.org                           msg.getType(), msg.getAccessMode(), id, false);
4847048Snate@binkert.org    }
4856145Snate@binkert.org}
486