kernel_stats.hh revision 5999
1754SN/A/*
21762SN/A * Copyright (c) 2004-2005 The Regents of The University of Michigan
3754SN/A * All rights reserved.
4754SN/A *
5754SN/A * Redistribution and use in source and binary forms, with or without
6754SN/A * modification, are permitted provided that the following conditions are
7754SN/A * met: redistributions of source code must retain the above copyright
8754SN/A * notice, this list of conditions and the following disclaimer;
9754SN/A * redistributions in binary form must reproduce the above copyright
10754SN/A * notice, this list of conditions and the following disclaimer in the
11754SN/A * documentation and/or other materials provided with the distribution;
12754SN/A * neither the name of the copyright holders nor the names of its
13754SN/A * contributors may be used to endorse or promote products derived from
14754SN/A * this software without specific prior written permission.
15754SN/A *
16754SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17754SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18754SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19754SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20754SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21754SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22754SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23754SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24754SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25754SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26754SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
272665Ssaidi@eecs.umich.edu *
282665Ssaidi@eecs.umich.edu * Authors: Lisa Hsu
292665Ssaidi@eecs.umich.edu *          Nathan Binkert
30754SN/A */
31754SN/A
32754SN/A#ifndef __KERNEL_STATS_HH__
33754SN/A#define __KERNEL_STATS_HH__
34754SN/A
35754SN/A#include <string>
36754SN/A
371917SN/A#include "cpu/static_inst.hh"
383548SN/A#include "sim/serialize.hh"
391917SN/A
401070SN/Aclass BaseCPU;
412680Sktlim@umich.educlass ThreadContext;
421070SN/Aclass FnEvent;
431681SN/A// What does kernel stats expect is included?
441681SN/Aclass System;
45754SN/A
461070SN/Anamespace Kernel {
471070SN/A
481070SN/Aclass Statistics : public Serializable
491070SN/A{
503548SN/A  protected:
511070SN/A    std::string myname;
521070SN/A
533548SN/A  protected:
545999Snate@binkert.org    Stats::Scalar _arm;
555999Snate@binkert.org    Stats::Scalar _quiesce;
565999Snate@binkert.org    Stats::Scalar _hwrei;
571070SN/A
585999Snate@binkert.org    Stats::Vector _iplCount;
595999Snate@binkert.org    Stats::Vector _iplGood;
605999Snate@binkert.org    Stats::Vector _iplTicks;
611070SN/A    Stats::Formula _iplUsed;
621070SN/A
635999Snate@binkert.org    Stats::Vector _syscall;
645999Snate@binkert.org//    Stats::Vector _faults;
651070SN/A
661070SN/A  private:
671070SN/A    int iplLast;
681070SN/A    Tick iplLastTick;
691070SN/A
701070SN/A  public:
712190SN/A    Statistics(System *system);
723548SN/A    virtual ~Statistics() {}
731070SN/A
741070SN/A    const std::string name() const { return myname; }
751070SN/A    void regStats(const std::string &name);
761070SN/A
771070SN/A  public:
781070SN/A    void arm() { _arm++; }
791070SN/A    void quiesce() { _quiesce++; }
801070SN/A    void swpipl(int ipl);
811070SN/A
821070SN/A  public:
831070SN/A    virtual void serialize(std::ostream &os);
841070SN/A    virtual void unserialize(Checkpoint *cp, const std::string &section);
851070SN/A};
861070SN/A
871070SN/A/* end namespace Kernel */ }
881070SN/A
89754SN/A#endif // __KERNEL_STATS_HH__
90