public static void main(String[] args) { SummaryStatistics statObject = new SummaryStatistics(); SummaryStatistics statByte = new SummaryStatistics(); for (int i = 0; i < 10; i++) { statByte.addValue(testByte()); statObject.addValue(testObject()); } System.out.println("Time (ms) Object: " + statObject.getMean() + " | " + statObject.getStandardDeviation()); System.out.println("Time (ms) Byte: " + statByte.getMean() + " | " + statByte.getStandardDeviation()); }
public static void main(String[] args) { SummaryStatistics statObject = new SummaryStatistics(); SummaryStatistics statByte = new SummaryStatistics(); for (int i = 0; i < 10; i++) { statByte.addValue(testByte()); statObject.addValue(testObject()); } System.out.println("Time (ms) Object: " + statObject.getMean() + " | " + statObject.getStandardDeviation()); System.out.println("Time (ms) Byte: " + statByte.getMean() + " | " + statByte.getStandardDeviation()); }
@Test public void testMemoryLeakage() { long memoryBaseline = 0; SummaryStatistics stats = new SummaryStatistics(); int numRuns = 25; for (int r = 0; r < numRuns; r++) { if (r == 1 || r == (numRuns - 1)) { memoryBaseline = MemoryAssess.getMemoryUse(); stats.addValue(memoryBaseline); //System.out.println("Memory before run "+(r+1)+": " + memoryBaseline / 1024 + " KB"); } for (int t = 0; t < 1000; t++) { graph.addVertex(); graph.tx().rollback(); TitanTransaction tx = graph.newTransaction(); tx.addVertex(); tx.rollback(); } if (r == 1 || r == (numRuns - 1)) { memoryBaseline = MemoryAssess.getMemoryUse(); stats.addValue(memoryBaseline); //System.out.println("Memory after run " + (r + 1) + ": " + memoryBaseline / 1024 + " KB"); } clopen(); } System.out.println("Average: " + stats.getMean() + " Std. Dev: " + stats.getStandardDeviation()); assertTrue(stats.getStandardDeviation() < stats.getMin()); }
@Test public void testMemoryLeakage() { long memoryBaseline = 0; SummaryStatistics stats = new SummaryStatistics(); int numRuns = 25; for (int r = 0; r < numRuns; r++) { if (r == 1 || r == (numRuns - 1)) { memoryBaseline = MemoryAssess.getMemoryUse(); stats.addValue(memoryBaseline); //System.out.println("Memory before run "+(r+1)+": " + memoryBaseline / 1024 + " KB"); } for (int t = 0; t < 1000; t++) { graph.addVertex(); graph.tx().rollback(); JanusGraphTransaction tx = graph.newTransaction(); tx.addVertex(); tx.rollback(); } if (r == 1 || r == (numRuns - 1)) { memoryBaseline = MemoryAssess.getMemoryUse(); stats.addValue(memoryBaseline); //System.out.println("Memory after run " + (r + 1) + ": " + memoryBaseline / 1024 + " KB"); } clopen(); } System.out.println("Average: " + stats.getMean() + " Std. Dev: " + stats.getStandardDeviation()); assertTrue(stats.getStandardDeviation() < stats.getMin()); }
/** * @see org.apache.commons.math.stat.descriptive.SummaryStatistics#addValue(double) */ public synchronized void addValue(double value) { super.addValue(value); }
/** * {@inheritDoc} */ @Override public synchronized void addValue(double value) { super.addValue(value); }
/** * {@inheritDoc}. This version adds the provided value to the configured * aggregate after adding it to these statistics. * * @see SummaryStatistics#addValue(double) */ @Override public void addValue(double value) { super.addValue(value); synchronized (aggregateStatistics) { aggregateStatistics.addValue(value); } }
/** * {@inheritDoc}. This version adds the provided value to the configured * aggregate after adding it to these statistics. * * @see SummaryStatistics#addValue(double) */ @Override public void addValue(double value) { super.addValue(value); synchronized (aggregateStatistics) { aggregateStatistics.addValue(value); } }
/** {@inheritDoc} */ @Override public void computeBinStats() throws IOException { for (int i = 0; i < inputArray.length; i++) { SummaryStatistics stats = binStats.get(findBin(inputArray[i])); stats.addValue(inputArray[i]); } } }
/** {@inheritDoc} */ @Override public void computeBinStats() throws IOException { String str = null; double val = 0.0d; while ((str = inputStream.readLine()) != null) { val = Double.parseDouble(str); SummaryStatistics stats = binStats.get(findBin(val)); stats.addValue(val); } inputStream.close(); inputStream = null; }
/** {@inheritDoc} */ @Override public void computeStats() throws IOException { sampleStats = new SummaryStatistics(); for (int i = 0; i < inputArray.length; i++) { sampleStats.addValue(inputArray[i]); } }
/** * Accumulate the given duration into the statistics with the given identifier * * @param identifier the identifier * @param nanoTime the duration to accumulate in nano seconds */ public static synchronized void accumulate(String identifier, long nanoTime) { SummaryStatistics t = times.get(identifier); if (t == null) times.put(identifier, t = new SummaryStatistics()); t.addValue(nanoTime); }
public GaugeMetricValueBuilder addPoint(double value) { stats.addValue(value); accum.add(value); return this; }
/** {@inheritDoc} */ @Override public void computeStats() throws IOException { sampleStats = new SummaryStatistics(); for (int i = 0; i < inputArray.length; i++) { sampleStats.addValue(inputArray[i]); } }
/** * Computes sampleStats * * @throws IOException if an IO error occurs */ public void computeStats() throws IOException { sampleStats = new SummaryStatistics(); for (int i = 0; i < inputArray.length; i++) { sampleStats.addValue(inputArray[i]); } } /**
/** * Accumulate the given duration into the statistics with the given identifier * * @param identifier the identifier * @param nanoTime the duration to accumulate in nano seconds */ public static synchronized void accumulate(String identifier, long nanoTime) { SummaryStatistics t = times.get(identifier); if (t == null) times.put(identifier, t = new SummaryStatistics()); t.addValue(nanoTime); }
public static void main(String[] args) { SummaryStatistics statObject = new SummaryStatistics(); SummaryStatistics statByte = new SummaryStatistics(); for (int i = 0; i < 10; i++) { statByte.addValue(testByte()); statObject.addValue(testObject()); } System.out.println("Time (ms) Object: " + statObject.getMean() + " | " + statObject.getStandardDeviation()); System.out.println("Time (ms) Byte: " + statByte.getMean() + " | " + statByte.getStandardDeviation()); }
private static SummaryStatistics generateStats(File trieDir, Genome genome, Language language, int iterations) throws IOException { SummaryStatistics stats = new SummaryStatistics(); for (int i = 0; i < iterations; i ++) { Board board = genome.toCharProbGenerator().generateFourByFourBoard(); InputStream stream = trieReader(trieDir, language); Trie dict = new StringTrie.Deserializer().deserialize(stream, board, language); int numWords = dict.solver(board, new WordFilter.MinLength(3)).size(); stats.addValue(numWords); } return stats; }