gem5 v24.1.0.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"
36#include "params/PcCountTrackerManager.hh"
37#include "sim/sim_exit.hh"
38#include "debug/PcCountTracker.hh"
39
40namespace 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, uint64_t> counter;
58
62 std::unordered_set<PcCountPair,
64
67
74
75 public:
76
85 uint64_t
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__
bool ifListNotEmpty
when all the PC Count pairs in the targetPair are encountered, and the PCCOUNTTRACK_END exit event is...
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
Abstract superclass for simulation objects.
const Params & params() const
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 Jan 13 2025 04:28:32 for gem5 by doxygen 1.9.8