kernel_stats.cc (12181:2150eff234c1) kernel_stats.cc (12182:acde8d31d970)
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;

--- 27 unchanged lines hidden (view full) ---

36#include "kern/kernel_stats.hh"
37#include "sim/system.hh"
38
39using namespace std;
40using namespace Stats;
41
42namespace Kernel {
43
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;

--- 27 unchanged lines hidden (view full) ---

36#include "kern/kernel_stats.hh"
37#include "sim/system.hh"
38
39using namespace std;
40using namespace Stats;
41
42namespace Kernel {
43
44Statistics::Statistics()
45 : iplLast(0), iplLastTick(0)
46{
47}
48
49void
50Statistics::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 ;
44void
45Statistics::regStats(const string &_name)
46{
47 myname = _name;
48
49 _arm
50 .name(name() + ".inst.arm")
51 .desc("number of arm instructions executed")
52 ;
53
54 _quiesce
55 .name(name() + ".inst.quiesce")
56 .desc("number of quiesce instructions executed")
57 ;
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
91 _iplUsed = _iplGood / _iplCount;
92}
93
58}
59
94void
95Statistics::swpipl(int ipl)
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]++;
105 _iplTicks[iplLast] += curTick() - iplLastTick;
106 iplLastTick = curTick();
107 iplLast = ipl;
108}
109
110void
111Statistics::serialize(CheckpointOut &cp) const
112{
113 SERIALIZE_SCALAR(iplLast);
114 SERIALIZE_SCALAR(iplLastTick);
115}
116
117void
118Statistics::unserialize(CheckpointIn &cp)
119{
120 UNSERIALIZE_SCALAR(iplLast);
121 UNSERIALIZE_SCALAR(iplLastTick);
122}
123
124} // namespace Kernel
60} // namespace Kernel