use of com.google.common.cache.CacheStats in project hive by apache.
the class SharedCache method printCacheStats.
public void printCacheStats() {
CacheStats cs = tableCache.stats();
LOG.info(cs.toString());
}
use of com.google.common.cache.CacheStats in project gerrit by GerritCodeReview.
the class ChangeIT method skipDiffstatOptionAvoidsAllDiffComputations.
@Test
public void skipDiffstatOptionAvoidsAllDiffComputations() throws Exception {
String fileName = "a_new_file.txt";
String fileContent = "First line\nSecond line\n";
PushOneCommit.Result result = createChange("Add a file", fileName, fileContent);
String triplet = project.get() + "~master~" + result.getChangeId();
CacheStats startIntra = cloneStats(intraCache.stats());
CacheStats startSummary = cloneStats(diffSummaryCache.stats());
gApi.changes().id(triplet).get(ImmutableList.of(ListChangesOption.SKIP_DIFFSTAT));
assertThat(intraCache.stats()).since(startIntra).hasMissCount(0);
assertThat(intraCache.stats()).since(startIntra).hasHitCount(0);
assertThat(diffSummaryCache.stats()).since(startSummary).hasMissCount(0);
assertThat(diffSummaryCache.stats()).since(startSummary).hasHitCount(0);
}
use of com.google.common.cache.CacheStats in project buck by facebook.
the class EventPostingRuleKeyCacheScope method close.
@Override
public final void close() {
try (SimplePerfEvent.Scope scope = SimplePerfEvent.scope(buckEventBus, PerfEventId.of("rule_key_cache_cleanup"))) {
// Log stats.
CacheStats stats = cache.getStats().minus(startStats);
buckEventBus.post(RuleKeyCacheStatsEvent.create(stats));
scope.update("hitRate", stats.hitRate());
scope.update("hits", stats.hitCount());
scope.update("misses", stats.missCount());
scope.update("requests", stats.requestCount());
scope.update("load_time_ns", stats.totalLoadTime());
// Run additional cleanup.
cleanup(scope);
}
}
use of com.google.common.cache.CacheStats in project zemberek-nlp by ahmetaa.
the class TurkishMorphology method toString.
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
if (useCache) {
sb.append("Cache stats:\n");
CacheStats stats = dynamicCache.stats();
sb.append("Hit rate: " + stats.hitRate());
sb.append(" Average load penalty: " + stats.averageLoadPenalty());
sb.append(" Eviction count: " + stats.evictionCount());
}
sb.append("\nCount stats:\n");
sb.append("Input count: " + stats.inputCount);
sb.append(" Word Analyzer calls: " + stats.wordAnalyzerCallCount);
sb.append(" Word With Apost. calls: " + stats.analyzeWordsWithApostropheCallCount);
sb.append(" Unidentified Token calls: " + stats.unidentifiedTokenAnalyzerCallCount);
sb.append(" Unknown token generation: " + stats.unknownTokenGenerationCount);
return sb.toString();
}
use of com.google.common.cache.CacheStats in project spring-integration by spring-projects.
the class StoredProcExecutorTests method testStoredProcExecutorJdbcCallOperationsCache.
@Test
public void testStoredProcExecutorJdbcCallOperationsCache() throws Exception {
final DataSource datasource = mock(DataSource.class);
final StoredProcExecutor storedProcExecutor = new StoredProcExecutor(datasource);
final ExpressionFactoryBean efb = new ExpressionFactoryBean("headers['stored_procedure_name']");
efb.afterPropertiesSet();
final Expression expression = efb.getObject();
storedProcExecutor.setStoredProcedureNameExpression(expression);
storedProcExecutor.setBeanFactory(mock(BeanFactory.class));
storedProcExecutor.afterPropertiesSet();
this.mockTheOperationsCache(storedProcExecutor);
for (int i = 1; i <= 3; i++) {
storedProcExecutor.executeStoredProcedure(MessageBuilder.withPayload("test").setHeader("stored_procedure_name", "123").build());
}
final CacheStats stats = (CacheStats) storedProcExecutor.getJdbcCallOperationsCacheStatistics();
LOGGER.info(stats);
LOGGER.info(stats.totalLoadTime() / 1000 / 1000);
assertEquals(stats.hitCount(), 2);
assertEquals(stats.missCount(), 1);
assertEquals(stats.loadCount(), 1);
}
Aggregations