Package com.google.common.base

Examples of com.google.common.base.Stopwatch.elapsedMillis()


    byte[] uncompressed = uncompressBytesInflateDeflate(inBytes);
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("CompressedSize: " + inBytes.length + ", UncompressedSize: "
          + uncompressed.length + ", UncompressTimeTaken: "
          + sw.elapsedMillis());
    }
    return uncompressed;
  }
 
//  private static byte[] compressBytesSnappy(byte[] inBytes) throws IOException {
View Full Code Here


    }
    MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPayload(rootInputContext.getUserPayload());
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("Time to parse MRInput payload into prot: "
          + sw.elapsedMillis())
    }
   

    this.splitsProto = userPayloadProto.getSplits();
   
View Full Code Here

   
    Stopwatch sw = new Stopwatch().start();
    for (int i = 1; i < numEdits; i++) {
      ch.sendEdits(1L, i, 1, data).get();
    }
    long time = sw.elapsedMillis();
   
    System.err.println("Wrote " + numEdits + " batches of " + editsSize +
        " bytes in " + time + "ms");
    float avgRtt = (float)time/(float)numEdits;
    long throughput = ((long)numEdits * editsSize * 1000L)/time;
 
View Full Code Here

  public void waitMetaRegionLocation(ZooKeeperWatcher zkw) throws InterruptedException {
    Stopwatch stopwatch = new Stopwatch().start();
    while (!stopped) {
      try {
        if (waitMetaRegionLocation(zkw, 100) != null) break;
        long sleepTime = stopwatch.elapsedMillis();
        // +1 in case sleepTime=0
        if ((sleepTime + 1) % 10000 == 0) {
          LOG.warn("Have been waiting for meta to be assigned for " + sleepTime + "ms");
        }
      } catch (NotAllMetaRegionsOnlineException e) {
View Full Code Here

    Stopwatch sw = new Stopwatch().start();
    ServerName sn = null;
    try {
      while (true) {
        sn = getMetaRegionLocation(zkw);
        if (sn != null || sw.elapsedMillis()
            > timeout - HConstants.SOCKET_RETRY_WAIT_MS) {
          break;
        }
        Thread.sleep(HConstants.SOCKET_RETRY_WAIT_MS);
      }
View Full Code Here

          Put p = new Put(b);
          p.add(HConstants.CATALOG_FAMILY, b, b);
          table.put(p);
        }
        if (i % printInterval == 0) {
          LOG.info("Put " + printInterval + "/" + stopWatch.elapsedMillis());
          stopWatch.reset();
          stopWatch.start();
        }
      }
      LOG.info("Finished a cycle putting " + namespaceSpan + " in " +
View Full Code Here

    try {
      R result = b.run();
      normalExit = true;
      return result;
    } finally {
      long duration = stopwatch.elapsedMillis();
      log.info("Body exited " + (normalExit ? "normally" : "abnormally")
          + ", run time: " + duration + "ms");
    }
  }
View Full Code Here

    Stopwatch stopwatch = new Stopwatch().start();
    for (int retries = 0; true; retries++) {
      try {
        return runBodyOnce(b);
      } catch (RetryableFailure e) {
        long elapsedMillis = stopwatch.elapsedMillis();
        log.log(Level.WARNING, "Problem on retry " + retries + ", millis elapsed so far: "
            + elapsedMillis, e);
        long delayMillis = retryStrategy.delayMillisBeforeRetry(retries, elapsedMillis, e);
        if (delayMillis < 0) {
          log.warning("Negative delay: " + delayMillis);
View Full Code Here

        try {
          Thread.sleep(delayMillis);
        } catch (InterruptedException e2) {
          Thread.currentThread().interrupt();
          throw new PermanentFailure("Interrupted while waiting to retry; "
              + retries + " tries total, " + stopwatch.elapsedMillis() + " millis elapsed", e2);
        }
      }
    }
  }
View Full Code Here

        }
      }
      Assert.check(metadata != null, "Null metadata");
      result.put(id, metadata);

      if (maxTimeMillis != null && stopwatch.elapsedMillis() > maxTimeMillis) {
        break;
      }
    }
    Assert.check(!result.isEmpty(), "Should return at least one id");
    return result;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.