List of usage examples for org.apache.commons.math.stat.descriptive SynchronizedSummaryStatistics SynchronizedSummaryStatistics
public SynchronizedSummaryStatistics()
From source file:com.fatwire.dta.sscrawler.reporting.reporters.PageletTimingsStatisticsReporter.java
public void addToReport(final ResultPage page) { pagesDone.incrementAndGet();/*from ww w . ja v a 2 s . co m*/ total.addValue(page.getReadTime()); final String pagename = page.getPageName(); if (pagename != null) { SynchronizedSummaryStatistics ss = stats.get(pagename); if (ss == null) { ss = new SynchronizedSummaryStatistics(); stats.put(pagename, ss); cached.put(pagename, CacheHelper.shouldCache(page.getResponseHeaders())); } ss.addValue(page.getReadTime()); } }
From source file:com.netflix.curator.framework.recipes.atomic.TestDistributedAtomicLong.java
@Test public void testSimulation() throws Exception { final int threadQty = 20; final int executionQty = 50; final AtomicInteger optimisticTries = new AtomicInteger(); final AtomicInteger promotedLockTries = new AtomicInteger(); final AtomicInteger failures = new AtomicInteger(); final AtomicInteger errors = new AtomicInteger(); final SummaryStatistics timingStats = new SynchronizedSummaryStatistics(); List<Future<Void>> procs = Lists.newArrayList(); ExecutorService executorService = Executors.newFixedThreadPool(threadQty); for (int i = 0; i < threadQty; ++i) { Callable<Void> proc = new Callable<Void>() { @Override//ww w. ja v a 2s. co m public Void call() throws Exception { doSimulation(executionQty, timingStats, optimisticTries, promotedLockTries, failures, errors); return null; } }; procs.add(executorService.submit(proc)); } for (Future<Void> f : procs) { f.get(); } System.out.println("OptimisticTries: " + optimisticTries.get()); System.out.println("PromotedLockTries: " + promotedLockTries.get()); System.out.println("Failures: " + failures.get()); System.out.println("Errors: " + errors.get()); System.out.println(); System.out.println("Avg time: " + timingStats.getMean()); System.out.println("Max time: " + timingStats.getMax()); System.out.println("Min time: " + timingStats.getMin()); System.out.println("Qty: " + timingStats.getN()); Assert.assertEquals(errors.get(), 0); Assert.assertTrue(optimisticTries.get() > 0); Assert.assertTrue(promotedLockTries.get() > 0); }
From source file:org.apache.sling.engine.benchmarks.AddValueToStatisticsDirectDriver.java
@Override public void prepare(TestCase tc) { this.statistics = new SynchronizedSummaryStatistics(); }
From source file:org.apache.sling.engine.benchmarks.AddValueToStatisticsViaExecutorDriver.java
@Override public void prepare(TestCase tc) { this.statistics = new SynchronizedSummaryStatistics(); this.operationExecutor = Executors.newSingleThreadExecutor(); }