gem5  v20.1.0.0
AddressProfiler.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met: redistributions of source code must retain the above copyright
8  * notice, this list of conditions and the following disclaimer;
9  * redistributions in binary form must reproduce the above copyright
10  * notice, this list of conditions and the following disclaimer in the
11  * documentation and/or other materials provided with the distribution;
12  * neither the name of the copyright holders nor the names of its
13  * contributors may be used to endorse or promote products derived from
14  * this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef __MEM_RUBY_PROFILER_ADDRESSPROFILER_HH__
30 #define __MEM_RUBY_PROFILER_ADDRESSPROFILER_HH__
31 
32 #include <iostream>
33 #include <unordered_map>
34 
39 #include "mem/ruby/protocol/AccessType.hh"
40 #include "mem/ruby/protocol/RubyRequest.hh"
41 
42 class Set;
43 
45 {
46  public:
47  typedef std::unordered_map<Addr, AccessTraceForAddress> AddressMap;
48 
49  public:
50  AddressProfiler(int num_of_sequencers, Profiler *profiler);
52 
53  void printStats(std::ostream& out) const;
54  void clearStats();
55 
56  void addTraceSample(Addr data_addr, Addr pc_addr,
57  RubyRequestType type, RubyAccessMode access_mode,
58  NodeID id, bool sharing_miss);
59  void profileRetry(Addr data_addr, AccessType type, int count);
60  void profileGetX(Addr datablock, Addr PC,
61  const Set& owner, const Set& sharers, NodeID requestor);
62  void profileGetS(Addr datablock, Addr PC,
63  const Set& owner, const Set& sharers, NodeID requestor);
64 
65  void print(std::ostream& out) const;
66 
67  //added by SS
68  void setHotLines(bool hot_lines);
69  void setAllInstructions(bool all_instructions);
70  void regStats(const std::string &name) {}
71  void collateStats() {}
72 
73  private:
74  // Private copy constructor and assignment operator
75  AddressProfiler(const AddressProfiler& obj);
77 
79 
89 
91 
92  //added by SS
95 
97 };
98 
101  record_map);
102 
103 void printSorted(std::ostream& out, int num_of_sequencers,
104  const AddressProfiler::AddressMap &record_map,
105  std::string description, Profiler *profiler);
106 
107 inline std::ostream&
108 operator<<(std::ostream& out, const AddressProfiler& obj)
109 {
110  obj.print(out);
111  out << std::flush;
112  return out;
113 }
114 
115 #endif // __MEM_RUBY_PROFILER_ADDRESSPROFILER_HH__
Set
Definition: Set.hh:42
AddressProfiler::m_all_instructions
bool m_all_instructions
Definition: AddressProfiler.hh:94
AddressProfiler::operator=
AddressProfiler & operator=(const AddressProfiler &obj)
Profiler.hh
Histogram.hh
AddressProfiler::setHotLines
void setHotLines(bool hot_lines)
Definition: AddressProfiler.cc:159
AddressProfiler::profileGetS
void profileGetS(Addr datablock, Addr PC, const Set &owner, const Set &sharers, NodeID requestor)
Definition: AddressProfiler.cc:267
AddressProfiler::addTraceSample
void addTraceSample(Addr data_addr, Addr pc_addr, RubyRequestType type, RubyAccessMode access_mode, NodeID id, bool sharing_miss)
Definition: AddressProfiler.cc:284
type
uint8_t type
Definition: inet.hh:421
AddressProfiler
Definition: AddressProfiler.hh:44
AddressProfiler::AddressProfiler
AddressProfiler(int num_of_sequencers, Profiler *profiler)
Definition: AddressProfiler.cc:147
X86ISA::count
count
Definition: misc.hh:703
AddressProfiler::m_retryProfileMap
AddressMap m_retryProfileMap
Definition: AddressProfiler.hh:83
printSorted
void printSorted(std::ostream &out, int num_of_sequencers, const AddressProfiler::AddressMap &record_map, std::string description, Profiler *profiler)
AddressProfiler::m_retryProfileHistoWrite
Histogram m_retryProfileHistoWrite
Definition: AddressProfiler.hh:85
AddressProfiler::collateStats
void collateStats()
Definition: AddressProfiler.hh:71
AddressProfiler::printStats
void printStats(std::ostream &out) const
Definition: AddressProfiler.cc:171
AddressProfiler::profileRetry
void profileRetry(Addr data_addr, AccessType type, int count)
Definition: AddressProfiler.cc:321
Profiler
Definition: Profiler.hh:64
AccessTraceForAddress
Definition: AccessTraceForAddress.hh:41
AccessTraceForAddress.hh
AddressProfiler::setAllInstructions
void setAllInstructions(bool all_instructions)
Definition: AddressProfiler.cc:165
AddressProfiler::profileGetX
void profileGetX(Addr datablock, Addr PC, const Set &owner, const Set &sharers, NodeID requestor)
Definition: AddressProfiler.cc:249
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
AddressProfiler::m_programCounterAccessTrace
AddressMap m_programCounterAccessTrace
Definition: AddressProfiler.hh:82
name
const std::string & name()
Definition: trace.cc:50
AddressProfiler::~AddressProfiler
~AddressProfiler()
Definition: AddressProfiler.cc:154
AddressProfiler::m_hot_lines
bool m_hot_lines
Definition: AddressProfiler.hh:93
AddressProfiler::AddressMap
std::unordered_map< Addr, AccessTraceForAddress > AddressMap
Definition: AddressProfiler.hh:47
AddressProfiler::m_dataAccessTrace
AddressMap m_dataAccessTrace
Definition: AddressProfiler.hh:80
AddressProfiler::clearStats
void clearStats()
Definition: AddressProfiler.cc:233
AddressProfiler::m_macroBlockAccessTrace
AddressMap m_macroBlockAccessTrace
Definition: AddressProfiler.hh:81
AddressProfiler::m_getx_sharing_histogram
Histogram m_getx_sharing_histogram
Definition: AddressProfiler.hh:87
AddressProfiler::m_retryProfileHisto
Histogram m_retryProfileHisto
Definition: AddressProfiler.hh:84
Histogram
Definition: Histogram.hh:37
Address.hh
addr
ip6_addr_t addr
Definition: inet.hh:423
AddressProfiler::regStats
void regStats(const std::string &name)
Definition: AddressProfiler.hh:70
AddressProfiler::m_profiler
Profiler * m_profiler
Definition: AddressProfiler.hh:90
NodeID
unsigned int NodeID
Definition: TypeDefines.hh:34
operator<<
std::ostream & operator<<(std::ostream &out, const AddressProfiler &obj)
Definition: AddressProfiler.hh:108
AddressProfiler::m_sharing_miss_counter
int64_t m_sharing_miss_counter
Definition: AddressProfiler.hh:78
AddressProfiler::m_num_of_sequencers
int m_num_of_sequencers
Definition: AddressProfiler.hh:96
AddressProfiler::print
void print(std::ostream &out) const
AddressProfiler::m_gets_sharing_histogram
Histogram m_gets_sharing_histogram
Definition: AddressProfiler.hh:88
lookupTraceForAddress
AccessTraceForAddress & lookupTraceForAddress(Addr addr, AddressProfiler::AddressMap &record_map)
Definition: AddressProfiler.cc:45
AddressProfiler::m_retryProfileHistoRead
Histogram m_retryProfileHistoRead
Definition: AddressProfiler.hh:86

Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17