RegionPerfStats extends CachePerfStats implements RegionStats { @Override public void endGetForClient(long start, boolean miss) { long totalNanos = clock.isEnabled() ? getTime() - start : 0; if (miss) { cacheGetsMissTimer.record(totalNanos, NANOSECONDS); } else { cacheGetsHitTimer.record(totalNanos, NANOSECONDS); } } RegionPerfStats(StatisticsFactory statisticsFactory, String textId, CachePerfStats cachePerfStats,
      InternalRegion region, MeterRegistry meterRegistry, StatisticsClock clock); @VisibleForTesting  RegionPerfStats(StatisticsFactory statisticsFactory, String textId, StatisticsClock clock,
      CachePerfStats cachePerfStats, InternalRegion region, MeterRegistry meterRegistry); @VisibleForTesting  RegionPerfStats(StatisticsFactory statisticsFactory, String textId, StatisticsClock clock,
      CachePerfStats cachePerfStats, InternalRegion region, MeterRegistry meterRegistry,
      Gauge entriesGauge, Timer cacheGetsHitTimer, Timer cacheGetsMissTimer); @Override void incReliableQueuedOps(int inc); @Override void incReliableQueueSize(int inc); @Override void incReliableQueueMax(int inc); @Override void incReliableRegions(int inc); @Override void incReliableRegionsMissing(int inc); @Override void incReliableRegionsQueuing(int inc); @Override void incReliableRegionsMissingFullAccess(int inc); @Override void incReliableRegionsMissingLimitedAccess(int inc); @Override void incReliableRegionsMissingNoAccess(int inc); @Override void incQueuedEvents(int inc); @Override long startLoad(); @Override void endLoad(long start); @Override long startNetload(); @Override void endNetload(long start); @Override long startNetsearch(); @Override void endNetsearch(long start); @Override long startCacheWriterCall(); @Override void endCacheWriterCall(long start); @Override long startCacheListenerCall(); @Override void endCacheListenerCall(long start); @Override long startGetInitialImage(); @Override void endGetInitialImage(long start); @Override void endNoGIIDone(long start); @Override void incGetInitialImageKeysReceived(); @Override long startIndexUpdate(); @Override void endIndexUpdate(long start); @Override void incRegions(int inc); @Override void incPartitionedRegions(int inc); @Override void incDestroys(); @Override void incCreates(); @Override void incInvalidates(); @Override void incTombstoneCount(int amount); @Override void incTombstoneGCCount(); @Override void incClearTimeouts(); @Override void incConflatedEventsCount(); @Override void endGet(long start, boolean miss); @Override void endGetForClient(long start, boolean miss); @Override long endPut(long start, boolean isUpdate); @Override void endPutAll(long start); @Override void endQueryExecution(long executionTime); @Override void endQueryResultsHashCollisionProbe(long start); @Override void incQueryResultsHashCollisions(); @Override void incTxConflictCheckTime(long delta); @Override void txSuccess(long opTime, long txLifeTime, int txChanges); @Override void txFailure(long opTime, long txLifeTime, int txChanges); @Override void txRollback(long opTime, long txLifeTime, int txChanges); @Override void incEventQueueSize(int items); @Override void incEventQueueThrottleCount(int items); @Override void incEventQueueThrottleTime(long nanos); @Override void incEventThreads(int items); @Override void incEntryCount(int delta); @Override void incRetries(); @Override void incDiskTasksWaiting(); @Override void decDiskTasksWaiting(); @Override void decDiskTasksWaiting(int count); @Override void incEvictorJobsStarted(); @Override void incEvictorJobsCompleted(); @Override void incEvictorQueueSize(int delta); @Override void incEvictWorkTime(long delta); @Override void incClearCount(); @Override void incPRQueryRetries(); @Override void incMetaDataRefreshCount(); @Override void endImport(long entryCount, long start); @Override void endExport(long entryCount, long start); @Override long startCompression(); @Override void endCompression(long startTime, long startSize, long endSize); @Override long startDecompression(); @Override void endDecompression(long startTime);  }
@Test public void endGetForClient_recordsHitTimerCountAndTotalTime_ifCacheHitAndClockEnabled() { when(statisticsClock.isEnabled()).thenReturn(true); when(statisticsClock.getTime()).thenReturn(CLOCK_VALUE); regionPerfStats.endGetForClient(0, false); assertThat(cacheGetsHitTimer()) .as("geode.cache.gets timer with tag result=hit") .hasCount(1) .hasTotalTime(NANOSECONDS, CLOCK_VALUE); }
@Test public void endGetForClient_doesNotRecordMissTimerCountOrTotalTime_ifCacheHitAndClockEnabled() { when(statisticsClock.isEnabled()).thenReturn(true); when(statisticsClock.getTime()).thenReturn(CLOCK_VALUE); regionPerfStats.endGetForClient(0, false); assertThat(cacheGetsMissTimer()) .as("geode.cache.gets timer with tag result=miss") .hasCount(0) .hasTotalTime(NANOSECONDS, 0); }
@Test public void endGetForClient_recordsHitTimerCountOnly_ifCacheHitAndClockDisabled() { when(statisticsClock.isEnabled()).thenReturn(false); regionPerfStats.endGetForClient(0, false); assertThat(cacheGetsHitTimer()) .as("geode.cache.gets timer with tag result=hit") .hasCount(1) .hasTotalTime(NANOSECONDS, 0); }
@Test public void endGetForClient_recordsMissTimerCountAndTotalTime_ifCacheMissAndClockEnabled() { when(statisticsClock.isEnabled()).thenReturn(true); when(statisticsClock.getTime()).thenReturn(CLOCK_VALUE); regionPerfStats.endGetForClient(0, true); assertThat(cacheGetsMissTimer()) .as("geode.cache.gets timer with tag result=miss") .hasCount(1) .hasTotalTime(NANOSECONDS, CLOCK_VALUE); }
@Test public void endGetForClient_doesNotRecordHitTimerCountOrTotalTime_ifCacheMissAndClockEnabled() { when(statisticsClock.isEnabled()).thenReturn(true); when(statisticsClock.getTime()).thenReturn(CLOCK_VALUE); regionPerfStats.endGetForClient(0, true); assertThat(cacheGetsHitTimer()) .as("geode.cache.gets timer with tag result=hit") .hasCount(0) .hasTotalTime(NANOSECONDS, 0); }
@Test public void endGetForClient_recordsMissTimerCountOnly_ifCacheMissAndClockDisabled() { when(statisticsClock.isEnabled()).thenReturn(false); regionPerfStats.endGetForClient(0, true); assertThat(cacheGetsMissTimer()) .as("geode.cache.gets timer with tag result=miss") .hasCount(1) .hasTotalTime(NANOSECONDS, 0); }