kernel_stats.hh revision 5999
13560SN/A/*
23560SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
33560SN/A * All rights reserved.
43560SN/A *
53560SN/A * Redistribution and use in source and binary forms, with or without
63560SN/A * modification, are permitted provided that the following conditions are
73560SN/A * met: redistributions of source code must retain the above copyright
83560SN/A * notice, this list of conditions and the following disclaimer;
93560SN/A * redistributions in binary form must reproduce the above copyright
103560SN/A * notice, this list of conditions and the following disclaimer in the
113560SN/A * documentation and/or other materials provided with the distribution;
123560SN/A * neither the name of the copyright holders nor the names of its
133560SN/A * contributors may be used to endorse or promote products derived from
143560SN/A * this software without specific prior written permission.
153560SN/A *
163560SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
173560SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
183560SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
193560SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
203560SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
213560SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
223560SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
233560SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243560SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
253560SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
263560SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273560SN/A *
283560SN/A * Authors: Lisa Hsu
293560SN/A *          Nathan Binkert
303560SN/A */
313560SN/A
323560SN/A#ifndef __ARCH_ALPHA_KERNEL_STATS_HH__
333560SN/A#define __ARCH_ALPHA_KERNEL_STATS_HH__
343560SN/A
353560SN/A#include <map>
363560SN/A#include <stack>
373560SN/A#include <string>
383560SN/A#include <vector>
393560SN/A
403560SN/A#include "cpu/static_inst.hh"
413565Sgblack@eecs.umich.edu#include "kern/kernel_stats.hh"
423560SN/A
433560SN/Aclass BaseCPU;
443560SN/Aclass ThreadContext;
453560SN/Aclass FnEvent;
463560SN/A// What does kernel stats expect is included?
473560SN/Aclass System;
483560SN/A
493560SN/Anamespace AlphaISA {
503560SN/Anamespace Kernel {
513560SN/A
523560SN/Aenum cpu_mode { kernel, user, idle, cpu_mode_num };
533560SN/Aextern const char *modestr[];
543560SN/A
553560SN/Aclass Statistics : public ::Kernel::Statistics
563560SN/A{
573560SN/A  protected:
583560SN/A    Addr idleProcess;
593560SN/A    cpu_mode themode;
603560SN/A    Tick lastModeTick;
613560SN/A
623560SN/A    void changeMode(cpu_mode newmode, ThreadContext *tc);
633560SN/A
643560SN/A  private:
655999Snate@binkert.org    Stats::Vector _callpal;
665999Snate@binkert.org//    Stats::Vector _faults;
673560SN/A
685999Snate@binkert.org    Stats::Vector _mode;
695999Snate@binkert.org    Stats::Vector _modeGood;
703560SN/A    Stats::Formula _modeFraction;
715999Snate@binkert.org    Stats::Vector _modeTicks;
723560SN/A
735999Snate@binkert.org    Stats::Scalar _swap_context;
743560SN/A
753560SN/A  public:
763560SN/A    Statistics(System *system);
773560SN/A
783560SN/A    void regStats(const std::string &name);
793560SN/A
803560SN/A  public:
813560SN/A    void mode(cpu_mode newmode, ThreadContext *tc);
823560SN/A    void context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc);
833560SN/A    void callpal(int code, ThreadContext *tc);
843560SN/A    void hwrei() { _hwrei++; }
853560SN/A
863560SN/A    void setIdleProcess(Addr idle, ThreadContext *tc);
873560SN/A
883560SN/A  public:
893560SN/A    void serialize(std::ostream &os);
903560SN/A    void unserialize(Checkpoint *cp, const std::string &section);
913560SN/A};
923560SN/A
935568Snate@binkert.org} // namespace Kernel
945568Snate@binkert.org} // namespace AlphaISA
953560SN/A
963560SN/A#endif // __ARCH_ALPHA_KERNEL_STATS_HH__
97