1/* 2 * Copyright (c) 2012-2014 ARM Limited 3 * All rights reserved. 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 110 unchanged lines hidden (view full) --- 119BaseSetAssoc::findBlockBySetAndWay(int set, int way) const 120{ 121 return sets[set].blks[way]; 122} 123 124std::string 125BaseSetAssoc::print() const { 126 std::string cache_state; |
127 for (const CacheBlk& blk : blks) { 128 if (blk.isValid()) 129 cache_state += csprintf("\tset: %d way: %d %s\n", blk.set, 130 blk.way, blk.print()); |
131 } 132 if (cache_state.empty()) 133 cache_state = "no valid tags\n"; 134 return cache_state; 135} 136 137void 138BaseSetAssoc::cleanupRefs() 139{ |
140 for (const CacheBlk& blk : blks) { 141 if (blk.isValid()) { 142 totalRefs += blk.refCount; |
143 ++sampledRefs; 144 } 145 } 146} 147 148void 149BaseSetAssoc::computeStats() 150{ 151 for (unsigned i = 0; i < ContextSwitchTaskId::NumTaskId; ++i) { 152 occupanciesTaskId[i] = 0; 153 for (unsigned j = 0; j < 5; ++j) { 154 ageTaskId[i][j] = 0; 155 } 156 } 157 |
158 for (const CacheBlk& blk : blks) { 159 if (blk.isValid()) { 160 assert(blk.task_id < ContextSwitchTaskId::NumTaskId); 161 occupanciesTaskId[blk.task_id]++; 162 assert(blk.tickInserted <= curTick()); 163 Tick age = curTick() - blk.tickInserted; |
164 165 int age_index; 166 if (age / SimClock::Int::us < 10) { // <10us 167 age_index = 0; 168 } else if (age / SimClock::Int::us < 100) { // <100us 169 age_index = 1; 170 } else if (age / SimClock::Int::ms < 1) { // <1ms 171 age_index = 2; 172 } else if (age / SimClock::Int::ms < 10) { // <10ms 173 age_index = 3; 174 } else 175 age_index = 4; // >10ms 176 |
177 ageTaskId[blk.task_id][age_index]++; |
178 } 179 } 180} 181 182BaseSetAssoc * 183BaseSetAssocParams::create() 184{ 185 return new BaseSetAssoc(this); 186} |