gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
mem_footprint.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Google Inc.
3  * All rights reserved.
4  *
5  * The license below extends only to copyright in the software and
6  * shall not be construed as granting a license to any other
7  * intellectual property including but not limited to intellectual
8  * property relating to a hardware implementation of the
9  * functionality of the software licensed hereunder. You may use the
10  * software subject to the license terms below provided that you
11  * ensure that this notice is replicated unmodified and in its
12  * entirety in all distributions of the software, modified or
13  * unmodified, in source code or in binary form.
14  *
15  * Redistribution and use in source and binary forms, with or without
16  * modification, are permitted provided that the following conditions are
17  * met: redistributions of source code must retain the above copyright
18  * notice, this list of conditions and the following disclaimer;
19  * redistributions in binary form must reproduce the above copyright
20  * notice, this list of conditions and the following disclaimer in the
21  * documentation and/or other materials provided with the distribution;
22  * neither the name of the copyright holders nor the names of its
23  * contributors may be used to endorse or promote products derived from
24  * this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifndef __MEM_PROBES_MEM_FOOTPRINT_HH__
40 #define __MEM_PROBES_MEM_FOOTPRINT_HH__
41 
42 #include <unordered_set>
43 
44 #include "base/callback.hh"
45 #include "mem/packet.hh"
46 #include "mem/probes/base.hh"
47 #include "sim/stats.hh"
48 #include "sim/system.hh"
49 
50 struct MemFootprintProbeParams;
51 
55 {
56  public:
57  typedef std::unordered_set<Addr> AddrSet;
58 
59  MemFootprintProbe(MemFootprintProbeParams *p);
60  void regStats() override;
61  // Fix footprint tracking state on stat reset
62  void statReset();
63 
64  protected:
66  const uint8_t cacheLineSizeLg2;
68  const uint8_t pageSizeLg2;
69  const uint64_t totalCacheLinesInMem;
70  const uint64_t totalPagesInMem;
71 
72  void insertAddr(Addr addr, AddrSet *set, uint64_t limit);
73  void handleRequest(const ProbePoints::PacketInfo &pkt_info) override;
74 
83 
84  // Addr set to track unique cache lines accessed
85  AddrSet cacheLines;
86  // Addr set to track unique cache lines accessed since simulation begin
87  AddrSet cacheLinesAll;
88  // Addr set to track unique pages accessed
89  AddrSet pages;
90  // Addr set to track unique pages accessed since simulation begin
91  AddrSet pagesAll;
93 };
94 
95 #endif //__MEM_PROBES_MEM_FOOTPRINT_HH__
void insertAddr(Addr addr, AddrSet *set, uint64_t limit)
const uint8_t pageSizeLg2
Page size for footprint measurement (log2)
ip6_addr_t addr
Definition: inet.hh:330
Definition: system.hh:72
Base class for memory system probes accepting Packet instances.
Definition: base.hh:61
std::unordered_set< Addr > AddrSet
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2505
Probe to track footprint of accessed memory Two granularity of footprint measurement i...
MemFootprintProbe(MemFootprintProbeParams *p)
const uint64_t totalCacheLinesInMem
void handleRequest(const ProbePoints::PacketInfo &pkt_info) override
Callback to analyse intercepted Packets.
Stats::Scalar fpPageTotal
Footprint at page granularity, since simulation begin.
void regStats() override
Callback to set stat parameters.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
const uint64_t totalPagesInMem
BitfieldType< SegDescriptorLimit > limit
Definition: misc.hh:924
Stats::Scalar fpCacheLineTotal
Footprint at cache line size granularity, since simulation begin.
Declaration of the Packet class.
const uint8_t cacheLineSizeLg2
Cache Line size for footprint measurement (log2)
Stats::Scalar fpCacheLine
Footprint at cache line size granularity.
Bitfield< 0 > p
Stats::Scalar fpPage
Footprint at page granularity.
A struct to hold on to the essential fields from a packet, so that the packet and underlying request ...
Definition: mem.hh:53

Generated on Mon Jun 8 2020 15:45:12 for gem5 by doxygen 1.8.13