base.cc revision 10344
12810SN/A/* 213932Snikos.nikoleris@arm.com * Copyright (c) 2012-2013 ARM Limited 38856Sandreas.hansson@arm.com * All rights reserved. 48856Sandreas.hansson@arm.com * 58856Sandreas.hansson@arm.com * The license below extends only to copyright in the software and shall 68856Sandreas.hansson@arm.com * not be construed as granting a license to any other intellectual 78856Sandreas.hansson@arm.com * property including but not limited to intellectual property relating 88856Sandreas.hansson@arm.com * to a hardware implementation of the functionality of the software 98856Sandreas.hansson@arm.com * licensed hereunder. You may use the software subject to the license 108856Sandreas.hansson@arm.com * terms below provided that you ensure that this notice is replicated 118856Sandreas.hansson@arm.com * unmodified and in its entirety in all distributions of the software, 128856Sandreas.hansson@arm.com * modified or unmodified, in source code or in binary form. 138856Sandreas.hansson@arm.com * 142810SN/A * Copyright (c) 2003-2005 The Regents of The University of Michigan 152810SN/A * All rights reserved. 162810SN/A * 172810SN/A * Redistribution and use in source and binary forms, with or without 182810SN/A * modification, are permitted provided that the following conditions are 192810SN/A * met: redistributions of source code must retain the above copyright 202810SN/A * notice, this list of conditions and the following disclaimer; 212810SN/A * redistributions in binary form must reproduce the above copyright 222810SN/A * notice, this list of conditions and the following disclaimer in the 232810SN/A * documentation and/or other materials provided with the distribution; 242810SN/A * neither the name of the copyright holders nor the names of its 252810SN/A * contributors may be used to endorse or promote products derived from 262810SN/A * this software without specific prior written permission. 272810SN/A * 282810SN/A * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 292810SN/A * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 302810SN/A * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 312810SN/A * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 322810SN/A * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 332810SN/A * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 342810SN/A * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 352810SN/A * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 362810SN/A * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 372810SN/A * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 382810SN/A * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 392810SN/A * 402810SN/A * Authors: Erik Hallnor 4112724Snikos.nikoleris@arm.com */ 422810SN/A 432810SN/A/** 442810SN/A * @file 452810SN/A * Definition of BaseCache functions. 462810SN/A */ 472810SN/A 482810SN/A#include "debug/Cache.hh" 4911486Snikos.nikoleris@arm.com#include "debug/Drain.hh" 5011486Snikos.nikoleris@arm.com#include "mem/cache/tags/fa_lru.hh" 5112724Snikos.nikoleris@arm.com#include "mem/cache/tags/lru.hh" 5212724Snikos.nikoleris@arm.com#include "mem/cache/tags/random_repl.hh" 538232Snate@binkert.org#include "mem/cache/base.hh" 5412724Snikos.nikoleris@arm.com#include "mem/cache/cache.hh" 5513222Sodanrc@yahoo.com.br#include "mem/cache/mshr.hh" 5612724Snikos.nikoleris@arm.com#include "sim/full_system.hh" 5713945Sodanrc@yahoo.com.br 5811486Snikos.nikoleris@arm.comusing namespace std; 5912724Snikos.nikoleris@arm.com 6012724Snikos.nikoleris@arm.comBaseCache::CacheSlavePort::CacheSlavePort(const std::string &_name, 6112724Snikos.nikoleris@arm.com BaseCache *_cache, 6213352Snikos.nikoleris@arm.com const std::string &_label) 6312724Snikos.nikoleris@arm.com : QueuedSlavePort(_name, _cache, queue), queue(*_cache, *this, _label), 6412724Snikos.nikoleris@arm.com blocked(false), mustSendRetry(false), sendRetryEvent(this) 6512724Snikos.nikoleris@arm.com{ 6612724Snikos.nikoleris@arm.com} 672810SN/A 682810SN/ABaseCache::BaseCache(const Params *p) 692810SN/A : MemObject(p), 708856Sandreas.hansson@arm.com mshrQueue("MSHRs", p->mshrs, 4, MSHRQueue_MSHRs), 718856Sandreas.hansson@arm.com writeBuffer("write buffer", p->write_buffers, p->mshrs+1000, 728856Sandreas.hansson@arm.com MSHRQueue_WriteBuffer), 7313564Snikos.nikoleris@arm.com blkSize(p->system->cacheLineSize()), 7413564Snikos.nikoleris@arm.com hitLatency(p->hit_latency), 7512084Sspwilson2@wisc.edu responseLatency(p->response_latency), 7612084Sspwilson2@wisc.edu numTarget(p->tgts_per_mshr), 778856Sandreas.hansson@arm.com forwardSnoops(p->forward_snoops), 788856Sandreas.hansson@arm.com isTopLevel(p->is_top_level), 794475SN/A blocked(0), 8011053Sandreas.hansson@arm.com noTargetMSHR(NULL), 8113892Sgabeblack@google.com missCount(p->max_miss_count), 8212724Snikos.nikoleris@arm.com addrRanges(p->addr_ranges.begin(), p->addr_ranges.end()), 8312724Snikos.nikoleris@arm.com system(p->system) 8411377Sandreas.hansson@arm.com{ 8511377Sandreas.hansson@arm.com} 8612724Snikos.nikoleris@arm.com 8713945Sodanrc@yahoo.com.brvoid 8812724Snikos.nikoleris@arm.comBaseCache::CacheSlavePort::setBlocked() 8913352Snikos.nikoleris@arm.com{ 9012724Snikos.nikoleris@arm.com assert(!blocked); 9112724Snikos.nikoleris@arm.com DPRINTF(CachePort, "Cache port %s blocking new requests\n", name()); 9212724Snikos.nikoleris@arm.com blocked = true; 9312724Snikos.nikoleris@arm.com // if we already scheduled a retry in this cycle, but it has not yet 9412724Snikos.nikoleris@arm.com // happened, cancel it 9511053Sandreas.hansson@arm.com if (sendRetryEvent.scheduled()) { 9611722Ssophiane.senni@gmail.com owner.deschedule(sendRetryEvent); 9711722Ssophiane.senni@gmail.com DPRINTF(CachePort, "Cache port %s deschedule retry\n", name()); 9811722Ssophiane.senni@gmail.com mustSendRetry = true; 9911722Ssophiane.senni@gmail.com } 1009263Smrinmoy.ghosh@arm.com} 10113418Sodanrc@yahoo.com.br 1025034SN/Avoid 10311331Sandreas.hansson@arm.comBaseCache::CacheSlavePort::clearBlocked() 10412724Snikos.nikoleris@arm.com{ 10510884Sandreas.hansson@arm.com assert(blocked); 1064626SN/A DPRINTF(CachePort, "Cache port %s accepting new requests\n", name()); 10710360Sandreas.hansson@arm.com blocked = false; 10811484Snikos.nikoleris@arm.com if (mustSendRetry) { 1095034SN/A // @TODO: need to find a better time (next bus cycle?) 1108883SAli.Saidi@ARM.com owner.schedule(sendRetryEvent, curTick() + 1); 1118833Sdam.sunwoo@arm.com } 1124458SN/A} 11311377Sandreas.hansson@arm.com 11411377Sandreas.hansson@arm.comvoid 11511377Sandreas.hansson@arm.comBaseCache::CacheSlavePort::processSendRetry() 11611377Sandreas.hansson@arm.com{ 11711377Sandreas.hansson@arm.com DPRINTF(CachePort, "Cache port %s sending retry\n", name()); 11811377Sandreas.hansson@arm.com 11911331Sandreas.hansson@arm.com // reset the flag and call retry 12011331Sandreas.hansson@arm.com mustSendRetry = false; 12112724Snikos.nikoleris@arm.com sendRetry(); 12212843Srmk35@cl.cam.ac.uk} 12312724Snikos.nikoleris@arm.com 12413419Sodanrc@yahoo.com.brvoid 12512724Snikos.nikoleris@arm.comBaseCache::init() 12612724Snikos.nikoleris@arm.com{ 12712724Snikos.nikoleris@arm.com if (!cpuSidePort->isConnected() || !memSidePort->isConnected()) 12812724Snikos.nikoleris@arm.com fatal("Cache ports on %s are not connected\n", name()); 12912724Snikos.nikoleris@arm.com cpuSidePort->sendRangeChange(); 13012724Snikos.nikoleris@arm.com} 13112724Snikos.nikoleris@arm.com 1322810SN/ABaseMasterPort & 1332810SN/ABaseCache::getMasterPort(const std::string &if_name, PortID idx) 1343013SN/A{ 1358856Sandreas.hansson@arm.com if (if_name == "mem_side") { 1362810SN/A return *memSidePort; 1373013SN/A } else { 13810714Sandreas.hansson@arm.com return MemObject::getMasterPort(if_name, idx); 1392810SN/A } 1409614Srene.dejong@arm.com} 1419614Srene.dejong@arm.com 1429614Srene.dejong@arm.comBaseSlavePort & 14310345SCurtis.Dunham@arm.comBaseCache::getSlavePort(const std::string &if_name, PortID idx) 14410714Sandreas.hansson@arm.com{ 14510345SCurtis.Dunham@arm.com if (if_name == "cpu_side") { 1469614Srene.dejong@arm.com return *cpuSidePort; 1472810SN/A } else { 1482810SN/A return MemObject::getSlavePort(if_name, idx); 1492810SN/A } 1508856Sandreas.hansson@arm.com} 1512810SN/A 1523013SN/Avoid 15310714Sandreas.hansson@arm.comBaseCache::regStats() 1543013SN/A{ 1558856Sandreas.hansson@arm.com using namespace Stats; 15610714Sandreas.hansson@arm.com 1578922Swilliam.wang@arm.com // Hit statistics 1582897SN/A for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 1592810SN/A MemCmd cmd(access_idx); 1602810SN/A const string &cstr = cmd.toString(); 16110344Sandreas.hansson@arm.com 16210344Sandreas.hansson@arm.com hits[access_idx] 16310344Sandreas.hansson@arm.com .init(system->maxMasters()) 16410714Sandreas.hansson@arm.com .name(name() + "." + cstr + "_hits") 16510344Sandreas.hansson@arm.com .desc("number of " + cstr + " hits") 16610344Sandreas.hansson@arm.com .flags(total | nozero | nonan) 16710344Sandreas.hansson@arm.com ; 16810713Sandreas.hansson@arm.com for (int i = 0; i < system->maxMasters(); i++) { 16910344Sandreas.hansson@arm.com hits[access_idx].subname(i, system->getMasterName(i)); 1702844SN/A } 17112730Sodanrc@yahoo.com.br } 17212730Sodanrc@yahoo.com.br 17312730Sodanrc@yahoo.com.br// These macros make it easier to sum the right subset of commands and 17412730Sodanrc@yahoo.com.br// to change the subset of commands that are considered "demand" vs 17512730Sodanrc@yahoo.com.br// "non-demand" 17612730Sodanrc@yahoo.com.br#define SUM_DEMAND(s) \ 17712730Sodanrc@yahoo.com.br (s[MemCmd::ReadReq] + s[MemCmd::WriteReq] + s[MemCmd::ReadExReq]) 17812730Sodanrc@yahoo.com.br 17912730Sodanrc@yahoo.com.br// should writebacks be included here? prior code was inconsistent... 18012730Sodanrc@yahoo.com.br#define SUM_NON_DEMAND(s) \ 1812810SN/A (s[MemCmd::SoftPFReq] + s[MemCmd::HardPFReq]) 1822858SN/A 1832858SN/A demandHits 18412724Snikos.nikoleris@arm.com .name(name() + ".demand_hits") 1858922Swilliam.wang@arm.com .desc("number of demand (read+write) hits") 18612724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 18712724Snikos.nikoleris@arm.com ; 1882858SN/A demandHits = SUM_DEMAND(hits); 1892858SN/A for (int i = 0; i < system->maxMasters(); i++) { 19013784Sgabeblack@google.com demandHits.subname(i, system->getMasterName(i)); 19113784Sgabeblack@google.com } 1928922Swilliam.wang@arm.com 1938922Swilliam.wang@arm.com overallHits 19412724Snikos.nikoleris@arm.com .name(name() + ".overall_hits") 19513784Sgabeblack@google.com .desc("number of overall hits") 19613784Sgabeblack@google.com .flags(total | nozero | nonan) 1978922Swilliam.wang@arm.com ; 19813892Sgabeblack@google.com overallHits = demandHits + SUM_NON_DEMAND(hits); 1998922Swilliam.wang@arm.com for (int i = 0; i < system->maxMasters(); i++) { 2008922Swilliam.wang@arm.com overallHits.subname(i, system->getMasterName(i)); 2014628SN/A } 20210821Sandreas.hansson@arm.com 20310821Sandreas.hansson@arm.com // Miss statistics 20410821Sandreas.hansson@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 20510821Sandreas.hansson@arm.com MemCmd cmd(access_idx); 20610821Sandreas.hansson@arm.com const string &cstr = cmd.toString(); 20710821Sandreas.hansson@arm.com 20810821Sandreas.hansson@arm.com misses[access_idx] 20910821Sandreas.hansson@arm.com .init(system->maxMasters()) 21010821Sandreas.hansson@arm.com .name(name() + "." + cstr + "_misses") 21110821Sandreas.hansson@arm.com .desc("number of " + cstr + " misses") 21210821Sandreas.hansson@arm.com .flags(total | nozero | nonan) 2132858SN/A ; 21412724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 21512724Snikos.nikoleris@arm.com misses[access_idx].subname(i, system->getMasterName(i)); 21612724Snikos.nikoleris@arm.com } 21713745Sodanrc@yahoo.com.br } 21813745Sodanrc@yahoo.com.br 21913745Sodanrc@yahoo.com.br demandMisses 22013745Sodanrc@yahoo.com.br .name(name() + ".demand_misses") 22112724Snikos.nikoleris@arm.com .desc("number of demand (read+write) misses") 22212724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 22312724Snikos.nikoleris@arm.com ; 22412724Snikos.nikoleris@arm.com demandMisses = SUM_DEMAND(misses); 22512724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 22613418Sodanrc@yahoo.com.br demandMisses.subname(i, system->getMasterName(i)); 22713418Sodanrc@yahoo.com.br } 22813564Snikos.nikoleris@arm.com 22912724Snikos.nikoleris@arm.com overallMisses 23012724Snikos.nikoleris@arm.com .name(name() + ".overall_misses") 23112724Snikos.nikoleris@arm.com .desc("number of overall misses") 23212724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 23312724Snikos.nikoleris@arm.com ; 23412724Snikos.nikoleris@arm.com overallMisses = demandMisses + SUM_NON_DEMAND(misses); 23512724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 23612724Snikos.nikoleris@arm.com overallMisses.subname(i, system->getMasterName(i)); 23712724Snikos.nikoleris@arm.com } 23812724Snikos.nikoleris@arm.com 23912724Snikos.nikoleris@arm.com // Miss latency statistics 24012724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 24112724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 24212724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 24312724Snikos.nikoleris@arm.com 24412724Snikos.nikoleris@arm.com missLatency[access_idx] 24513352Snikos.nikoleris@arm.com .init(system->maxMasters()) 24613352Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_miss_latency") 24713352Snikos.nikoleris@arm.com .desc("number of " + cstr + " miss cycles") 24813352Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 24913352Snikos.nikoleris@arm.com ; 25013352Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 25112724Snikos.nikoleris@arm.com missLatency[access_idx].subname(i, system->getMasterName(i)); 25212724Snikos.nikoleris@arm.com } 25312724Snikos.nikoleris@arm.com } 25412724Snikos.nikoleris@arm.com 25512724Snikos.nikoleris@arm.com demandMissLatency 25612724Snikos.nikoleris@arm.com .name(name() + ".demand_miss_latency") 25712724Snikos.nikoleris@arm.com .desc("number of demand (read+write) miss cycles") 25812724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 25912724Snikos.nikoleris@arm.com ; 26012724Snikos.nikoleris@arm.com demandMissLatency = SUM_DEMAND(missLatency); 26112724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 26212724Snikos.nikoleris@arm.com demandMissLatency.subname(i, system->getMasterName(i)); 26312724Snikos.nikoleris@arm.com } 26412724Snikos.nikoleris@arm.com 26512724Snikos.nikoleris@arm.com overallMissLatency 26612724Snikos.nikoleris@arm.com .name(name() + ".overall_miss_latency") 26712724Snikos.nikoleris@arm.com .desc("number of overall miss cycles") 26812724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 26912724Snikos.nikoleris@arm.com ; 27012724Snikos.nikoleris@arm.com overallMissLatency = demandMissLatency + SUM_NON_DEMAND(missLatency); 27112724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 27212724Snikos.nikoleris@arm.com overallMissLatency.subname(i, system->getMasterName(i)); 27312724Snikos.nikoleris@arm.com } 27412724Snikos.nikoleris@arm.com 27512724Snikos.nikoleris@arm.com // access formulas 27612724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 27712724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 27812724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 27912724Snikos.nikoleris@arm.com 28012724Snikos.nikoleris@arm.com accesses[access_idx] 28112724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_accesses") 28212724Snikos.nikoleris@arm.com .desc("number of " + cstr + " accesses(hits+misses)") 28312724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 28412724Snikos.nikoleris@arm.com ; 28512724Snikos.nikoleris@arm.com accesses[access_idx] = hits[access_idx] + misses[access_idx]; 28612724Snikos.nikoleris@arm.com 28712724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 28812724Snikos.nikoleris@arm.com accesses[access_idx].subname(i, system->getMasterName(i)); 28912724Snikos.nikoleris@arm.com } 29012724Snikos.nikoleris@arm.com } 29112724Snikos.nikoleris@arm.com 29212724Snikos.nikoleris@arm.com demandAccesses 29312724Snikos.nikoleris@arm.com .name(name() + ".demand_accesses") 29412724Snikos.nikoleris@arm.com .desc("number of demand (read+write) accesses") 29512724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 29612724Snikos.nikoleris@arm.com ; 29712724Snikos.nikoleris@arm.com demandAccesses = demandHits + demandMisses; 29812724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 29912724Snikos.nikoleris@arm.com demandAccesses.subname(i, system->getMasterName(i)); 30012724Snikos.nikoleris@arm.com } 30112724Snikos.nikoleris@arm.com 30212724Snikos.nikoleris@arm.com overallAccesses 30312724Snikos.nikoleris@arm.com .name(name() + ".overall_accesses") 30412724Snikos.nikoleris@arm.com .desc("number of overall (read+write) accesses") 30512724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 30612724Snikos.nikoleris@arm.com ; 30712724Snikos.nikoleris@arm.com overallAccesses = overallHits + overallMisses; 30812724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 30912724Snikos.nikoleris@arm.com overallAccesses.subname(i, system->getMasterName(i)); 31012724Snikos.nikoleris@arm.com } 31112724Snikos.nikoleris@arm.com 31212724Snikos.nikoleris@arm.com // miss rate formulas 31312724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 31412724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 31512724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 31612724Snikos.nikoleris@arm.com 31712724Snikos.nikoleris@arm.com missRate[access_idx] 31812724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_miss_rate") 31912724Snikos.nikoleris@arm.com .desc("miss rate for " + cstr + " accesses") 32012724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 32112724Snikos.nikoleris@arm.com ; 32212724Snikos.nikoleris@arm.com missRate[access_idx] = misses[access_idx] / accesses[access_idx]; 32312724Snikos.nikoleris@arm.com 32412724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 32512724Snikos.nikoleris@arm.com missRate[access_idx].subname(i, system->getMasterName(i)); 32612724Snikos.nikoleris@arm.com } 32712724Snikos.nikoleris@arm.com } 32812724Snikos.nikoleris@arm.com 32912724Snikos.nikoleris@arm.com demandMissRate 33012724Snikos.nikoleris@arm.com .name(name() + ".demand_miss_rate") 33112724Snikos.nikoleris@arm.com .desc("miss rate for demand accesses") 33212724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 33312724Snikos.nikoleris@arm.com ; 33412724Snikos.nikoleris@arm.com demandMissRate = demandMisses / demandAccesses; 33512724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 33612724Snikos.nikoleris@arm.com demandMissRate.subname(i, system->getMasterName(i)); 33712724Snikos.nikoleris@arm.com } 33812724Snikos.nikoleris@arm.com 33912724Snikos.nikoleris@arm.com overallMissRate 34012724Snikos.nikoleris@arm.com .name(name() + ".overall_miss_rate") 34112724Snikos.nikoleris@arm.com .desc("miss rate for overall accesses") 34212724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 34313418Sodanrc@yahoo.com.br ; 34412724Snikos.nikoleris@arm.com overallMissRate = overallMisses / overallAccesses; 34512724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 34612724Snikos.nikoleris@arm.com overallMissRate.subname(i, system->getMasterName(i)); 34712724Snikos.nikoleris@arm.com } 34812724Snikos.nikoleris@arm.com 34913418Sodanrc@yahoo.com.br // miss latency formulas 35012724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 35112724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 35213747Sodanrc@yahoo.com.br const string &cstr = cmd.toString(); 35313747Sodanrc@yahoo.com.br 35413747Sodanrc@yahoo.com.br avgMissLatency[access_idx] 35513747Sodanrc@yahoo.com.br .name(name() + "." + cstr + "_avg_miss_latency") 35612724Snikos.nikoleris@arm.com .desc("average " + cstr + " miss latency") 35712724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 35812724Snikos.nikoleris@arm.com ; 35912724Snikos.nikoleris@arm.com avgMissLatency[access_idx] = 36013418Sodanrc@yahoo.com.br missLatency[access_idx] / misses[access_idx]; 36112724Snikos.nikoleris@arm.com 36212724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 36313746Sodanrc@yahoo.com.br avgMissLatency[access_idx].subname(i, system->getMasterName(i)); 36412724Snikos.nikoleris@arm.com } 36512724Snikos.nikoleris@arm.com } 36612724Snikos.nikoleris@arm.com 36712724Snikos.nikoleris@arm.com demandAvgMissLatency 36813416Sjavier.bueno@metempsy.com .name(name() + ".demand_avg_miss_latency") 36913416Sjavier.bueno@metempsy.com .desc("average overall miss latency") 37013416Sjavier.bueno@metempsy.com .flags(total | nozero | nonan) 37112724Snikos.nikoleris@arm.com ; 37213416Sjavier.bueno@metempsy.com demandAvgMissLatency = demandMissLatency / demandMisses; 37313416Sjavier.bueno@metempsy.com for (int i = 0; i < system->maxMasters(); i++) { 37412724Snikos.nikoleris@arm.com demandAvgMissLatency.subname(i, system->getMasterName(i)); 37512724Snikos.nikoleris@arm.com } 37612724Snikos.nikoleris@arm.com 37712724Snikos.nikoleris@arm.com overallAvgMissLatency 37812724Snikos.nikoleris@arm.com .name(name() + ".overall_avg_miss_latency") 37912724Snikos.nikoleris@arm.com .desc("average overall miss latency") 38013416Sjavier.bueno@metempsy.com .flags(total | nozero | nonan) 38112724Snikos.nikoleris@arm.com ; 38212724Snikos.nikoleris@arm.com overallAvgMissLatency = overallMissLatency / overallMisses; 38313416Sjavier.bueno@metempsy.com for (int i = 0; i < system->maxMasters(); i++) { 38413416Sjavier.bueno@metempsy.com overallAvgMissLatency.subname(i, system->getMasterName(i)); 38513416Sjavier.bueno@metempsy.com } 38613416Sjavier.bueno@metempsy.com 38713416Sjavier.bueno@metempsy.com blocked_cycles.init(NUM_BLOCKED_CAUSES); 38813416Sjavier.bueno@metempsy.com blocked_cycles 38912724Snikos.nikoleris@arm.com .name(name() + ".blocked_cycles") 39012724Snikos.nikoleris@arm.com .desc("number of cycles access was blocked") 39112724Snikos.nikoleris@arm.com .subname(Blocked_NoMSHRs, "no_mshrs") 39212724Snikos.nikoleris@arm.com .subname(Blocked_NoTargets, "no_targets") 39312724Snikos.nikoleris@arm.com ; 39412724Snikos.nikoleris@arm.com 39512724Snikos.nikoleris@arm.com 39612724Snikos.nikoleris@arm.com blocked_causes.init(NUM_BLOCKED_CAUSES); 39712724Snikos.nikoleris@arm.com blocked_causes 39812724Snikos.nikoleris@arm.com .name(name() + ".blocked") 39912724Snikos.nikoleris@arm.com .desc("number of cycles access was blocked") 40012724Snikos.nikoleris@arm.com .subname(Blocked_NoMSHRs, "no_mshrs") 40113564Snikos.nikoleris@arm.com .subname(Blocked_NoTargets, "no_targets") 40212724Snikos.nikoleris@arm.com ; 40312724Snikos.nikoleris@arm.com 40412724Snikos.nikoleris@arm.com avg_blocked 40512724Snikos.nikoleris@arm.com .name(name() + ".avg_blocked_cycles") 40612724Snikos.nikoleris@arm.com .desc("average number of cycles each access was blocked") 40712724Snikos.nikoleris@arm.com .subname(Blocked_NoMSHRs, "no_mshrs") 40812724Snikos.nikoleris@arm.com .subname(Blocked_NoTargets, "no_targets") 40912724Snikos.nikoleris@arm.com ; 41012724Snikos.nikoleris@arm.com 41112724Snikos.nikoleris@arm.com avg_blocked = blocked_cycles / blocked_causes; 41212724Snikos.nikoleris@arm.com 41312724Snikos.nikoleris@arm.com fastWrites 41412724Snikos.nikoleris@arm.com .name(name() + ".fast_writes") 41512724Snikos.nikoleris@arm.com .desc("number of fast writes performed") 41612724Snikos.nikoleris@arm.com ; 41712724Snikos.nikoleris@arm.com 41812724Snikos.nikoleris@arm.com cacheCopies 41912724Snikos.nikoleris@arm.com .name(name() + ".cache_copies") 42012724Snikos.nikoleris@arm.com .desc("number of cache copies performed") 42112724Snikos.nikoleris@arm.com ; 42212724Snikos.nikoleris@arm.com 42312724Snikos.nikoleris@arm.com writebacks 42412724Snikos.nikoleris@arm.com .init(system->maxMasters()) 42512724Snikos.nikoleris@arm.com .name(name() + ".writebacks") 42612724Snikos.nikoleris@arm.com .desc("number of writebacks") 42712724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 42812724Snikos.nikoleris@arm.com ; 42912724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 43012724Snikos.nikoleris@arm.com writebacks.subname(i, system->getMasterName(i)); 43112724Snikos.nikoleris@arm.com } 43212724Snikos.nikoleris@arm.com 43312724Snikos.nikoleris@arm.com // MSHR statistics 43412724Snikos.nikoleris@arm.com // MSHR hit statistics 43512724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 43612724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 43712724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 43812724Snikos.nikoleris@arm.com 43912724Snikos.nikoleris@arm.com mshr_hits[access_idx] 44012724Snikos.nikoleris@arm.com .init(system->maxMasters()) 44112724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_mshr_hits") 44212724Snikos.nikoleris@arm.com .desc("number of " + cstr + " MSHR hits") 44312724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 44413859Sodanrc@yahoo.com.br ; 44512724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 44612724Snikos.nikoleris@arm.com mshr_hits[access_idx].subname(i, system->getMasterName(i)); 44712724Snikos.nikoleris@arm.com } 44812724Snikos.nikoleris@arm.com } 44912724Snikos.nikoleris@arm.com 45012724Snikos.nikoleris@arm.com demandMshrHits 45112724Snikos.nikoleris@arm.com .name(name() + ".demand_mshr_hits") 45212724Snikos.nikoleris@arm.com .desc("number of demand (read+write) MSHR hits") 45312724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 45412724Snikos.nikoleris@arm.com ; 45512724Snikos.nikoleris@arm.com demandMshrHits = SUM_DEMAND(mshr_hits); 45612724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 45712724Snikos.nikoleris@arm.com demandMshrHits.subname(i, system->getMasterName(i)); 45812724Snikos.nikoleris@arm.com } 45912724Snikos.nikoleris@arm.com 46012724Snikos.nikoleris@arm.com overallMshrHits 46113350Snikos.nikoleris@arm.com .name(name() + ".overall_mshr_hits") 46213350Snikos.nikoleris@arm.com .desc("number of overall MSHR hits") 46313350Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 46413350Snikos.nikoleris@arm.com ; 46513350Snikos.nikoleris@arm.com overallMshrHits = demandMshrHits + SUM_NON_DEMAND(mshr_hits); 46613350Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 46712724Snikos.nikoleris@arm.com overallMshrHits.subname(i, system->getMasterName(i)); 46812724Snikos.nikoleris@arm.com } 46912724Snikos.nikoleris@arm.com 47012724Snikos.nikoleris@arm.com // MSHR miss statistics 47112724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 47212724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 47312724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 47413352Snikos.nikoleris@arm.com 47513352Snikos.nikoleris@arm.com mshr_misses[access_idx] 47613352Snikos.nikoleris@arm.com .init(system->maxMasters()) 47712724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_mshr_misses") 47813717Sivan.pizarro@metempsy.com .desc("number of " + cstr + " MSHR misses") 47912724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 48012724Snikos.nikoleris@arm.com ; 48112724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 48212724Snikos.nikoleris@arm.com mshr_misses[access_idx].subname(i, system->getMasterName(i)); 48312724Snikos.nikoleris@arm.com } 48412724Snikos.nikoleris@arm.com } 48512794Snikos.nikoleris@arm.com 48612794Snikos.nikoleris@arm.com demandMshrMisses 48712794Snikos.nikoleris@arm.com .name(name() + ".demand_mshr_misses") 48812794Snikos.nikoleris@arm.com .desc("number of demand (read+write) MSHR misses") 48912794Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 49012794Snikos.nikoleris@arm.com ; 49112724Snikos.nikoleris@arm.com demandMshrMisses = SUM_DEMAND(mshr_misses); 49212724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 49312724Snikos.nikoleris@arm.com demandMshrMisses.subname(i, system->getMasterName(i)); 49412724Snikos.nikoleris@arm.com } 49512724Snikos.nikoleris@arm.com 49612724Snikos.nikoleris@arm.com overallMshrMisses 49712724Snikos.nikoleris@arm.com .name(name() + ".overall_mshr_misses") 49812724Snikos.nikoleris@arm.com .desc("number of overall MSHR misses") 49912724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 50013478Sodanrc@yahoo.com.br ; 50112724Snikos.nikoleris@arm.com overallMshrMisses = demandMshrMisses + SUM_NON_DEMAND(mshr_misses); 50212724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 50312724Snikos.nikoleris@arm.com overallMshrMisses.subname(i, system->getMasterName(i)); 50412724Snikos.nikoleris@arm.com } 50512724Snikos.nikoleris@arm.com 50612724Snikos.nikoleris@arm.com // MSHR miss latency statistics 50712724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 50812724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 50912724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 51012724Snikos.nikoleris@arm.com 51112724Snikos.nikoleris@arm.com mshr_miss_latency[access_idx] 51212724Snikos.nikoleris@arm.com .init(system->maxMasters()) 51312724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_mshr_miss_latency") 51412724Snikos.nikoleris@arm.com .desc("number of " + cstr + " MSHR miss cycles") 51512724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 51612724Snikos.nikoleris@arm.com ; 51712724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 51812724Snikos.nikoleris@arm.com mshr_miss_latency[access_idx].subname(i, system->getMasterName(i)); 51912724Snikos.nikoleris@arm.com } 52012724Snikos.nikoleris@arm.com } 52112724Snikos.nikoleris@arm.com 52212724Snikos.nikoleris@arm.com demandMshrMissLatency 52312724Snikos.nikoleris@arm.com .name(name() + ".demand_mshr_miss_latency") 52412724Snikos.nikoleris@arm.com .desc("number of demand (read+write) MSHR miss cycles") 52512724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 52612724Snikos.nikoleris@arm.com ; 52712724Snikos.nikoleris@arm.com demandMshrMissLatency = SUM_DEMAND(mshr_miss_latency); 52812724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 52912724Snikos.nikoleris@arm.com demandMshrMissLatency.subname(i, system->getMasterName(i)); 53012724Snikos.nikoleris@arm.com } 53112724Snikos.nikoleris@arm.com 53212724Snikos.nikoleris@arm.com overallMshrMissLatency 53312724Snikos.nikoleris@arm.com .name(name() + ".overall_mshr_miss_latency") 53412724Snikos.nikoleris@arm.com .desc("number of overall MSHR miss cycles") 53512724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 53612724Snikos.nikoleris@arm.com ; 53712724Snikos.nikoleris@arm.com overallMshrMissLatency = 53812724Snikos.nikoleris@arm.com demandMshrMissLatency + SUM_NON_DEMAND(mshr_miss_latency); 53912724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 54012724Snikos.nikoleris@arm.com overallMshrMissLatency.subname(i, system->getMasterName(i)); 54112724Snikos.nikoleris@arm.com } 54212724Snikos.nikoleris@arm.com 54312724Snikos.nikoleris@arm.com // MSHR uncacheable statistics 54412724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 54512724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 54612724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 54712724Snikos.nikoleris@arm.com 54812724Snikos.nikoleris@arm.com mshr_uncacheable[access_idx] 54912724Snikos.nikoleris@arm.com .init(system->maxMasters()) 55012724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_mshr_uncacheable") 55113412Snikos.nikoleris@arm.com .desc("number of " + cstr + " MSHR uncacheable") 55213412Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 55313412Snikos.nikoleris@arm.com ; 55413412Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 55512724Snikos.nikoleris@arm.com mshr_uncacheable[access_idx].subname(i, system->getMasterName(i)); 55612724Snikos.nikoleris@arm.com } 55712724Snikos.nikoleris@arm.com } 55812724Snikos.nikoleris@arm.com 55912724Snikos.nikoleris@arm.com overallMshrUncacheable 56012724Snikos.nikoleris@arm.com .name(name() + ".overall_mshr_uncacheable_misses") 56112724Snikos.nikoleris@arm.com .desc("number of overall MSHR uncacheable misses") 56212724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 56312724Snikos.nikoleris@arm.com ; 56412724Snikos.nikoleris@arm.com overallMshrUncacheable = 56512724Snikos.nikoleris@arm.com SUM_DEMAND(mshr_uncacheable) + SUM_NON_DEMAND(mshr_uncacheable); 56612724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 56712724Snikos.nikoleris@arm.com overallMshrUncacheable.subname(i, system->getMasterName(i)); 56812724Snikos.nikoleris@arm.com } 56912724Snikos.nikoleris@arm.com 57012724Snikos.nikoleris@arm.com // MSHR miss latency statistics 57112724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 57212820Srmk35@cl.cam.ac.uk MemCmd cmd(access_idx); 57312724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 57412724Snikos.nikoleris@arm.com 57512724Snikos.nikoleris@arm.com mshr_uncacheable_lat[access_idx] 57612724Snikos.nikoleris@arm.com .init(system->maxMasters()) 57712724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_mshr_uncacheable_latency") 57812724Snikos.nikoleris@arm.com .desc("number of " + cstr + " MSHR uncacheable cycles") 57912724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 58012724Snikos.nikoleris@arm.com ; 58112724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 58212724Snikos.nikoleris@arm.com mshr_uncacheable_lat[access_idx].subname(i, system->getMasterName(i)); 58312724Snikos.nikoleris@arm.com } 58412724Snikos.nikoleris@arm.com } 58512724Snikos.nikoleris@arm.com 58612724Snikos.nikoleris@arm.com overallMshrUncacheableLatency 58712724Snikos.nikoleris@arm.com .name(name() + ".overall_mshr_uncacheable_latency") 58812724Snikos.nikoleris@arm.com .desc("number of overall MSHR uncacheable cycles") 58912724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 59012724Snikos.nikoleris@arm.com ; 59112724Snikos.nikoleris@arm.com overallMshrUncacheableLatency = 59212724Snikos.nikoleris@arm.com SUM_DEMAND(mshr_uncacheable_lat) + 59312724Snikos.nikoleris@arm.com SUM_NON_DEMAND(mshr_uncacheable_lat); 59412724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 59512724Snikos.nikoleris@arm.com overallMshrUncacheableLatency.subname(i, system->getMasterName(i)); 59612724Snikos.nikoleris@arm.com } 59712724Snikos.nikoleris@arm.com 59812724Snikos.nikoleris@arm.com#if 0 59912724Snikos.nikoleris@arm.com // MSHR access formulas 60012724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 60112724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 60212724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 60312724Snikos.nikoleris@arm.com 60412724Snikos.nikoleris@arm.com mshrAccesses[access_idx] 60512724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_mshr_accesses") 60612724Snikos.nikoleris@arm.com .desc("number of " + cstr + " mshr accesses(hits+misses)") 60712724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 60812724Snikos.nikoleris@arm.com ; 60912724Snikos.nikoleris@arm.com mshrAccesses[access_idx] = 61012724Snikos.nikoleris@arm.com mshr_hits[access_idx] + mshr_misses[access_idx] 61112724Snikos.nikoleris@arm.com + mshr_uncacheable[access_idx]; 61212724Snikos.nikoleris@arm.com } 61312724Snikos.nikoleris@arm.com 61412724Snikos.nikoleris@arm.com demandMshrAccesses 61512724Snikos.nikoleris@arm.com .name(name() + ".demand_mshr_accesses") 61612724Snikos.nikoleris@arm.com .desc("number of demand (read+write) mshr accesses") 61712724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 61812724Snikos.nikoleris@arm.com ; 61912724Snikos.nikoleris@arm.com demandMshrAccesses = demandMshrHits + demandMshrMisses; 62012724Snikos.nikoleris@arm.com 62112724Snikos.nikoleris@arm.com overallMshrAccesses 62212724Snikos.nikoleris@arm.com .name(name() + ".overall_mshr_accesses") 62312724Snikos.nikoleris@arm.com .desc("number of overall (read+write) mshr accesses") 62412724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 62512724Snikos.nikoleris@arm.com ; 62612724Snikos.nikoleris@arm.com overallMshrAccesses = overallMshrHits + overallMshrMisses 62712724Snikos.nikoleris@arm.com + overallMshrUncacheable; 62812724Snikos.nikoleris@arm.com#endif 62912724Snikos.nikoleris@arm.com 63012724Snikos.nikoleris@arm.com // MSHR miss rate formulas 63112724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 63212724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 63312724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 63412724Snikos.nikoleris@arm.com 63512724Snikos.nikoleris@arm.com mshrMissRate[access_idx] 63612724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_mshr_miss_rate") 63712724Snikos.nikoleris@arm.com .desc("mshr miss rate for " + cstr + " accesses") 63812724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 63912724Snikos.nikoleris@arm.com ; 64012724Snikos.nikoleris@arm.com mshrMissRate[access_idx] = 64112724Snikos.nikoleris@arm.com mshr_misses[access_idx] / accesses[access_idx]; 64212724Snikos.nikoleris@arm.com 64312823Srmk35@cl.cam.ac.uk for (int i = 0; i < system->maxMasters(); i++) { 64412823Srmk35@cl.cam.ac.uk mshrMissRate[access_idx].subname(i, system->getMasterName(i)); 64512724Snikos.nikoleris@arm.com } 64612724Snikos.nikoleris@arm.com } 64712724Snikos.nikoleris@arm.com 64812724Snikos.nikoleris@arm.com demandMshrMissRate 64912724Snikos.nikoleris@arm.com .name(name() + ".demand_mshr_miss_rate") 65012724Snikos.nikoleris@arm.com .desc("mshr miss rate for demand accesses") 65112724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 65212724Snikos.nikoleris@arm.com ; 65312823Srmk35@cl.cam.ac.uk demandMshrMissRate = demandMshrMisses / demandAccesses; 65413862Sodanrc@yahoo.com.br for (int i = 0; i < system->maxMasters(); i++) { 65513862Sodanrc@yahoo.com.br demandMshrMissRate.subname(i, system->getMasterName(i)); 65612823Srmk35@cl.cam.ac.uk } 65712724Snikos.nikoleris@arm.com 65812724Snikos.nikoleris@arm.com overallMshrMissRate 65912724Snikos.nikoleris@arm.com .name(name() + ".overall_mshr_miss_rate") 66012724Snikos.nikoleris@arm.com .desc("mshr miss rate for overall accesses") 66112724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 66212724Snikos.nikoleris@arm.com ; 66312724Snikos.nikoleris@arm.com overallMshrMissRate = overallMshrMisses / overallAccesses; 66412724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 66512724Snikos.nikoleris@arm.com overallMshrMissRate.subname(i, system->getMasterName(i)); 66612724Snikos.nikoleris@arm.com } 66712724Snikos.nikoleris@arm.com 66812724Snikos.nikoleris@arm.com // mshrMiss latency formulas 66912724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 67012724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 67112724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 67212724Snikos.nikoleris@arm.com 67312724Snikos.nikoleris@arm.com avgMshrMissLatency[access_idx] 67412724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_avg_mshr_miss_latency") 67512724Snikos.nikoleris@arm.com .desc("average " + cstr + " mshr miss latency") 67612724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 67712724Snikos.nikoleris@arm.com ; 67812724Snikos.nikoleris@arm.com avgMshrMissLatency[access_idx] = 67912724Snikos.nikoleris@arm.com mshr_miss_latency[access_idx] / mshr_misses[access_idx]; 68012724Snikos.nikoleris@arm.com 68112724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 68212724Snikos.nikoleris@arm.com avgMshrMissLatency[access_idx].subname(i, system->getMasterName(i)); 68312724Snikos.nikoleris@arm.com } 68412724Snikos.nikoleris@arm.com } 68512724Snikos.nikoleris@arm.com 68612724Snikos.nikoleris@arm.com demandAvgMshrMissLatency 68712724Snikos.nikoleris@arm.com .name(name() + ".demand_avg_mshr_miss_latency") 68812724Snikos.nikoleris@arm.com .desc("average overall mshr miss latency") 68912724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 69012724Snikos.nikoleris@arm.com ; 69112724Snikos.nikoleris@arm.com demandAvgMshrMissLatency = demandMshrMissLatency / demandMshrMisses; 69212724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 69312724Snikos.nikoleris@arm.com demandAvgMshrMissLatency.subname(i, system->getMasterName(i)); 69412724Snikos.nikoleris@arm.com } 69512724Snikos.nikoleris@arm.com 69612724Snikos.nikoleris@arm.com overallAvgMshrMissLatency 69712724Snikos.nikoleris@arm.com .name(name() + ".overall_avg_mshr_miss_latency") 69812724Snikos.nikoleris@arm.com .desc("average overall mshr miss latency") 69912724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 70012724Snikos.nikoleris@arm.com ; 70112724Snikos.nikoleris@arm.com overallAvgMshrMissLatency = overallMshrMissLatency / overallMshrMisses; 70212724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 70312724Snikos.nikoleris@arm.com overallAvgMshrMissLatency.subname(i, system->getMasterName(i)); 70412724Snikos.nikoleris@arm.com } 70512724Snikos.nikoleris@arm.com 70612724Snikos.nikoleris@arm.com // mshrUncacheable latency formulas 70712724Snikos.nikoleris@arm.com for (int access_idx = 0; access_idx < MemCmd::NUM_MEM_CMDS; ++access_idx) { 70812724Snikos.nikoleris@arm.com MemCmd cmd(access_idx); 70912724Snikos.nikoleris@arm.com const string &cstr = cmd.toString(); 71012724Snikos.nikoleris@arm.com 71112724Snikos.nikoleris@arm.com avgMshrUncacheableLatency[access_idx] 71212724Snikos.nikoleris@arm.com .name(name() + "." + cstr + "_avg_mshr_uncacheable_latency") 71312724Snikos.nikoleris@arm.com .desc("average " + cstr + " mshr uncacheable latency") 71412724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 71512724Snikos.nikoleris@arm.com ; 71612724Snikos.nikoleris@arm.com avgMshrUncacheableLatency[access_idx] = 71712724Snikos.nikoleris@arm.com mshr_uncacheable_lat[access_idx] / mshr_uncacheable[access_idx]; 71812724Snikos.nikoleris@arm.com 71912724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 72012724Snikos.nikoleris@arm.com avgMshrUncacheableLatency[access_idx].subname(i, system->getMasterName(i)); 72112724Snikos.nikoleris@arm.com } 72212724Snikos.nikoleris@arm.com } 72312724Snikos.nikoleris@arm.com 72412724Snikos.nikoleris@arm.com overallAvgMshrUncacheableLatency 72512724Snikos.nikoleris@arm.com .name(name() + ".overall_avg_mshr_uncacheable_latency") 72612724Snikos.nikoleris@arm.com .desc("average overall mshr uncacheable latency") 72712724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 72812724Snikos.nikoleris@arm.com ; 72912724Snikos.nikoleris@arm.com overallAvgMshrUncacheableLatency = overallMshrUncacheableLatency / overallMshrUncacheable; 73012724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 73112724Snikos.nikoleris@arm.com overallAvgMshrUncacheableLatency.subname(i, system->getMasterName(i)); 73212724Snikos.nikoleris@arm.com } 73312724Snikos.nikoleris@arm.com 73413861Sodanrc@yahoo.com.br mshr_cap_events 73512724Snikos.nikoleris@arm.com .init(system->maxMasters()) 73612724Snikos.nikoleris@arm.com .name(name() + ".mshr_cap_events") 73712724Snikos.nikoleris@arm.com .desc("number of times MSHR cap was activated") 73812724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 73912724Snikos.nikoleris@arm.com ; 74012724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 74112724Snikos.nikoleris@arm.com mshr_cap_events.subname(i, system->getMasterName(i)); 74212724Snikos.nikoleris@arm.com } 74312724Snikos.nikoleris@arm.com 74412724Snikos.nikoleris@arm.com //software prefetching stats 74512724Snikos.nikoleris@arm.com soft_prefetch_mshr_full 74612724Snikos.nikoleris@arm.com .init(system->maxMasters()) 74713861Sodanrc@yahoo.com.br .name(name() + ".soft_prefetch_mshr_full") 74812724Snikos.nikoleris@arm.com .desc("number of mshr full events for SW prefetching instrutions") 74912724Snikos.nikoleris@arm.com .flags(total | nozero | nonan) 75012724Snikos.nikoleris@arm.com ; 75112724Snikos.nikoleris@arm.com for (int i = 0; i < system->maxMasters(); i++) { 75212724Snikos.nikoleris@arm.com soft_prefetch_mshr_full.subname(i, system->getMasterName(i)); 75312724Snikos.nikoleris@arm.com } 75412724Snikos.nikoleris@arm.com 75512724Snikos.nikoleris@arm.com mshr_no_allocate_misses 75612724Snikos.nikoleris@arm.com .name(name() +".no_allocate_misses") 75712724Snikos.nikoleris@arm.com .desc("Number of misses that were no-allocate") 75812724Snikos.nikoleris@arm.com ; 75912724Snikos.nikoleris@arm.com 76012724Snikos.nikoleris@arm.com} 76112724Snikos.nikoleris@arm.com 76212724Snikos.nikoleris@arm.comunsigned int 76312724Snikos.nikoleris@arm.comBaseCache::drain(DrainManager *dm) 76412724Snikos.nikoleris@arm.com{ 76512724Snikos.nikoleris@arm.com int count = memSidePort->drain(dm) + cpuSidePort->drain(dm) + 76612724Snikos.nikoleris@arm.com mshrQueue.drain(dm) + writeBuffer.drain(dm); 76712724Snikos.nikoleris@arm.com 76812724Snikos.nikoleris@arm.com // Set status 76912724Snikos.nikoleris@arm.com if (count != 0) { 77012724Snikos.nikoleris@arm.com setDrainState(Drainable::Draining); 77112724Snikos.nikoleris@arm.com DPRINTF(Drain, "Cache not drained\n"); 77212724Snikos.nikoleris@arm.com return count; 77312724Snikos.nikoleris@arm.com } 77412724Snikos.nikoleris@arm.com 77512724Snikos.nikoleris@arm.com setDrainState(Drainable::Drained); 77612724Snikos.nikoleris@arm.com return 0; 77712724Snikos.nikoleris@arm.com} 77812724Snikos.nikoleris@arm.com 77912724Snikos.nikoleris@arm.comBaseCache * 78012724Snikos.nikoleris@arm.comBaseCacheParams::create() 78112724Snikos.nikoleris@arm.com{ 78212724Snikos.nikoleris@arm.com unsigned numSets = size / (assoc * system->cacheLineSize()); 78312724Snikos.nikoleris@arm.com 78412724Snikos.nikoleris@arm.com assert(tags); 78512724Snikos.nikoleris@arm.com 78612724Snikos.nikoleris@arm.com if (dynamic_cast<FALRU*>(tags)) { 78712724Snikos.nikoleris@arm.com if (numSets != 1) 78812724Snikos.nikoleris@arm.com fatal("Got FALRU tags with more than one set\n"); 78912724Snikos.nikoleris@arm.com return new Cache<FALRU>(this); 79012724Snikos.nikoleris@arm.com } else if (dynamic_cast<LRU*>(tags)) { 79112724Snikos.nikoleris@arm.com if (numSets == 1) 79212724Snikos.nikoleris@arm.com warn("Consider using FALRU tags for a fully associative cache\n"); 79312724Snikos.nikoleris@arm.com return new Cache<LRU>(this); 79412724Snikos.nikoleris@arm.com } else if (dynamic_cast<RandomRepl*>(tags)) { 79512724Snikos.nikoleris@arm.com return new Cache<RandomRepl>(this); 79612724Snikos.nikoleris@arm.com } else { 79712724Snikos.nikoleris@arm.com fatal("No suitable tags selected\n"); 79812724Snikos.nikoleris@arm.com } 79912724Snikos.nikoleris@arm.com} 80012724Snikos.nikoleris@arm.com