base.cc revision 3495
16167SN/A/*
26167SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan
39204Sandreas.hansson@arm.com * All rights reserved.
49204Sandreas.hansson@arm.com *
59204Sandreas.hansson@arm.com * Redistribution and use in source and binary forms, with or without
68673SN/A * modification, are permitted provided that the following conditions are
79864Snilay@cs.wisc.edu * met: redistributions of source code must retain the above copyright
89864Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer;
99864Snilay@cs.wisc.edu * redistributions in binary form must reproduce the above copyright
109864Snilay@cs.wisc.edu * notice, this list of conditions and the following disclaimer in the
119864Snilay@cs.wisc.edu * documentation and/or other materials provided with the distribution;
129150SAli.Saidi@ARM.com * neither the name of the copyright holders nor the names of its
139583Snilay@cs.wisc.edu * contributors may be used to endorse or promote products derived from
149698Snilay@cs.wisc.edu * this software without specific prior written permission.
159698Snilay@cs.wisc.edu *
169698Snilay@cs.wisc.edu * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
179864Snilay@cs.wisc.edu * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
189864Snilay@cs.wisc.edu * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
199864Snilay@cs.wisc.edu * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
209864Snilay@cs.wisc.edu * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
219864Snilay@cs.wisc.edu * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
229864Snilay@cs.wisc.edu * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239864Snilay@cs.wisc.edu * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249864Snilay@cs.wisc.edu * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259864Snilay@cs.wisc.edu * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
269748Snilay@cs.wisc.edu * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279748Snilay@cs.wisc.edu *
289748Snilay@cs.wisc.edu * Authors: Erik Hallnor
299748Snilay@cs.wisc.edu *          Ron Dreslinski
309748Snilay@cs.wisc.edu */
319748Snilay@cs.wisc.edu
329748Snilay@cs.wisc.edu/**
339748Snilay@cs.wisc.edu * @file
349748Snilay@cs.wisc.edu * Definitions of BaseTags.
359748Snilay@cs.wisc.edu */
369748Snilay@cs.wisc.edu
379748Snilay@cs.wisc.edu#include "mem/cache/tags/base_tags.hh"
389748Snilay@cs.wisc.edu
399748Snilay@cs.wisc.edu#include "mem/cache/base_cache.hh"
409748Snilay@cs.wisc.edu#include "cpu/smt.hh" //maxThreadsPerCPU
419864Snilay@cs.wisc.edu#include "sim/sim_exit.hh"
429864Snilay@cs.wisc.edu
439864Snilay@cs.wisc.eduusing namespace std;
449864Snilay@cs.wisc.edu
459864Snilay@cs.wisc.eduvoid
469864Snilay@cs.wisc.eduBaseTags::setCache(BaseCache *_cache)
479864Snilay@cs.wisc.edu{
489864Snilay@cs.wisc.edu    cache = _cache;
499864Snilay@cs.wisc.edu    objName = cache->name();
509864Snilay@cs.wisc.edu}
519864Snilay@cs.wisc.edu
529864Snilay@cs.wisc.eduvoid
539864Snilay@cs.wisc.eduBaseTags::regStats(const string &name)
549864Snilay@cs.wisc.edu{
559864Snilay@cs.wisc.edu    using namespace Stats;
569864Snilay@cs.wisc.edu    replacements
579864Snilay@cs.wisc.edu        .init(maxThreadsPerCPU)
589864Snilay@cs.wisc.edu        .name(name + ".replacements")
598673SN/A        .desc("number of replacements")
609204Sandreas.hansson@arm.com        .flags(total)
618673SN/A        ;
627935SN/A
639150SAli.Saidi@ARM.com    tagsInUse
649583Snilay@cs.wisc.edu        .name(name + ".tagsinuse")
659583Snilay@cs.wisc.edu        .desc("Cycle average of tags in use")
668673SN/A        ;
679702Snilay@cs.wisc.edu
689150SAli.Saidi@ARM.com    totalRefs
699583Snilay@cs.wisc.edu        .name(name + ".total_refs")
707935SN/A        .desc("Total number of references to valid blocks.")
719583Snilay@cs.wisc.edu        ;
729583Snilay@cs.wisc.edu
737935SN/A    sampledRefs
747935SN/A        .name(name + ".sampled_refs")
759583Snilay@cs.wisc.edu        .desc("Sample count of references to valid blocks.")
769583Snilay@cs.wisc.edu        ;
779373Snilay@cs.wisc.edu
787935SN/A    avgRefs
799204Sandreas.hansson@arm.com        .name(name + ".avg_refs")
808673SN/A        .desc("Average number of references to valid blocks.")
818673SN/A        ;
829864Snilay@cs.wisc.edu
839864Snilay@cs.wisc.edu    avgRefs = totalRefs/sampledRefs;
849864Snilay@cs.wisc.edu
859864Snilay@cs.wisc.edu    warmupCycle
869864Snilay@cs.wisc.edu        .name(name + ".warmup_cycle")
879864Snilay@cs.wisc.edu        .desc("Cycle when the warmup percentage was hit.")
889864Snilay@cs.wisc.edu        ;
899864Snilay@cs.wisc.edu
909864Snilay@cs.wisc.edu    registerExitCallback(new BaseTagsCallback(this));
919864Snilay@cs.wisc.edu}
929864Snilay@cs.wisc.edu