lfu_rp.hh revision 12628
112628Sodanrc@yahoo.com.br/** 212628Sodanrc@yahoo.com.br * Copyright (c) 2018 Inria 312628Sodanrc@yahoo.com.br * All rights reserved. 412628Sodanrc@yahoo.com.br * 512628Sodanrc@yahoo.com.br * Redistribution and use in source and binary forms, with or without 612628Sodanrc@yahoo.com.br * modification, are permitted provided that the following conditions are 712628Sodanrc@yahoo.com.br * met: redistributions of source code must retain the above copyright 812628Sodanrc@yahoo.com.br * notice, this list of conditions and the following disclaimer; 912628Sodanrc@yahoo.com.br * redistributions in binary form must reproduce the above copyright 1012628Sodanrc@yahoo.com.br * notice, this list of conditions and the following disclaimer in the 1112628Sodanrc@yahoo.com.br * documentation and/or other materials provided with the distribution; 1212628Sodanrc@yahoo.com.br * neither the name of the copyright holders nor the names of its 1312628Sodanrc@yahoo.com.br * contributors may be used to endorse or promote products derived from 1412628Sodanrc@yahoo.com.br * this software without specific prior written permission. 1512628Sodanrc@yahoo.com.br * 1612628Sodanrc@yahoo.com.br * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1712628Sodanrc@yahoo.com.br * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1812628Sodanrc@yahoo.com.br * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 1912628Sodanrc@yahoo.com.br * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 2012628Sodanrc@yahoo.com.br * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 2112628Sodanrc@yahoo.com.br * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 2212628Sodanrc@yahoo.com.br * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 2312628Sodanrc@yahoo.com.br * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 2412628Sodanrc@yahoo.com.br * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 2512628Sodanrc@yahoo.com.br * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 2612628Sodanrc@yahoo.com.br * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 2712628Sodanrc@yahoo.com.br * 2812628Sodanrc@yahoo.com.br * Authors: Daniel Carvalho 2912628Sodanrc@yahoo.com.br */ 3012628Sodanrc@yahoo.com.br 3112628Sodanrc@yahoo.com.br/** 3212628Sodanrc@yahoo.com.br * @file 3312628Sodanrc@yahoo.com.br * Declaration of a Least Frequently Used replacement policy. 3412628Sodanrc@yahoo.com.br * The victim is chosen using the reference frequency. The least referenced 3512628Sodanrc@yahoo.com.br * block is always chosen to be evicted, regardless of the amount of times 3612628Sodanrc@yahoo.com.br * it has been touched, or how long has passed since its last touch. 3712628Sodanrc@yahoo.com.br */ 3812628Sodanrc@yahoo.com.br 3912628Sodanrc@yahoo.com.br#ifndef __MEM_CACHE_REPLACEMENT_POLICIES_LFU_RP_HH__ 4012628Sodanrc@yahoo.com.br#define __MEM_CACHE_REPLACEMENT_POLICIES_LFU_RP_HH__ 4112628Sodanrc@yahoo.com.br 4212628Sodanrc@yahoo.com.br#include "mem/cache/replacement_policies/base.hh" 4312628Sodanrc@yahoo.com.br#include "params/LFURP.hh" 4412628Sodanrc@yahoo.com.br 4512628Sodanrc@yahoo.com.brclass LFURP : public BaseReplacementPolicy 4612628Sodanrc@yahoo.com.br{ 4712628Sodanrc@yahoo.com.br public: 4812628Sodanrc@yahoo.com.br /** Convenience typedef. */ 4912628Sodanrc@yahoo.com.br typedef LFURPParams Params; 5012628Sodanrc@yahoo.com.br 5112628Sodanrc@yahoo.com.br /** 5212628Sodanrc@yahoo.com.br * Construct and initiliaze this replacement policy. 5312628Sodanrc@yahoo.com.br */ 5412628Sodanrc@yahoo.com.br LFURP(const Params *p); 5512628Sodanrc@yahoo.com.br 5612628Sodanrc@yahoo.com.br /** 5712628Sodanrc@yahoo.com.br * Destructor. 5812628Sodanrc@yahoo.com.br */ 5912628Sodanrc@yahoo.com.br ~LFURP() {} 6012628Sodanrc@yahoo.com.br 6112628Sodanrc@yahoo.com.br /** 6212628Sodanrc@yahoo.com.br * Find replacement victim using reference frequency. 6312628Sodanrc@yahoo.com.br * 6412628Sodanrc@yahoo.com.br * @param cands Replacement candidates, selected by indexing policy. 6512628Sodanrc@yahoo.com.br * @return Cache block to be replaced. 6612628Sodanrc@yahoo.com.br */ 6712628Sodanrc@yahoo.com.br CacheBlk* getVictim(const ReplacementCandidates& candidates) override; 6812628Sodanrc@yahoo.com.br}; 6912628Sodanrc@yahoo.com.br 7012628Sodanrc@yahoo.com.br#endif // __MEM_CACHE_REPLACEMENT_POLICIES_LFU_RP_HH__ 71