2004-06-10 07:02:33 +02:00
|
|
|
/*
|
2005-06-05 11:16:00 +02:00
|
|
|
* Copyright (c) 2004-2005 The Regents of The University of Michigan
|
2004-06-10 07:02:33 +02:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are
|
|
|
|
* met: redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer;
|
|
|
|
* redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution;
|
|
|
|
* neither the name of the copyright holders nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived from
|
|
|
|
* this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2006-06-01 01:26:56 +02:00
|
|
|
*
|
|
|
|
* Authors: Lisa Hsu
|
|
|
|
* Nathan Binkert
|
2004-06-10 07:02:33 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "base/trace.hh"
|
2006-06-06 23:32:21 +02:00
|
|
|
#include "cpu/thread_context.hh"
|
2006-11-08 04:34:34 +01:00
|
|
|
#include "kern/kernel_stats.hh"
|
2004-10-23 04:49:12 +02:00
|
|
|
#include "kern/tru64/tru64_syscalls.hh"
|
2006-03-08 01:59:12 +01:00
|
|
|
#include "sim/system.hh"
|
2004-06-10 07:02:33 +02:00
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
using namespace Stats;
|
|
|
|
|
2004-08-20 17:35:31 +02:00
|
|
|
namespace Kernel {
|
2004-06-10 07:02:33 +02:00
|
|
|
|
2006-03-04 21:18:40 +01:00
|
|
|
Statistics::Statistics(System *system)
|
2006-11-07 11:36:54 +01:00
|
|
|
: iplLast(0), iplLastTick(0)
|
2004-08-20 17:35:31 +02:00
|
|
|
{
|
|
|
|
}
|
2004-06-10 07:02:33 +02:00
|
|
|
|
|
|
|
void
|
2004-08-20 17:35:31 +02:00
|
|
|
Statistics::regStats(const string &_name)
|
2004-06-10 07:02:33 +02:00
|
|
|
{
|
2004-08-20 17:35:31 +02:00
|
|
|
myname = _name;
|
2004-06-10 07:02:33 +02:00
|
|
|
|
|
|
|
_arm
|
2004-08-20 17:35:31 +02:00
|
|
|
.name(name() + ".inst.arm")
|
2004-06-10 07:02:33 +02:00
|
|
|
.desc("number of arm instructions executed")
|
|
|
|
;
|
|
|
|
|
|
|
|
_quiesce
|
2004-08-20 17:35:31 +02:00
|
|
|
.name(name() + ".inst.quiesce")
|
2004-06-10 07:02:33 +02:00
|
|
|
.desc("number of quiesce instructions executed")
|
|
|
|
;
|
|
|
|
|
|
|
|
_iplCount
|
|
|
|
.init(32)
|
2004-08-20 17:35:31 +02:00
|
|
|
.name(name() + ".ipl_count")
|
2004-06-10 07:02:33 +02:00
|
|
|
.desc("number of times we switched to this ipl")
|
|
|
|
.flags(total | pdf | nozero | nonan)
|
|
|
|
;
|
|
|
|
|
|
|
|
_iplGood
|
|
|
|
.init(32)
|
2004-08-20 17:35:31 +02:00
|
|
|
.name(name() + ".ipl_good")
|
2004-06-10 07:02:33 +02:00
|
|
|
.desc("number of times we switched to this ipl from a different ipl")
|
|
|
|
.flags(total | pdf | nozero | nonan)
|
|
|
|
;
|
|
|
|
|
|
|
|
_iplTicks
|
|
|
|
.init(32)
|
2004-08-20 17:35:31 +02:00
|
|
|
.name(name() + ".ipl_ticks")
|
2004-06-10 07:02:33 +02:00
|
|
|
.desc("number of cycles we spent at this ipl")
|
|
|
|
.flags(total | pdf | nozero | nonan)
|
|
|
|
;
|
|
|
|
|
|
|
|
_iplUsed
|
2004-08-20 17:35:31 +02:00
|
|
|
.name(name() + ".ipl_used")
|
2004-06-10 07:02:33 +02:00
|
|
|
.desc("fraction of swpipl calls that actually changed the ipl")
|
|
|
|
.flags(total | nozero | nonan)
|
|
|
|
;
|
|
|
|
|
|
|
|
_iplUsed = _iplGood / _iplCount;
|
|
|
|
|
|
|
|
_syscall
|
|
|
|
.init(SystemCalls<Tru64>::Number)
|
2004-08-20 17:35:31 +02:00
|
|
|
.name(name() + ".syscall")
|
2004-06-10 07:02:33 +02:00
|
|
|
.desc("number of syscalls executed")
|
|
|
|
.flags(total | pdf | nozero | nonan)
|
|
|
|
;
|
|
|
|
|
2006-11-08 02:35:42 +01:00
|
|
|
//@todo This needs to get the names of syscalls from an appropriate place.
|
|
|
|
#if 0
|
2004-06-10 07:02:33 +02:00
|
|
|
for (int i = 0; i < SystemCalls<Tru64>::Number; ++i) {
|
2006-11-08 02:35:42 +01:00
|
|
|
const char *str = SystemCalls<Tru64>::name(i);
|
2004-06-10 07:02:33 +02:00
|
|
|
if (str) {
|
|
|
|
_syscall.subname(i, str);
|
|
|
|
}
|
|
|
|
}
|
2006-11-08 02:35:42 +01:00
|
|
|
#endif
|
2004-08-20 17:35:31 +02:00
|
|
|
}
|
2004-06-10 07:02:33 +02:00
|
|
|
|
|
|
|
void
|
2004-08-20 17:35:31 +02:00
|
|
|
Statistics::swpipl(int ipl)
|
2004-06-10 07:02:33 +02:00
|
|
|
{
|
|
|
|
assert(ipl >= 0 && ipl <= 0x1f && "invalid IPL\n");
|
|
|
|
|
|
|
|
_iplCount[ipl]++;
|
|
|
|
|
|
|
|
if (ipl == iplLast)
|
|
|
|
return;
|
|
|
|
|
|
|
|
_iplGood[ipl]++;
|
|
|
|
_iplTicks[iplLast] += curTick - iplLastTick;
|
|
|
|
iplLastTick = curTick;
|
|
|
|
iplLast = ipl;
|
|
|
|
}
|
|
|
|
|
2004-08-20 17:35:31 +02:00
|
|
|
void
|
|
|
|
Statistics::serialize(ostream &os)
|
|
|
|
{
|
2004-10-02 18:43:59 +02:00
|
|
|
SERIALIZE_SCALAR(iplLast);
|
|
|
|
SERIALIZE_SCALAR(iplLastTick);
|
2004-08-20 17:35:31 +02:00
|
|
|
}
|
2004-06-10 07:02:33 +02:00
|
|
|
|
2004-08-20 17:35:31 +02:00
|
|
|
void
|
|
|
|
Statistics::unserialize(Checkpoint *cp, const string §ion)
|
|
|
|
{
|
2004-10-02 18:43:59 +02:00
|
|
|
UNSERIALIZE_SCALAR(iplLast);
|
|
|
|
UNSERIALIZE_SCALAR(iplLastTick);
|
2004-06-10 07:02:33 +02:00
|
|
|
}
|
2004-08-20 17:35:31 +02:00
|
|
|
|
|
|
|
/* end namespace Kernel */ }
|