base.cc revision 8229
12810SN/A/* 22810SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 32810SN/A * All rights reserved. 42810SN/A * 52810SN/A * Redistribution and use in source and binary forms, with or without 62810SN/A * modification, are permitted provided that the following conditions are 72810SN/A * met: redistributions of source code must retain the above copyright 82810SN/A * notice, this list of conditions and the following disclaimer; 92810SN/A * redistributions in binary form must reproduce the above copyright 102810SN/A * notice, this list of conditions and the following disclaimer in the 112810SN/A * documentation and/or other materials provided with the distribution; 122810SN/A * neither the name of the copyright holders nor the names of its 132810SN/A * contributors may be used to endorse or promote products derived from 142810SN/A * this software without specific prior written permission. 152810SN/A * 162810SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 172810SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 182810SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 192810SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 202810SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 212810SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 222810SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 232810SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 242810SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 252810SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 262810SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272810SN/A * 282810SN/A * Authors: Erik Hallnor 292810SN/A * Ron Dreslinski 302810SN/A */ 312810SN/A 322810SN/A/** 332810SN/A * @file 342810SN/A * Definitions of BaseTags. 352810SN/A */ 362810SN/A 378229Snate@binkert.org#include "cpu/smt.hh" //maxThreadsPerCPU 385338Sstever@gmail.com#include "mem/cache/tags/base.hh" 395338Sstever@gmail.com#include "mem/cache/base.hh" 402810SN/A#include "sim/sim_exit.hh" 412810SN/A 422810SN/Ausing namespace std; 432810SN/A 442810SN/Avoid 452810SN/ABaseTags::setCache(BaseCache *_cache) 462810SN/A{ 472810SN/A cache = _cache; 482810SN/A objName = cache->name(); 492810SN/A} 502810SN/A 512810SN/Avoid 522810SN/ABaseTags::regStats(const string &name) 532810SN/A{ 542810SN/A using namespace Stats; 552810SN/A replacements 562810SN/A .init(maxThreadsPerCPU) 572810SN/A .name(name + ".replacements") 582810SN/A .desc("number of replacements") 592810SN/A .flags(total) 602810SN/A ; 612810SN/A 622810SN/A tagsInUse 632810SN/A .name(name + ".tagsinuse") 642810SN/A .desc("Cycle average of tags in use") 652810SN/A ; 662810SN/A 672810SN/A totalRefs 682810SN/A .name(name + ".total_refs") 692810SN/A .desc("Total number of references to valid blocks.") 702810SN/A ; 712810SN/A 722810SN/A sampledRefs 732810SN/A .name(name + ".sampled_refs") 742810SN/A .desc("Sample count of references to valid blocks.") 752810SN/A ; 762810SN/A 772810SN/A avgRefs 782810SN/A .name(name + ".avg_refs") 792810SN/A .desc("Average number of references to valid blocks.") 802810SN/A ; 812810SN/A 822810SN/A avgRefs = totalRefs/sampledRefs; 832810SN/A 842810SN/A warmupCycle 852810SN/A .name(name + ".warmup_cycle") 862810SN/A .desc("Cycle when the warmup percentage was hit.") 872810SN/A ; 882810SN/A 896978SLisa.Hsu@amd.com occupancies 906979SLisa.Hsu@amd.com .init(cache->numCpus() + 1) 916978SLisa.Hsu@amd.com .name(name + ".occ_blocks") 926978SLisa.Hsu@amd.com .desc("Average occupied blocks per context") 936978SLisa.Hsu@amd.com .flags(nozero | nonan) 946978SLisa.Hsu@amd.com ; 956978SLisa.Hsu@amd.com 966978SLisa.Hsu@amd.com avgOccs 976978SLisa.Hsu@amd.com .name(name + ".occ_%") 986978SLisa.Hsu@amd.com .desc("Average percentage of cache occupancy") 996978SLisa.Hsu@amd.com .flags(nozero) 1006978SLisa.Hsu@amd.com ; 1016978SLisa.Hsu@amd.com 1026978SLisa.Hsu@amd.com avgOccs = occupancies / Stats::constant(numBlocks); 1036978SLisa.Hsu@amd.com 1042810SN/A registerExitCallback(new BaseTagsCallback(this)); 1052810SN/A} 106