Skip to content

Commit

Permalink
all caches hit rate is float, not double
Browse files Browse the repository at this point in the history
  • Loading branch information
penemue committed Jun 22, 2016
1 parent 54ccdaf commit 5d3cc75
Show file tree
Hide file tree
Showing 12 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ void remove(@NotNull final EntityIterableHandle key) {
cache.remove(key);
}

double hitRate() {
float hitRate() {
return cache.hitRate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public EntityIterableCacheImpl(@NotNull final PersistentEntityStoreImpl store) {
SharedTimer.registerPeriodicTask(new CacheHitRateAdjuster(this));
}

public double hitRate() {
public float hitRate() {
return cacheAdapter.hitRate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public long getNumberOfCachingJobs() {
}

@Override
public double getEntityIterableCacheHitRate() {
public float getEntityIterableCacheHitRate() {
return store.getEntityIterableCache().hitRate();
}

@Override
public double getBlobStringsCacheHitRate() {
public float getBlobStringsCacheHitRate() {
return store.getBlobVault().getStringContentCacheHitRate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public interface EntityStoreStatisticsMBean {

long getNumberOfCachingJobs();

double getEntityIterableCacheHitRate();
float getEntityIterableCacheHitRate();

double getBlobStringsCacheHitRate();
float getBlobStringsCacheHitRate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,9 @@ public void close() {
// in order to avoid deadlock, do not finish gc inside lock
// it is safe to invoke gc.finish() several times
gc.finish();
final double logCacheHitRate;
final double storeGetCacheHitRate;
final double treeNodesCacheHitRate;
final float logCacheHitRate;
final float storeGetCacheHitRate;
final float treeNodesCacheHitRate;
synchronized (commitLock) {
if (!isOpen()) {
throw throwableOnClose;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ void cacheObject(final long treeRootAddress, @NotNull final ByteIterable key, @N
cache.cacheObject(new KeyEntry(treeRootAddress, key), value);
}

double hitRate() {
float hitRate() {
return cache.hitRate();
}

Expand Down
2 changes: 1 addition & 1 deletion environment/src/main/java/jetbrains/exodus/log/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public final int getCachePageSize() {
return cachePageSize;
}

public double getCacheHitRate() {
public float getCacheHitRate() {
return cache == null ? 0 : cache.hitRate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ protected LogCache(final int memoryUsagePercentage, final int pageSize) {

abstract void clear();

abstract double hitRate();
abstract float hitRate();

abstract void cachePage(@NotNull final Log log, final long pageAddress, @NotNull final ArrayByteIterable page);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void clear() {
}

@Override
public double hitRate() {
public float hitRate() {
return pagesCache.hitRate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void clear() {
}

@Override
double hitRate() {
float hitRate() {
return pagesCache.hitRate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public final String getStringContent(final long blobHandle, @NotNull final Trans
* @return {@linkplain jetbrains.exodus.core.dataStructures.CacheHitRateable#hitRate() hit rate} of string
* contents cache
*/
public final double getStringContentCacheHitRate() {
public final float getStringContentCacheHitRate() {
synchronized (stringContentCacheLock) {
return stringContentCache.hitRate();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public V tryKeyLocked(@NotNull final K key) {
*
* @param hitRate hit rate value in the interval [0..1]
*/
public static String formatHitRate(final double hitRate) {
public static String formatHitRate(final float hitRate) {
final int result = (int) (hitRate * 1000);
return String.valueOf((result / 10)) + '.' + (result % 10) + '%';
}
Expand Down

0 comments on commit 5d3cc75

Please sign in to comment.