Profiler.hh revision 14184
12SN/A/*
21762SN/A * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
32SN/A * All rights reserved.
42SN/A *
52SN/A * Redistribution and use in source and binary forms, with or without
62SN/A * modification, are permitted provided that the following conditions are
72SN/A * met: redistributions of source code must retain the above copyright
82SN/A * notice, this list of conditions and the following disclaimer;
92SN/A * redistributions in binary form must reproduce the above copyright
102SN/A * notice, this list of conditions and the following disclaimer in the
112SN/A * documentation and/or other materials provided with the distribution;
122SN/A * neither the name of the copyright holders nor the names of its
132SN/A * contributors may be used to endorse or promote products derived from
142SN/A * this software without specific prior written permission.
152SN/A *
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.
272665Ssaidi@eecs.umich.edu */
282665Ssaidi@eecs.umich.edu
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).
3477SN/A
3577SN/A   Please send email to atmtp-interest@sun.com with feedback, questions, or
362986Sgblack@eecs.umich.edu   to request future announcements about ATMTP.
3756SN/A
3856SN/A   ----------------------------------------------------------------------
3956SN/A
402SN/A   File modification date: 2008-02-23
412SN/A
422680Sktlim@umich.edu   ----------------------------------------------------------------------
432SN/A*/
442SN/A
451910SN/A#ifndef __MEM_RUBY_PROFILER_PROFILER_HH__
463536Sgblack@eecs.umich.edu#define __MEM_RUBY_PROFILER_PROFILER_HH__
473536Sgblack@eecs.umich.edu
482SN/A#include <map>
493536Sgblack@eecs.umich.edu#include <string>
503536Sgblack@eecs.umich.edu#include <vector>
513536Sgblack@eecs.umich.edu
523536Sgblack@eecs.umich.edu#include "base/callback.hh"
533536Sgblack@eecs.umich.edu#include "base/statistics.hh"
543536Sgblack@eecs.umich.edu#include "mem/ruby/common/MachineID.hh"
553536Sgblack@eecs.umich.edu#include "mem/ruby/protocol/AccessType.hh"
563536Sgblack@eecs.umich.edu#include "mem/ruby/protocol/PrefetchBit.hh"
573536Sgblack@eecs.umich.edu#include "mem/ruby/protocol/RubyAccessMode.hh"
583536Sgblack@eecs.umich.edu#include "mem/ruby/protocol/RubyRequestType.hh"
593536Sgblack@eecs.umich.edu#include "params/RubySystem.hh"
603536Sgblack@eecs.umich.edu
613536Sgblack@eecs.umich.educlass RubyRequest;
623536Sgblack@eecs.umich.educlass AddressProfiler;
633536Sgblack@eecs.umich.edu
643536Sgblack@eecs.umich.educlass Profiler
653536Sgblack@eecs.umich.edu{
663536Sgblack@eecs.umich.edu  public:
673536Sgblack@eecs.umich.edu    Profiler(const RubySystemParams *params, RubySystem *rs);
683536Sgblack@eecs.umich.edu    ~Profiler();
693536Sgblack@eecs.umich.edu
703536Sgblack@eecs.umich.edu    RubySystem *m_ruby_system;
713536Sgblack@eecs.umich.edu
723536Sgblack@eecs.umich.edu    void wakeup();
733536Sgblack@eecs.umich.edu    void regStats(const std::string &name);
743536Sgblack@eecs.umich.edu    void collateStats();
753536Sgblack@eecs.umich.edu
763536Sgblack@eecs.umich.edu    AddressProfiler* getAddressProfiler() { return m_address_profiler_ptr; }
773536Sgblack@eecs.umich.edu    AddressProfiler* getInstructionProfiler() { return m_inst_profiler_ptr; }
783536Sgblack@eecs.umich.edu
793536Sgblack@eecs.umich.edu    void addAddressTraceSample(const RubyRequest& msg, NodeID id);
803536Sgblack@eecs.umich.edu
813536Sgblack@eecs.umich.edu    // added by SS
823536Sgblack@eecs.umich.edu    bool getHotLines() const { return m_hot_lines; }
833536Sgblack@eecs.umich.edu    bool getAllInstructions() const { return m_all_instructions; }
843536Sgblack@eecs.umich.edu
853536Sgblack@eecs.umich.edu  private:
863536Sgblack@eecs.umich.edu    // Private copy constructor and assignment operator
871910SN/A    Profiler(const Profiler& obj);
881910SN/A    Profiler& operator=(const Profiler& obj);
891910SN/A
901910SN/A    AddressProfiler* m_address_profiler_ptr;
913536Sgblack@eecs.umich.edu    AddressProfiler* m_inst_profiler_ptr;
923536Sgblack@eecs.umich.edu
933536Sgblack@eecs.umich.edu    Stats::Histogram delayHistogram;
943536Sgblack@eecs.umich.edu    std::vector<Stats::Histogram *> delayVCHistogram;
953536Sgblack@eecs.umich.edu
963536Sgblack@eecs.umich.edu    //! Histogram for number of outstanding requests per cycle.
973536Sgblack@eecs.umich.edu    Stats::Histogram m_outstandReqHistSeqr;
983536Sgblack@eecs.umich.edu    Stats::Histogram m_outstandReqHistCoalsr;
993536Sgblack@eecs.umich.edu
1003536Sgblack@eecs.umich.edu    //! Histogram for holding latency profile of all requests.
1013536Sgblack@eecs.umich.edu    Stats::Histogram m_latencyHistSeqr;
1023536Sgblack@eecs.umich.edu    Stats::Histogram m_latencyHistCoalsr;
1033536Sgblack@eecs.umich.edu    std::vector<Stats::Histogram *> m_typeLatencyHistSeqr;
1042SN/A    std::vector<Stats::Histogram *> m_typeLatencyHistCoalsr;
1052SN/A
1062SN/A    //! Histogram for holding latency profile of all requests that
1072SN/A    //! hit in the controller connected to this sequencer.
1083536Sgblack@eecs.umich.edu    Stats::Histogram m_hitLatencyHistSeqr;
1092SN/A    std::vector<Stats::Histogram *> m_hitTypeLatencyHistSeqr;
1102SN/A
1113536Sgblack@eecs.umich.edu    //! Histograms for profiling the latencies for requests that
1122SN/A    //! did not required external messages.
1132SN/A    std::vector<Stats::Histogram *> m_hitMachLatencyHistSeqr;
1142SN/A    std::vector< std::vector<Stats::Histogram *> > m_hitTypeMachLatencyHistSeqr;
1152SN/A
1162SN/A    //! Histogram for holding latency profile of all requests that
1171910SN/A    //! miss in the controller connected to this sequencer.
1181910SN/A    Stats::Histogram m_missLatencyHistSeqr;
1192SN/A    Stats::Histogram m_missLatencyHistCoalsr;
1202SN/A    std::vector<Stats::Histogram *> m_missTypeLatencyHistSeqr;
1213536Sgblack@eecs.umich.edu    std::vector<Stats::Histogram *> m_missTypeLatencyHistCoalsr;
1222SN/A
1232SN/A    //! Histograms for profiling the latencies for requests that
1242SN/A    //! required external messages.
1252SN/A    std::vector<Stats::Histogram *> m_missMachLatencyHistSeqr;
1262SN/A    std::vector< std::vector<Stats::Histogram *> > m_missTypeMachLatencyHistSeqr;
1272SN/A    std::vector<Stats::Histogram *> m_missMachLatencyHistCoalsr;
1282SN/A    std::vector< std::vector<Stats::Histogram *> > m_missTypeMachLatencyHistCoalsr;
1292SN/A
1302SN/A    //! Histograms for recording the breakdown of miss latency
1312SN/A    std::vector<Stats::Histogram *> m_IssueToInitialDelayHistSeqr;
1322SN/A    std::vector<Stats::Histogram *> m_InitialToForwardDelayHistSeqr;
1332680Sktlim@umich.edu    std::vector<Stats::Histogram *> m_ForwardToFirstResponseDelayHistSeqr;
1342SN/A    std::vector<Stats::Histogram *> m_FirstResponseToCompletionDelayHistSeqr;
1352SN/A    Stats::Scalar m_IncompleteTimesSeqr[MachineType_NUM];
1363536Sgblack@eecs.umich.edu    std::vector<Stats::Histogram *> m_IssueToInitialDelayHistCoalsr;
1373536Sgblack@eecs.umich.edu    std::vector<Stats::Histogram *> m_InitialToForwardDelayHistCoalsr;
1383536Sgblack@eecs.umich.edu    std::vector<Stats::Histogram *> m_ForwardToFirstResponseDelayHistCoalsr;
1393536Sgblack@eecs.umich.edu    std::vector<Stats::Histogram *> m_FirstResponseToCompletionDelayHistCoalsr;
1403536Sgblack@eecs.umich.edu
1413536Sgblack@eecs.umich.edu    //added by SS
1423536Sgblack@eecs.umich.edu    const bool m_hot_lines;
1433536Sgblack@eecs.umich.edu    const bool m_all_instructions;
1443536Sgblack@eecs.umich.edu    const uint32_t m_num_vnets;
1453536Sgblack@eecs.umich.edu};
1463536Sgblack@eecs.umich.edu
1473536Sgblack@eecs.umich.edu#endif // __MEM_RUBY_PROFILER_PROFILER_HH__
1483579Sgblack@eecs.umich.edu