Stopwatch stopwatch = Stopwatch.createStarted(); doSomething(); stopwatch.stop(); // optional long millis = stopwatch.elapsedMillis(); log.info("that took: " + stopwatch); // formatted string like "12.3 ms"
@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(); }
logger.info("Dogged Cube Build2 splits complete, took " + sw.elapsedMillis() + " ms"); } catch (Throwable e) { logger.error("Dogged Cube Build2 error", e); sw.stop(); builderPool.shutdownNow(); logger.info("Dogged Cube Build2 end, totally took " + sw.elapsedMillis() + " ms"); logger.info("Dogged Cube Build2 return");
logger.info("Cuboid {} has {} rows, build takes {}ms", cuboidId, count, sw.elapsedMillis()); return updateCuboidResult(cuboidId, newGridTable, count, sw.elapsedMillis(), 0);
stopwatch.start(); long estimateBytes = GTAggregateScanner.estimateSizeOfAggrCache(key, values, map.size()); estimateMillis += stopwatch.elapsedMillis(); stopwatch.reset(); actualMillis += stopwatch.elapsedMillis(); stopwatch.reset();
logger.info("Cuboid {} has {} rows, build takes {}ms", baseCuboidId, count, sw.elapsedMillis()); logger.info("Wild estimate of base aggr cache is {} MB", mbEstimateBaseAggrCache); return updateCuboidResult(baseCuboidId, baseCuboid, count, sw.elapsedMillis(), 0, input.inputConverterUnit.ifChange());
@Override protected T computeNext() { if (stopwatch.elapsedMillis() < timeBoundMillis && delegate.hasNext()) { return delegate.next(); } return endOfData(); } }
@Override protected T computeNext() { if (stopwatch.elapsedMillis() < timeBoundMillis && delegate.hasNext()) { return delegate.next(); } return endOfData(); } }
Stopwatch stopwatch = new Stopwatch().start(); doSomething(); stopwatch.stop(); // optional long millis = stopwatch.elapsedMillis(); log.info("that took: " + stopwatch); // formatted string like "12.3 ms"
Stopwatch stopwatch = new Stopwatch(); stopwatch.start(); calculate(); stopwatch.stop(); // optional long Seconds= stopwatch.elapsedMillis() / 1000000; // equals 1 second
private void appendToLog(List<TransactionEdit> edits) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edits); txMetricsCollector.rate("wal.append.count", edits.size()); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
/** * Starts a long transaction with a client id. */ public Transaction startLong(String clientId) { Preconditions.checkArgument(clientId != null, "clientId must not be null"); txMetricsCollector.rate("start.long"); Stopwatch timer = new Stopwatch().start(); long expiration = getTxExpiration(defaultLongTimeout); Transaction tx = startTx(expiration, TransactionType.LONG, clientId); txMetricsCollector.histogram("start.long.latency", (int) timer.elapsedMillis()); return tx; }
private void appendToLog(List<TransactionEdit> edits) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edits); txMetricsCollector.rate("wal.append.count", edits.size()); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
private void appendToLog(List<TransactionEdit> edits) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edits); txMetricsCollector.rate("wal.append.count", edits.size()); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
private void appendToLog(TransactionEdit edit) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edit); txMetricsCollector.rate("wal.append.count"); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
private void appendToLog(TransactionEdit edit) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edit); txMetricsCollector.rate("wal.append.count"); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
private void appendToLog(TransactionEdit edit) { try { Stopwatch timer = new Stopwatch().start(); currentLog.append(edit); txMetricsCollector.rate("wal.append.count"); txMetricsCollector.histogram("wal.append.latency", (int) timer.elapsedMillis()); } catch (IOException ioe) { abortService("Error appending to transaction log", ioe); } }
/** * Start a long transaction. Long transactions and do not participate in conflict detection. Also, aborting a long * transaction moves it to the invalid list because we assume that its writes cannot be rolled back. */ public Transaction startLong() { txMetricsCollector.rate("start.long"); Stopwatch timer = new Stopwatch().start(); long expiration = getTxExpiration(defaultLongTimeout); Transaction tx = startTx(expiration, TransactionType.LONG); txMetricsCollector.histogram("start.long.latency", (int) timer.elapsedMillis()); return tx; }
/** * Start a long transaction. Long transactions and do not participate in conflict detection. Also, aborting a long * transaction moves it to the invalid list because we assume that its writes cannot be rolled back. */ public Transaction startLong() { txMetricsCollector.rate("start.long"); Stopwatch timer = new Stopwatch().start(); long expiration = getTxExpiration(defaultLongTimeout); Transaction tx = startTx(expiration, TransactionType.LONG); txMetricsCollector.histogram("start.long.latency", (int) timer.elapsedMillis()); return tx; }