Profiler.hh revision 10301
16145Snate@binkert.org/*
26145Snate@binkert.org * Copyright (c) 1999-2008 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/*
306284Snate@binkert.org   This file has been modified by Kevin Moore and Dan Nussbaum of the
316284Snate@binkert.org   Scalable Systems Research Group at Sun Microsystems Laboratories
326284Snate@binkert.org   (http://research.sun.com/scalable/) to support the Adaptive
336284Snate@binkert.org   Transactional Memory Test Platform (ATMTP).
346145Snate@binkert.org
356284Snate@binkert.org   Please send email to atmtp-interest@sun.com with feedback, questions, or
366284Snate@binkert.org   to request future announcements about ATMTP.
376145Snate@binkert.org
386284Snate@binkert.org   ----------------------------------------------------------------------
396145Snate@binkert.org
406284Snate@binkert.org   File modification date: 2008-02-23
416145Snate@binkert.org
426284Snate@binkert.org   ----------------------------------------------------------------------
436145Snate@binkert.org*/
446145Snate@binkert.org
457048Snate@binkert.org#ifndef __MEM_RUBY_PROFILER_PROFILER_HH__
467048Snate@binkert.org#define __MEM_RUBY_PROFILER_PROFILER_HH__
476145Snate@binkert.org
487455Snate@binkert.org#include <map>
497055Snate@binkert.org#include <string>
507454Snate@binkert.org#include <vector>
517055Snate@binkert.org
5210012Snilay@cs.wisc.edu#include "base/callback.hh"
537455Snate@binkert.org#include "base/hashmap.hh"
5410012Snilay@cs.wisc.edu#include "base/statistics.hh"
556154Snate@binkert.org#include "mem/protocol/AccessType.hh"
566154Snate@binkert.org#include "mem/protocol/PrefetchBit.hh"
578229Snate@binkert.org#include "mem/protocol/RubyAccessMode.hh"
588229Snate@binkert.org#include "mem/protocol/RubyRequestType.hh"
597048Snate@binkert.org#include "mem/ruby/common/Global.hh"
6010301Snilay@cs.wisc.edu#include "mem/ruby/common/MachineID.hh"
6110012Snilay@cs.wisc.edu#include "params/RubySystem.hh"
626876Ssteve.reinhardt@amd.com
638174Snilay@cs.wisc.educlass RubyRequest;
646145Snate@binkert.orgclass AddressProfiler;
656145Snate@binkert.org
6610012Snilay@cs.wisc.educlass Profiler
677048Snate@binkert.org{
687048Snate@binkert.org  public:
6910012Snilay@cs.wisc.edu    Profiler(const RubySystemParams *);
707048Snate@binkert.org    ~Profiler();
716145Snate@binkert.org
727048Snate@binkert.org    void wakeup();
7310012Snilay@cs.wisc.edu    void regStats(const std::string &name);
7410012Snilay@cs.wisc.edu    void collateStats();
756145Snate@binkert.org
767048Snate@binkert.org    AddressProfiler* getAddressProfiler() { return m_address_profiler_ptr; }
777048Snate@binkert.org    AddressProfiler* getInstructionProfiler() { return m_inst_profiler_ptr; }
786145Snate@binkert.org
798174Snilay@cs.wisc.edu    void addAddressTraceSample(const RubyRequest& msg, NodeID id);
806145Snate@binkert.org
817048Snate@binkert.org    // added by SS
827048Snate@binkert.org    bool getHotLines() { return m_hot_lines; }
837048Snate@binkert.org    bool getAllInstructions() { return m_all_instructions; }
846145Snate@binkert.org
857048Snate@binkert.org  private:
867048Snate@binkert.org    // Private copy constructor and assignment operator
877048Snate@binkert.org    Profiler(const Profiler& obj);
887048Snate@binkert.org    Profiler& operator=(const Profiler& obj);
896145Snate@binkert.org
907048Snate@binkert.org    AddressProfiler* m_address_profiler_ptr;
917048Snate@binkert.org    AddressProfiler* m_inst_profiler_ptr;
926145Snate@binkert.org
9310012Snilay@cs.wisc.edu    Stats::Histogram delayHistogram;
9410012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> delayVCHistogram;
956145Snate@binkert.org
9610012Snilay@cs.wisc.edu    //! Histogram for number of outstanding requests per cycle.
9710012Snilay@cs.wisc.edu    Stats::Histogram m_outstandReqHist;
986145Snate@binkert.org
9910012Snilay@cs.wisc.edu    //! Histogram for holding latency profile of all requests.
10010012Snilay@cs.wisc.edu    Stats::Histogram m_latencyHist;
10110012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_typeLatencyHist;
1026145Snate@binkert.org
10310012Snilay@cs.wisc.edu    //! Histogram for holding latency profile of all requests that
10410012Snilay@cs.wisc.edu    //! hit in the controller connected to this sequencer.
10510012Snilay@cs.wisc.edu    Stats::Histogram m_hitLatencyHist;
10610012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_hitTypeLatencyHist;
10710012Snilay@cs.wisc.edu
10810012Snilay@cs.wisc.edu    //! Histograms for profiling the latencies for requests that
10910012Snilay@cs.wisc.edu    //! did not required external messages.
11010012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_hitMachLatencyHist;
11110012Snilay@cs.wisc.edu    std::vector< std::vector<Stats::Histogram *> > m_hitTypeMachLatencyHist;
11210012Snilay@cs.wisc.edu
11310012Snilay@cs.wisc.edu    //! Histogram for holding latency profile of all requests that
11410012Snilay@cs.wisc.edu    //! miss in the controller connected to this sequencer.
11510012Snilay@cs.wisc.edu    Stats::Histogram m_missLatencyHist;
11610012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_missTypeLatencyHist;
11710012Snilay@cs.wisc.edu
11810012Snilay@cs.wisc.edu    //! Histograms for profiling the latencies for requests that
11910012Snilay@cs.wisc.edu    //! required external messages.
12010012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_missMachLatencyHist;
12110012Snilay@cs.wisc.edu    std::vector< std::vector<Stats::Histogram *> > m_missTypeMachLatencyHist;
12210012Snilay@cs.wisc.edu
12310012Snilay@cs.wisc.edu    //! Histograms for recording the breakdown of miss latency
12410012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_IssueToInitialDelayHist;
12510012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_InitialToForwardDelayHist;
12610012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_ForwardToFirstResponseDelayHist;
12710012Snilay@cs.wisc.edu    std::vector<Stats::Histogram *> m_FirstResponseToCompletionDelayHist;
12810094Snilay@cs.wisc.edu    Stats::Scalar m_IncompleteTimes[MachineType_NUM];
1296896SBrad.Beckmann@amd.com
1307048Snate@binkert.org    //added by SS
1317048Snate@binkert.org    bool m_hot_lines;
1327048Snate@binkert.org    bool m_all_instructions;
1336145Snate@binkert.org};
1346145Snate@binkert.org
1357048Snate@binkert.org#endif // __MEM_RUBY_PROFILER_PROFILER_HH__
136