Refine search
@Override public void finish(CuboidResult result) { Stopwatch stopwatch = new Stopwatch().start(); int nRetries = 0; while (!outputQueue.offer(result)) { nRetries++; long sleepTime = stopwatch.elapsedMillis(); if (sleepTime > 3600000L) { stopwatch.stop(); throw new RuntimeException( "OutputQueue Full. Cannot offer to the output queue after waiting for one hour!!! Current queue size: " + outputQueue.size()); } logger.warn("OutputQueue Full. Queue size: " + outputQueue.size() + ". Total sleep time : " + sleepTime + ", and retry count : " + nRetries); try { Thread.sleep(5000L); } catch (InterruptedException e) { throw new RuntimeException(e); } } stopwatch.stop(); } }
@Test public void createDirectChildrenCacheStressTest() { Stopwatch sw = new Stopwatch(); sw.start(); Set<Long> cuboidSet = generateMassCuboidSet(); System.out.println("Time elapsed for creating sorted cuboid list: " + sw.elapsedMillis()); sw.reset(); sw.start(); checkDirectChildrenCacheStressTest(CuboidStatsUtil.createDirectChildrenCache(cuboidSet)); System.out.println("Time elapsed for creating direct children cache: " + sw.elapsedMillis()); sw.stop(); }
private void testEnumeratorValues(String file) throws Exception { InputStream is = new FileInputStream(file); ArrayList<String> str = loadStrings(is); TrieDictionaryBuilder<String> b = newDictBuilder(str); TrieDictionary<String> dict = b.build(0); System.out.println("Dictionary size for file " + file + " is " + dict.getSize()); Stopwatch sw = new Stopwatch(); sw.start(); List<String> values1 = dict.enumeratorValuesByParent(); System.out.println("By iterating id visit the time cost " + sw.elapsed(TimeUnit.MILLISECONDS) + " ms"); sw.reset(); sw.start(); List<String> values2 = dict.enumeratorValues(); System.out.println("By pre-order visit the time cost " + sw.elapsed(TimeUnit.MILLISECONDS) + " ms"); sw.stop(); assertEquals(Sets.newHashSet(values1), Sets.newHashSet(values2)); }
@Test public void testGetLongestDepth() { Stopwatch sw = new Stopwatch(); Set<Long> cuboidSet1 = Sets.newHashSet(7L, 6L, 5L, 4L, 3L, 2L, 1L); sw.start(); assertEquals(2, CuboidUtil.getLongestDepth(cuboidSet1)); System.out.println("Time cost for GetLongestDepth: " + sw.elapsed(TimeUnit.MILLISECONDS) + "ms"); Set<Long> cuboidSet2 = Sets.newHashSet(1024L, 1666L, 1667L, 1728L, 1730L, 1731L, 1760L, 1762L, 1763L, 1776L, 1778L, 1779L, 1784L, 1788L, 1790L, 1791L, 1920L, 1922L, 1923L, 1984L, 1986L, 1987L, 2016L, 2018L, 2019L, 2032L, 2034L, 2035L, 2040L, 2044L, 2046L, 2047L); sw.reset(); sw.start(); assertEquals(8, CuboidUtil.getLongestDepth(cuboidSet2)); System.out.println("Time cost for GetLongestDepth: " + sw.elapsed(TimeUnit.MILLISECONDS) + "ms"); Set<Long> cuboidSet3 = Sets.newHashSet(31L, 11L, 5L, 3L, 1L); sw.reset(); sw.start(); assertEquals(3, CuboidUtil.getLongestDepth(cuboidSet3)); System.out.println("Time cost for GetLongestDepth: " + sw.elapsed(TimeUnit.MILLISECONDS) + "ms"); sw.stop(); } }
final Stopwatch stopwatch = new Stopwatch(); long estimateMillis = 0; long actualMillis = 0; stopwatch.start(); long estimateBytes = GTAggregateScanner.estimateSizeOfAggrCache(key, values, map.size()); estimateMillis += stopwatch.elapsedMillis(); stopwatch.reset(); stopwatch.start(); long actualBytes = meter.measureDeep(map); actualMillis += stopwatch.elapsedMillis();
protected CuboidResult scanAndAggregateGridTable(GridTable gridTable, GridTable newGridTable, long parentId, long cuboidId, ImmutableBitSet aggregationColumns, ImmutableBitSet measureColumns) throws IOException { Stopwatch sw = new Stopwatch(); sw.start(); logger.info("Calculating cuboid {}", cuboidId);
+ " blah wibble blah </wibble> some more test here"; int x = -1; Stopwatch sw = new Stopwatch(); sw.start(); for(long i = 0; i < NUM_TESTS; i++) x = wibble.lastIndexOf(">"); System.out.println("String first pass: " + sw + " seconds"); sw.start(); for(long i = 0; i < NUM_TESTS; i++) x = wibble.lastIndexOf('>'); System.out.println("Char first pass: " + sw + " seconds"); sw.start(); for(long i = 0; i < NUM_TESTS; i++) x = wibble.lastIndexOf('>');