Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for Stopwatch (0.05 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:
     *
     * {@snippet :
     * Stopwatch stopwatch = Stopwatch.createStarted();
     * doSomething();
     * stopwatch.stop(); // optional
     *
     * Duration duration = stopwatch.elapsed();
     *
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-03-17 20:26
    - 9.2K bytes
    - Viewed (0)
  2. guava-tests/test/com/google/common/base/StopwatchTest.java

        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();
        ticker.advance(5000000000L);
        assertEquals("5.000 s", stopwatch.toString());
        stopwatch.reset();
        stopwatch.start();
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-05-20 16:01
    - 6.2K bytes
    - Viewed (0)
  3. android/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();
    
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-02-11 19:03
    - 9.7K bytes
    - Viewed (0)
  4. android/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() {
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-05-13 18:46
    - 31.8K bytes
    - Viewed (0)
  5. android/guava-tests/test/com/google/common/base/StopwatchTest.java

        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();
        ticker.advance(5000000000L);
        assertEquals("5.000 s", stopwatch.toString());
        stopwatch.reset();
        stopwatch.start();
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-05-20 16:01
    - 6.2K bytes
    - Viewed (0)
  6. 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() {
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-05-13 18:46
    - 31.8K bytes
    - Viewed (0)
  7. 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
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-05-13 17:27
    - 21.9K bytes
    - Viewed (0)
  8. guava-tests/benchmark/com/google/common/base/StopwatchBenchmark.java

     * because it's ambiguous to what extent the stopwatch benchmark is being affected by GC.
     *
     * @author Kevin Bourrillion
     */
    @NullUnmarked
    public class StopwatchBenchmark {
      @Benchmark
      long stopwatch(int reps) {
        long total = 0;
        for (int i = 0; i < reps; i++) {
          Stopwatch s = Stopwatch.createStarted();
          // here is where you would do something
    Registered: 2025-05-30 12:43
    - Last Modified: 2024-12-19 18:03
    - 1.5K bytes
    - Viewed (0)
  9. android/guava-tests/benchmark/com/google/common/base/StopwatchBenchmark.java

     * because it's ambiguous to what extent the stopwatch benchmark is being affected by GC.
     *
     * @author Kevin Bourrillion
     */
    @NullUnmarked
    public class StopwatchBenchmark {
      @Benchmark
      long stopwatch(int reps) {
        long total = 0;
        for (int i = 0; i < reps; i++) {
          Stopwatch s = Stopwatch.createStarted();
          // here is where you would do something
    Registered: 2025-05-30 12:43
    - Last Modified: 2024-12-19 18:03
    - 1.5K bytes
    - Viewed (0)
  10. android/guava/src/com/google/common/util/concurrent/ServiceManager.java

                to);
            // Update the timer
            Stopwatch stopwatch = startupTimers.get(service);
            if (stopwatch == null) {
              // This means the service was started by some means other than ServiceManager.startAsync
              stopwatch = Stopwatch.createStarted();
              startupTimers.put(service, stopwatch);
            }
            if (to.compareTo(RUNNING) >= 0 && stopwatch.isRunning()) {
    Registered: 2025-05-30 12:43
    - Last Modified: 2025-05-13 17:27
    - 33.2K bytes
    - Viewed (0)
Back to top