Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 41 for stopwatch (0.2 sec)

  1. guava/src/com/google/common/base/Stopwatch.java

     * reasonably accurate values are sufficient. If the uncommon case that you need to maximize
     * accuracy, use {@code System.nanoTime()} directly instead.
     *
     * <p>Basic usage:
     *
     * <pre>{@code
     * Stopwatch stopwatch = Stopwatch.createStarted();
     * doSomething();
     * stopwatch.stop(); // optional
     *
     * Duration duration = stopwatch.elapsed();
     *
    Java
    - Registered: Fri Apr 05 12:43:09 GMT 2024
    - Last Modified: Thu Feb 23 15:09:35 GMT 2023
    - 9.2K bytes
    - Viewed (0)
  2. android/guava/src/com/google/common/base/Stopwatch.java

     * reasonably accurate values are sufficient. If the uncommon case that you need to maximize
     * accuracy, use {@code System.nanoTime()} directly instead.
     *
     * <p>Basic usage:
     *
     * <pre>{@code
     * Stopwatch stopwatch = Stopwatch.createStarted();
     * doSomething();
     * stopwatch.stop(); // optional
     *
     * long millis = stopwatch.elapsed(MILLISECONDS);
     *
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Nov 15 21:38:09 GMT 2022
    - 8.5K bytes
    - Viewed (0)
  3. android/guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java

        RateLimiter limiter = RateLimiter.create(2.0, 4000, MILLISECONDS, 3.0, stopwatch);
        for (int i = 0; i < 8; i++) {
          limiter.acquire(); // #1
        }
        stopwatch.sleepMillis(500); // #2: to repay for the last acquire
        stopwatch.sleepMillis(4000); // #3: becomes cold again
        for (int i = 0; i < 8; i++) {
          limiter.acquire(); // // #4
        }
        stopwatch.sleepMillis(500); // #5: to repay for the last acquire
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 21.6K bytes
    - Viewed (0)
  4. android/guava-tests/test/com/google/common/base/StopwatchTest.java

        ticker.advance(1);
        assertEquals("1.000 \u03bcs", stopwatch.toString());
        ticker.advance(1);
        assertEquals("1.001 \u03bcs", stopwatch.toString());
        ticker.advance(8998);
        assertEquals("9.999 \u03bcs", stopwatch.toString());
        stopwatch.reset();
        stopwatch.start();
        ticker.advance(1234567);
        assertEquals("1.235 ms", stopwatch.toString());
        stopwatch.reset();
        stopwatch.start();
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Fri Feb 09 15:49:48 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  5. guava-tests/test/com/google/common/util/concurrent/RateLimiterTest.java

        RateLimiter limiter = RateLimiter.create(2.0, 4000, MILLISECONDS, 3.0, stopwatch);
        for (int i = 0; i < 8; i++) {
          limiter.acquire(); // #1
        }
        stopwatch.sleepMillis(500); // #2: to repay for the last acquire
        stopwatch.sleepMillis(4000); // #3: becomes cold again
        for (int i = 0; i < 8; i++) {
          limiter.acquire(); // // #4
        }
        stopwatch.sleepMillis(500); // #5: to repay for the last acquire
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 21.6K bytes
    - Viewed (0)
  6. android/guava/src/com/google/common/util/concurrent/RateLimiter.java

        public static SleepingStopwatch createFromSystemTimer() {
          return new SleepingStopwatch() {
            final Stopwatch stopwatch = Stopwatch.createStarted();
    
            @Override
            protected long readMicros() {
              return stopwatch.elapsed(MICROSECONDS);
            }
    
            @Override
            protected void sleepMicrosUninterruptibly(long micros) {
              if (micros > 0) {
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Tue Apr 04 09:45:04 GMT 2023
    - 18.2K bytes
    - Viewed (0)
  7. guava-tests/test/com/google/common/util/concurrent/SimpleTimeLimiterTest.java

        Stopwatch stopwatch = Stopwatch.createStarted();
    
        assertThrows(UncheckedTimeoutException.class, () -> proxy.sleepThenThrowException());
    
        assertThat(stopwatch.elapsed(MILLISECONDS)).isIn(Range.closed(NOT_ENOUGH_MS, DELAY_MS * 2));
      }
    
      public void testCallWithTimeout_goodCallableWithEnoughTime() throws Exception {
        Stopwatch stopwatch = Stopwatch.createStarted();
    
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 9.5K bytes
    - Viewed (0)
  8. guava-tests/test/com/google/common/util/concurrent/UninterruptiblesTest.java

        Stopwatch stopwatch = Stopwatch.createStarted();
        Condition condition = TestCondition.createAndSignalAfter(500, MILLISECONDS);
    
        boolean signaledBeforeTimeout = awaitUninterruptibly(condition, 1500, MILLISECONDS);
    
        assertTrue(signaledBeforeTimeout);
        assertTimeNotPassed(stopwatch, LONG_DELAY_MS);
        assertNotInterrupted();
      }
    
      public void testConditionAwaitInterruptedTimeoutExceeded() {
    Java
    - Registered: Fri Apr 12 12:43:09 GMT 2024
    - Last Modified: Wed Feb 09 22:57:07 GMT 2022
    - 31.7K bytes
    - Viewed (0)
  9. guava-tests/test/com/google/common/base/StopwatchTest.java

        ticker.advance(1);
        assertEquals("1.000 \u03bcs", stopwatch.toString());
        ticker.advance(1);
        assertEquals("1.001 \u03bcs", stopwatch.toString());
        ticker.advance(8998);
        assertEquals("9.999 \u03bcs", stopwatch.toString());
        stopwatch.reset();
        stopwatch.start();
        ticker.advance(1234567);
        assertEquals("1.235 ms", stopwatch.toString());
        stopwatch.reset();
        stopwatch.start();
    Java
    - Registered: Fri Apr 19 12:43:09 GMT 2024
    - Last Modified: Fri Feb 09 15:49:48 GMT 2024
    - 5.8K bytes
    - Viewed (0)
  10. android/guava-tests/test/com/google/common/collect/QueuesTest.java

          // producing one, will ask for two
          Future<?> producerThread = threadPool.submit(producer);
          producer.beganProducing.await();
    
          // make sure we time out
          Stopwatch timer = Stopwatch.createStarted();
    
          int drained = drain(q, newArrayList(), 2, 10, MILLISECONDS, interruptibly);
          assertThat(drained).isAtMost(1);
    
          assertThat(timer.elapsed(MILLISECONDS)).isAtLeast(10L);
    
    Java
    - Registered: Fri Apr 26 12:43:10 GMT 2024
    - Last Modified: Wed Sep 06 17:04:31 GMT 2023
    - 12K bytes
    - Viewed (0)
Back to top