kernel_stats.hh revision 11168
13520Sgblack@eecs.umich.edu/*
23520Sgblack@eecs.umich.edu * Copyright (c) 2004-2005 The Regents of The University of Michigan
33520Sgblack@eecs.umich.edu * All rights reserved.
43520Sgblack@eecs.umich.edu *
53520Sgblack@eecs.umich.edu * Redistribution and use in source and binary forms, with or without
63520Sgblack@eecs.umich.edu * modification, are permitted provided that the following conditions are
73520Sgblack@eecs.umich.edu * met: redistributions of source code must retain the above copyright
83520Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer;
93520Sgblack@eecs.umich.edu * redistributions in binary form must reproduce the above copyright
103520Sgblack@eecs.umich.edu * notice, this list of conditions and the following disclaimer in the
113520Sgblack@eecs.umich.edu * documentation and/or other materials provided with the distribution;
123520Sgblack@eecs.umich.edu * neither the name of the copyright holders nor the names of its
133520Sgblack@eecs.umich.edu * contributors may be used to endorse or promote products derived from
143520Sgblack@eecs.umich.edu * this software without specific prior written permission.
153520Sgblack@eecs.umich.edu *
163520Sgblack@eecs.umich.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
173520Sgblack@eecs.umich.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
183520Sgblack@eecs.umich.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
193520Sgblack@eecs.umich.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
203520Sgblack@eecs.umich.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
213520Sgblack@eecs.umich.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
223520Sgblack@eecs.umich.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
233520Sgblack@eecs.umich.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
243520Sgblack@eecs.umich.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
253520Sgblack@eecs.umich.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
263520Sgblack@eecs.umich.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
273520Sgblack@eecs.umich.edu *
283520Sgblack@eecs.umich.edu * Authors: Lisa Hsu
293520Sgblack@eecs.umich.edu *          Nathan Binkert
303520Sgblack@eecs.umich.edu */
313520Sgblack@eecs.umich.edu
323520Sgblack@eecs.umich.edu#ifndef __ARCH_ALPHA_KERNEL_STATS_HH__
333520Sgblack@eecs.umich.edu#define __ARCH_ALPHA_KERNEL_STATS_HH__
343520Sgblack@eecs.umich.edu
353520Sgblack@eecs.umich.edu#include <map>
363520Sgblack@eecs.umich.edu#include <stack>
374103Ssaidi@eecs.umich.edu#include <string>
385647Sgblack@eecs.umich.edu#include <vector>
393520Sgblack@eecs.umich.edu
405647Sgblack@eecs.umich.edu#include "cpu/static_inst.hh"
415647Sgblack@eecs.umich.edu#include "kern/kernel_stats.hh"
423520Sgblack@eecs.umich.edu
435565Snate@binkert.orgclass BaseCPU;
445565Snate@binkert.orgclass ThreadContext;
455647Sgblack@eecs.umich.educlass FnEvent;
463520Sgblack@eecs.umich.edu// What does kernel stats expect is included?
475565Snate@binkert.orgclass System;
485565Snate@binkert.org
495565Snate@binkert.orgnamespace AlphaISA {
505565Snate@binkert.orgnamespace Kernel {
515810Sgblack@eecs.umich.edu
525565Snate@binkert.orgenum cpu_mode { kernel, user, idle, cpu_mode_num };
535565Snate@binkert.orgextern const char *modestr[];
545565Snate@binkert.org
555565Snate@binkert.orgclass Statistics : public ::Kernel::Statistics
565565Snate@binkert.org{
575565Snate@binkert.org  protected:
585647Sgblack@eecs.umich.edu    Addr idleProcess;
595647Sgblack@eecs.umich.edu    cpu_mode themode;
605647Sgblack@eecs.umich.edu    Tick lastModeTick;
615647Sgblack@eecs.umich.edu
625647Sgblack@eecs.umich.edu    void changeMode(cpu_mode newmode, ThreadContext *tc);
635647Sgblack@eecs.umich.edu
645647Sgblack@eecs.umich.edu  private:
655647Sgblack@eecs.umich.edu    Stats::Vector _callpal;
665810Sgblack@eecs.umich.edu//    Stats::Vector _faults;
673520Sgblack@eecs.umich.edu
685565Snate@binkert.org    Stats::Vector _mode;
695565Snate@binkert.org    Stats::Vector _modeGood;
705565Snate@binkert.org    Stats::Formula _modeFraction;
715565Snate@binkert.org    Stats::Vector _modeTicks;
723520Sgblack@eecs.umich.edu
735565Snate@binkert.org    Stats::Scalar _swap_context;
745810Sgblack@eecs.umich.edu
755810Sgblack@eecs.umich.edu  public:
765810Sgblack@eecs.umich.edu    Statistics(System *system);
775810Sgblack@eecs.umich.edu
785810Sgblack@eecs.umich.edu    void regStats(const std::string &name);
795810Sgblack@eecs.umich.edu
805565Snate@binkert.org  public:
815565Snate@binkert.org    void mode(cpu_mode newmode, ThreadContext *tc);
825565Snate@binkert.org    void context(Addr oldpcbb, Addr newpcbb, ThreadContext *tc);
833520Sgblack@eecs.umich.edu    void callpal(int code, ThreadContext *tc);
845565Snate@binkert.org    void hwrei() { _hwrei++; }
855565Snate@binkert.org
863520Sgblack@eecs.umich.edu    void setIdleProcess(Addr idle, ThreadContext *tc);
875565Snate@binkert.org
885565Snate@binkert.org  public:
893520Sgblack@eecs.umich.edu    void serialize(CheckpointOut &cp) const override;
905565Snate@binkert.org    void unserialize(CheckpointIn &cp) override;
915565Snate@binkert.org};
925565Snate@binkert.org
933520Sgblack@eecs.umich.edu} // namespace Kernel
945565Snate@binkert.org} // namespace AlphaISA
955565Snate@binkert.org
965565Snate@binkert.org#endif // __ARCH_ALPHA_KERNEL_STATS_HH__
975565Snate@binkert.org