org.apache.ignite.internal.processors.cache.ratemetrics

## Class HitRateMetrics

- java.lang.Object
- - org.apache.ignite.internal.processors.cache.ratemetrics.HitRateMetrics

    public class HitRateMetrics
    extends Object

Accumulates approximate hit rate statistics. Calculates number of hits in last `rateTimeInterval` milliseconds. Algorithm is based on circular array of `size` hit counters, each is responsible for last corresponding time interval of `rateTimeInterval`/`size` milliseconds. Resulting number of hits is sum of all counters.

Implementation is nonblocking and protected from hits loss. Maximum relative error is 1/`size`. 2^55 - 1 hits per interval can be accumulated without numeric overflow.

### Constructor Summary

Constructors
Constructor and Description
`HitRateMetrics(int rateTimeInterval, int size)`

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `clear()` Clear metrics.
`long` `getRate()`
`void` `onHit()` Mark one hit.
`void` `onHits(long hits)` Mark multiple hits.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### HitRateMetrics

    public HitRateMetrics(int rateTimeInterval,
                          int size)

Parameters:
  `rateTimeInterval` - Rate time interval.
  `size` - Number of counters.

### Method Detail

#### onHit

    public void onHit()

Mark one hit.

#### onHits

    public void onHits(long hits)

Mark multiple hits.

Parameters:
  `hits` - Number of hits.

#### getRate

    public long getRate()

Returns:
  Total number of hits in last `rateTimeInterval` milliseconds.

#### clear

    public void clear()

Clear metrics.

2018 Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.7.0
Release Date | : November 30 2018