Search in sources :

Example 6 with CacheStats

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());
}
Also used : CacheStats(com.google.common.cache.CacheStats)

Example 7 with CacheStats

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);
}
Also used : CacheStats(com.google.common.cache.CacheStats) PushOneCommit(com.google.gerrit.acceptance.PushOneCommit) Test(org.junit.Test) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest)

Example 8 with CacheStats

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);
    }
}
Also used : CacheStats(com.google.common.cache.CacheStats) SimplePerfEvent(com.facebook.buck.event.SimplePerfEvent)

Example 9 with CacheStats

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();
}
Also used : CacheStats(com.google.common.cache.CacheStats)

Example 10 with CacheStats

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);
}
Also used : ExpressionFactoryBean(org.springframework.integration.config.ExpressionFactoryBean) Expression(org.springframework.expression.Expression) BeanFactory(org.springframework.beans.factory.BeanFactory) CacheStats(com.google.common.cache.CacheStats) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Aggregations

CacheStats (com.google.common.cache.CacheStats)11 Test (org.junit.Test)3 HashMap (java.util.HashMap)2 DataSource (javax.sql.DataSource)2 BeanFactory (org.springframework.beans.factory.BeanFactory)2 Expression (org.springframework.expression.Expression)2 ExpressionFactoryBean (org.springframework.integration.config.ExpressionFactoryBean)2 SimplePerfEvent (com.facebook.buck.event.SimplePerfEvent)1 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)1 PushOneCommit (com.google.gerrit.acceptance.PushOneCommit)1 LinkedHashMap (java.util.LinkedHashMap)1 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)1 CompositeType (javax.management.openmbean.CompositeType)1 TabularDataSupport (javax.management.openmbean.TabularDataSupport)1 TabularType (javax.management.openmbean.TabularType)1 ManagedMetric (org.springframework.jmx.export.annotation.ManagedMetric)1