aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/util
diff options
context:
space:
mode:
authorGravatar Nathan Harmata <nharmata@google.com>2015-09-02 18:59:10 +0000
committerGravatar Florian Weikert <fwe@google.com>2015-09-02 21:08:09 +0000
commit71d22f6061b0344298f0e3e844a2df2d4ea6e052 (patch)
treefd6a6e6ccf43569dfdc5b401a24cff05bd5b2fc3 /src/test/java/com/google/devtools/build/lib/util
parent42124c98b412d1038794c5b9a0b59c34f6127eb6 (diff)
Modifications and improvements to AutoProfiler to reflect how it will be used in the codebase:
-Add integration with Profiler. -Add support for merely getting the elapsed time. -- MOS_MIGRATED_REVID=102165325
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/util')
-rw-r--r--src/test/java/com/google/devtools/build/lib/util/AutoProfilerTest.java54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/util/AutoProfilerTest.java b/src/test/java/com/google/devtools/build/lib/util/AutoProfilerTest.java
deleted file mode 100644
index cb87e4d356..0000000000
--- a/src/test/java/com/google/devtools/build/lib/util/AutoProfilerTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2015 Google Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-package com.google.devtools.build.lib.util;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import com.google.devtools.build.lib.testutil.ManualClock;
-import com.google.devtools.build.lib.util.AutoProfiler.ElapsedTimeReceiver;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/** Tests for {@link AutoProfiler}. */
-@RunWith(JUnit4.class)
-public class AutoProfilerTest {
-
- private ManualClock clock;
-
- @Before
- public void init() {
- clock = new ManualClock();
- BlazeClock.setClock(clock);
- }
-
- @Test
- public void simple() {
- final AtomicLong elapsedTime = new AtomicLong();
- ElapsedTimeReceiver receiver = new ElapsedTimeReceiver() {
- @Override
- public void accept(long elapsedTimeNanos) {
- elapsedTime.set(elapsedTimeNanos);
- }
- };
- try (AutoProfiler profiler = AutoProfiler.create(receiver)) {
- clock.advanceMillis(42);
- }
- assertThat(elapsedTime.get()).isEqualTo(42 * 1000 * 1000);
- }
-}
-