gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
kernel_stats.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2004-2005 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  * Authors: Lisa Hsu
29  * Nathan Binkert
30  */
31 
32 #include <string>
33 
34 #include "base/trace.hh"
35 #include "cpu/thread_context.hh"
36 #include "kern/kernel_stats.hh"
37 #include "sim/system.hh"
38 
39 using namespace std;
40 using namespace Stats;
41 
42 namespace Kernel {
43 
44 Statistics::Statistics(System *system)
45  : iplLast(0), iplLastTick(0)
46 {
47 }
48 
49 void
50 Statistics::regStats(const string &_name)
51 {
52  myname = _name;
53 
54  _arm
55  .name(name() + ".inst.arm")
56  .desc("number of arm instructions executed")
57  ;
58 
59  _quiesce
60  .name(name() + ".inst.quiesce")
61  .desc("number of quiesce instructions executed")
62  ;
63 
64  _iplCount
65  .init(32)
66  .name(name() + ".ipl_count")
67  .desc("number of times we switched to this ipl")
68  .flags(total | pdf | nozero | nonan)
69  ;
70 
71  _iplGood
72  .init(32)
73  .name(name() + ".ipl_good")
74  .desc("number of times we switched to this ipl from a different ipl")
75  .flags(total | pdf | nozero | nonan)
76  ;
77 
78  _iplTicks
79  .init(32)
80  .name(name() + ".ipl_ticks")
81  .desc("number of cycles we spent at this ipl")
82  .flags(total | pdf | nozero | nonan)
83  ;
84 
85  _iplUsed
86  .name(name() + ".ipl_used")
87  .desc("fraction of swpipl calls that actually changed the ipl")
88  .flags(total | nozero | nonan)
89  ;
90 
92 }
93 
94 void
96 {
97  assert(ipl >= 0 && ipl <= 0x1f && "invalid IPL\n");
98 
99  _iplCount[ipl]++;
100 
101  if (ipl == iplLast)
102  return;
103 
104  _iplGood[ipl]++;
106  iplLastTick = curTick();
107  iplLast = ipl;
108 }
109 
110 void
112 {
115 }
116 
117 void
119 {
122 }
123 
124 } // namespace Kernel
const FlagsType pdf
Print the percent of the total that this entry represents.
Definition: info.hh:51
const FlagsType nonan
Don't print if this is NAN.
Definition: info.hh:59
void regStats(const std::string &name)
Stats::Vector _iplTicks
Definition: kernel_stats.hh:58
Stats::Scalar _arm
Definition: kernel_stats.hh:52
Definition: system.hh:83
Stats::Formula _iplUsed
Definition: kernel_stats.hh:59
void serialize(CheckpointOut &cp) const override
Serialize an object.
Stats::Vector _iplGood
Definition: kernel_stats.hh:57
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
Definition: statistics.hh:311
Derived & init(size_type size)
Set this vector to have the given size.
Definition: statistics.hh:1118
Stats::Vector _iplCount
Definition: kernel_stats.hh:56
const std::string name() const
Definition: kernel_stats.hh:69
#define UNSERIALIZE_SCALAR(scalar)
Definition: serialize.hh:145
system
Definition: isa.cc:226
Tick curTick()
The current simulated tick.
Definition: core.hh:47
void swpipl(int ipl)
Definition: kernel_stats.cc:95
Stats::Scalar _quiesce
Definition: kernel_stats.hh:53
const FlagsType total
Print the total.
Definition: info.hh:49
#define SERIALIZE_SCALAR(scalar)
Definition: serialize.hh:143
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
Definition: statistics.hh:254
std::string myname
Definition: kernel_stats.hh:49
void unserialize(CheckpointIn &cp) override
Unserialize an object.
std::ostream CheckpointOut
Definition: serialize.hh:67
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
Definition: statistics.hh:287
Bitfield< 15, 10 > ipl
const FlagsType nozero
Don't print if this is zero.
Definition: info.hh:57

Generated on Fri Jun 9 2017 13:03:35 for gem5 by doxygen 1.8.6