kernel_stats.hh revision 12182
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 ThreadContext; 443560SN/A 453560SN/Anamespace AlphaISA { 463560SN/Anamespace Kernel { 473560SN/A 483560SN/Aenum cpu_mode { kernel, user, idle, cpu_mode_num }; 493560SN/Aextern const char *modestr[]; 503560SN/A 513560SN/Aclass Statistics : public ::Kernel::Statistics 523560SN/A{ 533560SN/A protected: 543560SN/A Addr idleProcess; 553560SN/A cpu_mode themode; 563560SN/A Tick lastModeTick; 573560SN/A 583560SN/A void changeMode(cpu_mode newmode, ThreadContext *tc); 593560SN/A 603560SN/A private: 615999Snate@binkert.org Stats::Vector _callpal; 6212182Sgabeblack@google.com 6312182Sgabeblack@google.com Stats::Scalar _hwrei; 643560SN/A 655999Snate@binkert.org Stats::Vector _mode; 665999Snate@binkert.org Stats::Vector _modeGood; 673560SN/A Stats::Formula _modeFraction; 685999Snate@binkert.org Stats::Vector _modeTicks; 693560SN/A 705999Snate@binkert.org Stats::Scalar _swap_context; 713560SN/A 7212182Sgabeblack@google.com Stats::Vector _iplCount; 7312182Sgabeblack@google.com Stats::Vector _iplGood; 7412182Sgabeblack@google.com Stats::Vector _iplTicks; 7512182Sgabeblack@google.com Stats::Formula _iplUsed; 7612182Sgabeblack@google.com 7712182Sgabeblack@google.com private: 7812182Sgabeblack@google.com int iplLast; 7912182Sgabeblack@google.com Tick iplLastTick; 8012182Sgabeblack@google.com 813560SN/A public: 8212181Sgabeblack@google.com Statistics(); 833560SN/A 843560SN/A void regStats(const std::string &name); 853560SN/A 863560SN/A public: 873560SN/A void mode(cpu_mode newmode, ThreadContext *tc); 883560SN/A void context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc); 893560SN/A void callpal(int code, ThreadContext *tc); 903560SN/A void hwrei() { _hwrei++; } 9112182Sgabeblack@google.com void swpipl(int ipl); 923560SN/A 933560SN/A void setIdleProcess(Addr idle, ThreadContext *tc); 943560SN/A 953560SN/A public: 9611168Sandreas.hansson@arm.com void serialize(CheckpointOut &cp) const override; 9711168Sandreas.hansson@arm.com void unserialize(CheckpointIn &cp) override; 983560SN/A}; 993560SN/A 1005568Snate@binkert.org} // namespace Kernel 1015568Snate@binkert.org} // namespace AlphaISA 1023560SN/A 1033560SN/A#endif // __ARCH_ALPHA_KERNEL_STATS_HH__ 104