gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
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"
37#include "debug/PcCountTracker.hh"
38#include "params/PcCountTrackerManager.hh"
39#include "sim/sim_exit.hh"
40
41namespace gem5
42{
43
44
46 public:
47 PcCountTrackerManager(const PcCountTrackerManagerParams &params);
48
52 void checkCount(Addr pc);
53
54 private:
58 std::unordered_map<Addr, uint64_t> counter;
59
63 std::unordered_set<PcCountPair,
65
68
75
76 public:
77
86 uint64_t
88 {
89 if (counter.find(pc) != counter.end()) {
90 return counter.find(pc)->second;
91 }
92 return -1;
93 }
94
101 {
102 return currentPair;
103 }
104
109 std::string
111 {
112 std::string s;
113 for(auto itr = targetPair.begin();
114 itr != targetPair.end();
115 ++itr) {
116 s += itr->to_string();
117 s += "\n";
118 }
119 return s;
120 }
121};
122
123}
124
125#endif // __CPU_PROBES_PC_COUNT_TRACKER_MANAGER_HH__
bool ifListNotEmpty
when all the PC Count pairs in the targetPair are encountered, and the PCCOUNTTRACK_END exit event is...
PcCountTrackerManager(const PcCountTrackerManagerParams &params)
uint64_t getPcCount(Addr pc) const
this function returns the corresponding value of count for the inputted Program Counter address.
PcCountPair getCurrentPcCountPair() const
this function returns the current PC Count pair
std::unordered_map< Addr, uint64_t > counter
a counter that stores all the target PC addresses and the number of times the target PC has been exec...
std::unordered_set< PcCountPair, PcCountPair::HashFunction > targetPair
a set that stores all the PC Count pairs that should raise an exit event at
PcCountPair currentPair
the current PC Count pair
std::string printAllTargets() const
this function print all targets
void checkCount(Addr pc)
this function is called when PcCountTrackerProbeListener finds a target PC
const Params & params() const
SimObject(const Params &p)
Definition sim_object.cc:58
Bitfield< 4 > s
Bitfield< 4 > pc
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
Enable hashing for this parameter.

Generated on Mon Oct 27 2025 04:13:01 for gem5 by doxygen 1.14.0