testbed/src/main/java/org/cache2k/benchmark/prototype/evictionPolicies/C2k2xEviction.java
private Entry runHandHot() {
    hotRunCnt++;
    Entry hand = handHot;
    Entry coldCandidate = hand;
    long lowestHits = Long.MAX_VALUE;
    long hotHits = this.hotHits;
    int initialMaxScan = (hotSize >> 2) + 1;
    int maxScan = initialMaxScan;
    long decrease = ((hand.hitCnt + hand.next.hitCnt) >> tuning.getHitCounterDecreaseShift()) + 1;
    while (maxScan-- > 0) {
      long hitCnt = hand.hitCnt;
      if (hitCnt < lowestHits) {
        lowestHits = hitCnt;
        coldCandidate = hand;
        if (hitCnt == 0) {
          hand = hand.next;
          break;
        }
      }
      if (hitCnt < decrease) {
        hand.hitCnt = 0;
        hotHits += hitCnt;
      } else {
        hand.hitCnt = hitCnt - decrease;
        hotHits += decrease;
      }
      hand = hand.next;
    }
    this.hotHits = hotHits;
    long scanCount = initialMaxScan - maxScan;
    hotScanCnt += scanCount;
    handHot = hand;
    return coldCandidate;
  }
/**
   * Scan through hot entries.
   *
   * @return candidate for eviction or demotion
   */
Scan through hot entries.
@return candidate for eviction or demotion
Scan through hot entries . @return candidate for eviction or demotion
private Entry runHandHot() {
    hotRunCnt++;
    Entry hand = handHot;
    Entry coldCandidate = hand;
    long lowestHits = Long.MAX_VALUE;
    long hotHits = this.hotHits;
    int initialMaxScan = (hotSize >> 2) + 1;
    int maxScan = initialMaxScan;
    long decrease = ((hand.hitCnt + hand.next.hitCnt) >> tuning.getHitCounterDecreaseShift()) + 1;
    while (maxScan-- > 0) {
      long hitCnt = hand.hitCnt;
      if (hitCnt < lowestHits) {
        lowestHits = hitCnt;
        coldCandidate = hand;
        if (hitCnt == 0) {
          hand = hand.next;
          break;
        }
      }
      if (hitCnt < decrease) {
        hand.hitCnt = 0;
        hotHits += hitCnt;
      } else {
        hand.hitCnt = hitCnt - decrease;
        hotHits += decrease;
      }
      hand = hand.next;
    }
    this.hotHits = hotHits;
    long scanCount = initialMaxScan - maxScan;
    hotScanCnt += scanCount;
    handHot = hand;
    return coldCandidate;
  }
private Entry runHandHot ( ) { hotRunCnt ++ ; Entry hand = handHot ; Entry coldCandidate = hand ; long lowestHits = Long . MAX_VALUE ; long hotHits = this . hotHits ; int initialMaxScan = ( hotSize >> 2 ) + 1 ; int maxScan = initialMaxScan ; long decrease = ( ( hand . hitCnt + hand . next . hitCnt ) >> tuning . getHitCounterDecreaseShift ( ) ) + 1 ; while ( maxScan -- > 0 ) { long hitCnt = hand . hitCnt ; if ( hitCnt < lowestHits ) { lowestHits = hitCnt ; coldCandidate = hand ; if ( hitCnt == 0 ) { hand = hand . next ; break ; } } if ( hitCnt < decrease ) { hand . hitCnt = 0 ; hotHits += hitCnt ; } else { hand . hitCnt = hitCnt - decrease ; hotHits += decrease ; } hand = hand . next ; } this . hotHits = hotHits ; long scanCount = initialMaxScan - maxScan ; hotScanCnt += scanCount ; handHot = hand ; return coldCandidate ; }
Scan through hot entries.
Scan through hot entries .