1/* 2 * Copyright (c) 2003-2005 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; 9 * redistributions in binary form must reproduce the above copyright 10 * notice, this list of conditions and the following disclaimer in the 11 * documentation and/or other materials provided with the distribution; 12 * neither the name of the copyright holders nor the names of its 13 * contributors may be used to endorse or promote products derived from 14 * this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * Authors: Erik Hallnor 29 * Ron Dreslinski 30 */ 31 32/** 33 * @file 34 * Declaration of a common base class for cache tagstore objects. 35 */ 36 37#ifndef __BASE_TAGS_HH__ 38#define __BASE_TAGS_HH__ 39 40#include <string> 41 42#include "base/callback.hh" 43#include "base/statistics.hh" 44 45class BaseCache; 46 47/** 48 * A common base class of Cache tagstore objects. 49 */ 50class BaseTags 51{ 52 protected: 53 /** Pointer to the parent cache. */ 54 BaseCache *cache; 55 56 /** Local copy of the parent cache name. Used for DPRINTF. */ 57 std::string objName; 58 59 /** 60 * The number of tags that need to be touched to meet the warmup 61 * percentage. 62 */ 63 int warmupBound; 64 /** Marked true when the cache is warmed up. */ 65 bool warmedUp; 66 67 /** the number of blocks in the cache */ 68 unsigned numBlocks; 69 70 // Statistics 71 /** 72 * @addtogroup CacheStatistics 73 * @{ 74 */ 75 76 /** Number of replacements of valid blocks per thread. */ 77 Stats::Vector replacements; 78 /** Per cycle average of the number of tags that hold valid data. */ 79 Stats::Average tagsInUse; 80 81 /** The total number of references to a block before it is replaced. */ 82 Stats::Scalar totalRefs; 83 84 /** 85 * The number of reference counts sampled. This is different from 86 * replacements because we sample all the valid blocks when the simulator 87 * exits. 88 */ 89 Stats::Scalar sampledRefs; 90 91 /** 92 * Average number of references to a block before is was replaced. 93 * @todo This should change to an average stat once we have them. 94 */ 95 Stats::Formula avgRefs; 96 97 /** The cycle that the warmup percentage was hit. */ 98 Stats::Scalar warmupCycle; 99
|