gem5  [DEVELOP-FOR-23.0]
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
pc_count_tracker_manager.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022 The Regents of the University of California.
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 __CPU_PROBES_PC_COUNT_TRACKER_MANAGER_HH__
30 #define __CPU_PROBES_PC_COUNT_TRACKER_MANAGER_HH__
31 
32 #include <unordered_map>
33 #include <unordered_set>
34 
35 #include "cpu/base.hh"
36 #include "params/PcCountTrackerManager.hh"
37 #include "sim/sim_exit.hh"
38 #include "debug/PcCountTracker.hh"
39 
40 namespace gem5
41 {
42 
43 
45  public:
46  PcCountTrackerManager(const PcCountTrackerManagerParams &params);
47 
51  void checkCount(Addr pc);
52 
53  private:
57  std::unordered_map<Addr, int> counter;
58 
62  std::unordered_set<PcCountPair,
64 
67 
74 
75  public:
76 
85  int
87  {
88  if (counter.find(pc) != counter.end()) {
89  return counter.find(pc)->second;
90  }
91  return -1;
92  }
93 
100  {
101  return currentPair;
102  }
103 
108  std::string
110  {
111  std::string s;
112  for(auto itr = targetPair.begin();
113  itr != targetPair.end();
114  ++itr) {
115  s += itr->to_string();
116  s += "\n";
117  }
118  return s;
119  }
120 };
121 
122 }
123 
124 #endif // __CPU_PROBES_PC_COUNT_TRACKER_MANAGER_HH__
gem5::PcCountTrackerManager::getPcCount
int getPcCount(Addr pc) const
this function returns the corresponding value of count for the inputted Program Counter address.
Definition: pc_count_tracker_manager.hh:86
gem5::VegaISA::s
Bitfield< 1 > s
Definition: pagetable.hh:64
gem5::PcCountTrackerManager::targetPair
std::unordered_set< PcCountPair, PcCountPair::HashFunction > targetPair
a set that stores all the PC Count pairs that should raise an exit event at
Definition: pc_count_tracker_manager.hh:63
gem5::PcCountTrackerManager::checkCount
void checkCount(Addr pc)
this function is called when PcCountTrackerProbeListener finds a target PC
Definition: pc_count_tracker_manager.cc:56
gem5::PcCountTrackerManager::getCurrentPcCountPair
PcCountPair getCurrentPcCountPair() const
this function returns the current PC Count pair
Definition: pc_count_tracker_manager.hh:99
gem5::PcCountTrackerManager::PcCountTrackerManager
PcCountTrackerManager(const PcCountTrackerManagerParams &params)
Definition: pc_count_tracker_manager.cc:34
sim_exit.hh
gem5::SimObject::params
const Params & params() const
Definition: sim_object.hh:176
gem5::PcCountTrackerManager::counter
std::unordered_map< Addr, int > counter
a counter that stores all the target PC addresses and the number of times the target PC has been exec...
Definition: pc_count_tracker_manager.hh:57
gem5::SimObject
Abstract superclass for simulation objects.
Definition: sim_object.hh:146
gem5::Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
gem5::PcCountTrackerManager::printAllTargets
std::string printAllTargets() const
this function print all targets
Definition: pc_count_tracker_manager.hh:109
base.hh
gem5::MipsISA::pc
Bitfield< 4 > pc
Definition: pra_constants.hh:243
gem5::PcCountTrackerManager::currentPair
PcCountPair currentPair
the current PC Count pair
Definition: pc_count_tracker_manager.hh:66
gem5::PcCountTrackerManager
Definition: pc_count_tracker_manager.hh:44
gem5::PcCountPair::HashFunction
Enable hashing for this parameter.
Definition: pc_count_pair.hh:85
gem5
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
Definition: gpu_translation_state.hh:37
gem5::PcCountPair
Definition: pc_count_pair.hh:37
gem5::PcCountTrackerManager::ifListNotEmpty
bool ifListNotEmpty
when all the PC Count pairs in the targetPair are encountered, and the PCCOUNTTRACK_END exit event is...
Definition: pc_count_tracker_manager.hh:73

Generated on Sun Jul 30 2023 01:56:53 for gem5 by doxygen 1.8.17