Package com.google.common.base

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


  public static boolean conditionValid(IndexingServiceCondition condition)
  {
    try {
      Stopwatch stopwatch = Stopwatch.createUnstarted();
      stopwatch.start();
      while (!condition.isValid()) {
        Thread.sleep(100);
        if (stopwatch.elapsed(TimeUnit.MILLISECONDS) > 1000) {
          throw new ISE("Cannot find running task");
        }
View Full Code Here


    final int printInterval = 100000;
    Random rd = new Random(id);
    boolean get = c.getBoolean("hbase.test.do.gets", false);
    try {
      Stopwatch stopWatch = new Stopwatch();
      stopWatch.start();
      for (int i = 0; i < namespaceSpan; i++) {
        byte [] b = format(rd.nextLong());
        if (get){
          Get g = new Get(b);
          table.get(g);
View Full Code Here

          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 " +
          (System.currentTimeMillis() - startTime) + "ms");
    } finally {
View Full Code Here

        buf.append("\" ");

        final CountingHttpServletResponseWrapper responseWrapper = new CountingHttpServletResponseWrapper(httpResponse);

        final Stopwatch stopwatch = Stopwatch.createUnstarted();
        stopwatch.start();

        try {
            chain.doFilter(request, responseWrapper);
        } finally {
            stopwatch.stop();
View Full Code Here

      // TODO(ohler): workerStopwatch includes time spent in emit() and the
      // OutputWriter, which is very significant because it includes I/O.  I
      // think a clean solution would be to have the context measure the
      // OutputWriter's time, and to subtract that from the time measured by
      // workerStopwatch.
      workerStopwatch.start();
      callWorker(next);
      workerStopwatch.stop();
    } while (overallStopwatch.elapsed(MILLISECONDS) < millisPerSlice);
    overallStopwatch.stop();
    counters.getCounter(workerCallsCounterName).increment(workerCalls);
View Full Code Here

  public int read(Collection<? super StreamEventOffset> events, int maxEvents,
                  long timeout, TimeUnit unit, ReadFilter readFilter) throws IOException, InterruptedException {
    int eventsRead = 0;

    Stopwatch stopwatch = new Stopwatch();
    stopwatch.start();

    while (eventsRead < maxEvents && !(emptySources.isEmpty() && eventSources.isEmpty())) {
      if (!emptySources.isEmpty()) {
        prepareEmptySources(readFilter);
      }
View Full Code Here

    }

    // Wait for table to materialize
    try {
      Stopwatch stopwatch = new Stopwatch();
      stopwatch.start();
      long sleepTime = timeoutUnit.toNanos(timeout) / 10;
      sleepTime = sleepTime <= 0 ? 1 : sleepTime;
      do {
        if (admin.tableExists(tableName)) {
          LOG.info("Table '{}' exists now. Assuming that another process concurrently created it.", tableName);
View Full Code Here

    final int printInterval = 100000;
    Random rd = new Random(id);
    boolean get = c.getBoolean("hbase.test.do.gets", false);
    try {
      Stopwatch stopWatch = new Stopwatch();
      stopWatch.start();
      for (int i = 0; i < namespaceSpan; i++) {
        byte [] b = format(rd.nextLong());
        if (get){
          Get g = new Get(b);
          table.get(g);
View Full Code Here

          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 " +
          (System.currentTimeMillis() - startTime) + "ms");
    } finally {
View Full Code Here

    fileOpenTimer.start();
    FSDataInputStream in = fs.open(filename);
    fileOpenTimer.stop();

    long totalBytes = 0;
    streamTimer.start();
    while (true) {
      int read = in.read(buf);
      if (read < 0) {
        break;
      }
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.