gem5 [DEVELOP-FOR-25.0]
Loading...
Searching...
No Matches
thread_state.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006 The Regents of The University of Michigan
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#include "cpu/thread_state.hh"
30
31#include "base/output.hh"
32#include "cpu/base.hh"
33#include "mem/port.hh"
34#include "mem/port_proxy.hh"
37#include "sim/full_system.hh"
38#include "sim/serialize.hh"
39#include "sim/system.hh"
40
41namespace gem5
42{
43
45 : numInst(0), numOp(0), threadStats(cpu, _tid),
46 numLoad(0), startNumLoad(0),
47 _status(ThreadContext::Halted), baseCpu(cpu),
49 process(_process), storeCondFailures(0)
50{
51}
52
53void
58
59void
64
66 const ThreadID& tid)
67 : statistics::Group(cpu, csprintf("thread_%i", tid).c_str()),
68 ADD_STAT(numInsts, statistics::units::Count::get(),
69 "Number of Instructions committed"),
70 ADD_STAT(numOps, statistics::units::Count::get(),
71 "Number of Ops committed"),
72 ADD_STAT(numMemRefs, statistics::units::Count::get(),
73 "Number of Memory References")
74{
75}
76
77} // namespace gem5
ThreadContext is the external interface to all thread state for anything outside of the CPU.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
Definition group.hh:75
#define SERIALIZE_ENUM(scalar)
Definition serialize.hh:591
#define UNSERIALIZE_ENUM(scalar)
Definition serialize.hh:598
Port Object Declaration.
Units for Stats.
Definition units.hh:113
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
int16_t ThreadID
Thread index/ID type.
Definition types.hh:235
std::ostream CheckpointOut
Definition serialize.hh:66
std::string csprintf(const char *format, const Args &...args)
Definition cprintf.hh:161
PortProxy Object Declaration.
statistics::Scalar numOps
Stat for number ops (including micro ops) committed.
statistics::Scalar numMemRefs
Stat for number of memory references.
ThreadStateStats(BaseCPU *cpu, const ThreadID &thread)
statistics::Scalar numInsts
Stat for number instructions committed.
ThreadState(BaseCPU *cpu, ThreadID _tid, Process *_process)
Counter numInst
Number of instructions committed.
void serialize(CheckpointOut &cp) const override
Serialize an object.
unsigned storeCondFailures
Counter startNumLoad
The number of simulated loads committed prior to this run.
Counter numLoad
Number of simulated loads, used for tracking events based on the number of loads committed.
Counter numOp
Number of ops (including micro ops) committed.
gem5::ThreadState::ThreadStateStats threadStats
ThreadContext::Status _status
Tick lastSuspend
Last time suspend was called on this thread.
Tick lastActivate
Last time activate was called on this thread.
void unserialize(CheckpointIn &cp) override
Unserialize an object.

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