gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
stat_tester.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 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 __STAT_TESTER_HH__
30#define __STAT_TESTER_HH__
31
32#include "base/statistics.hh"
33#include "params/ScalarStatTester.hh"
34#include "params/SparseHistStatTester.hh"
35#include "params/StatTester.hh"
36#include "params/Vector2dStatTester.hh"
37#include "params/VectorStatTester.hh"
38#include "sim/sim_object.hh"
39
40namespace gem5
41{
42
82class StatTester : public SimObject
83{
84 private:
86
87 public:
88 StatTester(const StatTesterParams &p) :
89 SimObject(p),
90 event([this]{ setStats(); }, name() + ".event")
91 {}
92 void startup() override { schedule(event, curTick()); }
93
94 protected:
95 virtual void setStats(){}
96};
97
99{
100
101 private:
102 ScalarStatTesterParams params;
103
104 public:
105 ScalarStatTester(const ScalarStatTesterParams &p) :
106 StatTester(p), params(p), stats(this, p) {}
107
108 protected:
109 void setStats() override;
111 {
113 statistics::Group *parent,
114 const ScalarStatTesterParams &params
115 );
118};
119
121{
122 private:
123 VectorStatTesterParams params;
124
125 public:
126 VectorStatTester(const VectorStatTesterParams &p) :
127 StatTester(p), params(p), stats(this, p) {}
128
129 protected:
130 void setStats() override;
132 {
134 statistics::Group *parent,
135 const VectorStatTesterParams &params
136 );
139};
140
142{
143 private:
144 Vector2dStatTesterParams params;
145
146 public:
147 Vector2dStatTester(const Vector2dStatTesterParams &p) :
148 StatTester(p), params(p), stats(this, p) {}
149
150 protected:
151 void setStats() override;
153 {
155 statistics::Group *parent,
156 const Vector2dStatTesterParams &params
157 );
160};
161
163{
164 private:
165 SparseHistStatTesterParams params;
166
167 public:
168 SparseHistStatTester(const SparseHistStatTesterParams &p) :
169 StatTester(p), params(p), stats(this, p) {}
170
171 protected:
172 void setStats() override;
181};
182
183
184} // namespace gem5
185
186#endif // __STAT_TESTER_HH__
virtual std::string name() const
Definition named.hh:60
gem5::ScalarStatTester::ScalarStatTesterStats stats
ScalarStatTester(const ScalarStatTesterParams &p)
ScalarStatTesterParams params
void setStats() override
gem5::SparseHistStatTester::SparseHistStatTesterStats stats
SparseHistStatTester(const SparseHistStatTesterParams &p)
SparseHistStatTesterParams params
void startup() override
startup() is the final initialization call before simulation.
virtual void setStats()
StatTester(const StatTesterParams &p)
EventFunctionWrapper event
Vector2dStatTester(const Vector2dStatTesterParams &p)
Vector2dStatTesterParams params
gem5::Vector2dStatTester::Vector2dStatTesterStats stats
void setStats() override
VectorStatTesterParams params
void setStats() override
gem5::VectorStatTester::VectorStatTesterStats stats
VectorStatTester(const VectorStatTesterParams &p)
Statistics container.
Definition group.hh:93
This is a simple scalar statistic, like a counter.
A 2-Dimensional vecto of scalar stats.
A vector of scalar stats.
void schedule(Event &event, Tick when)
Definition eventq.hh:1012
SimObject(const Params &p)
Definition sim_object.cc:58
Bitfield< 0 > p
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
Tick curTick()
The universal simulation clock.
Definition cur_tick.hh:46
Declaration of Statistics objects.
ScalarStatTesterStats(statistics::Group *parent, const ScalarStatTesterParams &params)
SparseHistStatTesterStats(statistics::Group *parent, const SparseHistStatTesterParams &params)
Vector2dStatTesterStats(statistics::Group *parent, const Vector2dStatTesterParams &params)
VectorStatTesterStats(statistics::Group *parent, const VectorStatTesterParams &params)

Generated on Mon May 26 2025 09:19:15 for gem5 by doxygen 1.13.2