Profiler.hh revision 14184
12SN/A/*
28707Sandreas.hansson@arm.com * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
38707Sandreas.hansson@arm.com * All rights reserved.
48707Sandreas.hansson@arm.com *
58707Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without
68707Sandreas.hansson@arm.com * modification, are permitted provided that the following conditions are
78707Sandreas.hansson@arm.com * met: redistributions of source code must retain the above copyright
88707Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer;
98707Sandreas.hansson@arm.com * redistributions in binary form must reproduce the above copyright
108707Sandreas.hansson@arm.com * notice, this list of conditions and the following disclaimer in the
118707Sandreas.hansson@arm.com * documentation and/or other materials provided with the distribution;
128707Sandreas.hansson@arm.com * neither the name of the copyright holders nor the names of its
138707Sandreas.hansson@arm.com * contributors may be used to endorse or promote products derived from
141762SN/A * this software without specific prior written permission.
157897Shestness@cs.utexas.edu *
162SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
172SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
182SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
192SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
202SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
212SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
222SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
232SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
242SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
252SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
262SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272SN/A */
282SN/A
292SN/A/*
302SN/A   This file has been modified by Kevin Moore and Dan Nussbaum of the
312SN/A   Scalable Systems Research Group at Sun Microsystems Laboratories
322SN/A   (http://research.sun.com/scalable/) to support the Adaptive
332SN/A   Transactional Memory Test Platform (ATMTP).
342SN/A
352SN/A   Please send email to atmtp-interest@sun.com with feedback, questions, or
362SN/A   to request future announcements about ATMTP.
372SN/A
382SN/A   ----------------------------------------------------------------------
392SN/A
402665Ssaidi@eecs.umich.edu   File modification date: 2008-02-23
412665Ssaidi@eecs.umich.edu
422665Ssaidi@eecs.umich.edu   ----------------------------------------------------------------------
437897Shestness@cs.utexas.edu*/
442SN/A
452SN/A#ifndef __MEM_RUBY_PROFILER_PROFILER_HH__
461717SN/A#define __MEM_RUBY_PROFILER_PROFILER_HH__
471717SN/A
482SN/A#include <map>
492SN/A#include <string>
502SN/A#include <vector>
518745Sgblack@eecs.umich.edu
524182Sgblack@eecs.umich.edu#include "base/callback.hh"
535664Sgblack@eecs.umich.edu#include "base/statistics.hh"
54707SN/A#include "mem/ruby/common/MachineID.hh"
556658Snate@binkert.org#include "mem/ruby/protocol/AccessType.hh"
568229Snate@binkert.org#include "mem/ruby/protocol/PrefetchBit.hh"
5756SN/A#include "mem/ruby/protocol/RubyAccessMode.hh"
588779Sgblack@eecs.umich.edu#include "mem/ruby/protocol/RubyRequestType.hh"
594776Sgblack@eecs.umich.edu#include "params/RubySystem.hh"
602SN/A
618901Sandreas.hansson@arm.comclass RubyRequest;
622190SN/Aclass AddressProfiler;
632315SN/A
642680Sktlim@umich.educlass Profiler
652SN/A{
662SN/A  public:
672356SN/A    Profiler(const RubySystemParams *params, RubySystem *rs);
682356SN/A    ~Profiler();
692356SN/A
706144Sksewell@umich.edu    RubySystem *m_ruby_system;
712356SN/A
722356SN/A    void wakeup();
736144Sksewell@umich.edu    void regStats(const std::string &name);
742356SN/A    void collateStats();
752356SN/A
766144Sksewell@umich.edu    AddressProfiler* getAddressProfiler() { return m_address_profiler_ptr; }
772356SN/A    AddressProfiler* getInstructionProfiler() { return m_inst_profiler_ptr; }
782356SN/A
792356SN/A    void addAddressTraceSample(const RubyRequest& msg, NodeID id);
806144Sksewell@umich.edu
816144Sksewell@umich.edu    // added by SS
826144Sksewell@umich.edu    bool getHotLines() const { return m_hot_lines; }
836144Sksewell@umich.edu    bool getAllInstructions() const { return m_all_instructions; }
846144Sksewell@umich.edu
855336Shines@cs.fsu.edu  private:
862356SN/A    // Private copy constructor and assignment operator
872356SN/A    Profiler(const Profiler& obj);
882856Srdreslin@umich.edu    Profiler& operator=(const Profiler& obj);
892SN/A
901634SN/A    AddressProfiler* m_address_profiler_ptr;
919157Sandreas.hansson@arm.com    AddressProfiler* m_inst_profiler_ptr;
923814Ssaidi@eecs.umich.edu
933814Ssaidi@eecs.umich.edu    Stats::Histogram delayHistogram;
945712Shsul@eecs.umich.edu    std::vector<Stats::Histogram *> delayVCHistogram;
955712Shsul@eecs.umich.edu
965715Shsul@eecs.umich.edu    //! Histogram for number of outstanding requests per cycle.
975712Shsul@eecs.umich.edu    Stats::Histogram m_outstandReqHistSeqr;
985712Shsul@eecs.umich.edu    Stats::Histogram m_outstandReqHistCoalsr;
991634SN/A
1008832SAli.Saidi@ARM.com    //! Histogram for holding latency profile of all requests.
1018832SAli.Saidi@ARM.com    Stats::Histogram m_latencyHistSeqr;
1028832SAli.Saidi@ARM.com    Stats::Histogram m_latencyHistCoalsr;
1038832SAli.Saidi@ARM.com    std::vector<Stats::Histogram *> m_typeLatencyHistSeqr;
1048832SAli.Saidi@ARM.com    std::vector<Stats::Histogram *> m_typeLatencyHistCoalsr;
1058832SAli.Saidi@ARM.com
1068707Sandreas.hansson@arm.com    //! Histogram for holding latency profile of all requests that
1078707Sandreas.hansson@arm.com    //! hit in the controller connected to this sequencer.
1088707Sandreas.hansson@arm.com    Stats::Histogram m_hitLatencyHistSeqr;
1098707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_hitTypeLatencyHistSeqr;
1108707Sandreas.hansson@arm.com
1118707Sandreas.hansson@arm.com    //! Histograms for profiling the latencies for requests that
1128707Sandreas.hansson@arm.com    //! did not required external messages.
1138707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_hitMachLatencyHistSeqr;
1148922Swilliam.wang@arm.com    std::vector< std::vector<Stats::Histogram *> > m_hitTypeMachLatencyHistSeqr;
1158707Sandreas.hansson@arm.com
1168707Sandreas.hansson@arm.com    //! Histogram for holding latency profile of all requests that
1178707Sandreas.hansson@arm.com    //! miss in the controller connected to this sequencer.
1188707Sandreas.hansson@arm.com    Stats::Histogram m_missLatencyHistSeqr;
1198707Sandreas.hansson@arm.com    Stats::Histogram m_missLatencyHistCoalsr;
1208707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_missTypeLatencyHistSeqr;
1218707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_missTypeLatencyHistCoalsr;
1228707Sandreas.hansson@arm.com
1238707Sandreas.hansson@arm.com    //! Histograms for profiling the latencies for requests that
1248707Sandreas.hansson@arm.com    //! required external messages.
1258922Swilliam.wang@arm.com    std::vector<Stats::Histogram *> m_missMachLatencyHistSeqr;
1268707Sandreas.hansson@arm.com    std::vector< std::vector<Stats::Histogram *> > m_missTypeMachLatencyHistSeqr;
1278707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_missMachLatencyHistCoalsr;
1288707Sandreas.hansson@arm.com    std::vector< std::vector<Stats::Histogram *> > m_missTypeMachLatencyHistCoalsr;
1298707Sandreas.hansson@arm.com
1308975Sandreas.hansson@arm.com    //! Histograms for recording the breakdown of miss latency
1318707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_IssueToInitialDelayHistSeqr;
1328707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_InitialToForwardDelayHistSeqr;
1338707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_ForwardToFirstResponseDelayHistSeqr;
1348948Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_FirstResponseToCompletionDelayHistSeqr;
1358707Sandreas.hansson@arm.com    Stats::Scalar m_IncompleteTimesSeqr[MachineType_NUM];
1368707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_IssueToInitialDelayHistCoalsr;
1378707Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_InitialToForwardDelayHistCoalsr;
1381634SN/A    std::vector<Stats::Histogram *> m_ForwardToFirstResponseDelayHistCoalsr;
1398850Sandreas.hansson@arm.com    std::vector<Stats::Histogram *> m_FirstResponseToCompletionDelayHistCoalsr;
1408850Sandreas.hansson@arm.com
1418850Sandreas.hansson@arm.com    //added by SS
1428850Sandreas.hansson@arm.com    const bool m_hot_lines;
1438850Sandreas.hansson@arm.com    const bool m_all_instructions;
1448850Sandreas.hansson@arm.com    const uint32_t m_num_vnets;
1458850Sandreas.hansson@arm.com};
1468850Sandreas.hansson@arm.com
1478850Sandreas.hansson@arm.com#endif // __MEM_RUBY_PROFILER_PROFILER_HH__
1488850Sandreas.hansson@arm.com