Skip to content

Commit

Permalink
Reset profilers between tests.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 442812589
  • Loading branch information
meisterT authored and copybara-github committed Apr 19, 2022
1 parent 8f61bc2 commit b059011
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/test/java/com/google/devtools/build/lib/metrics/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ java_test(
"//src/main/java/com/google/devtools/build/lib/analysis:view_creation_failed_exception",
"//src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_java_proto",
"//src/main/java/com/google/devtools/build/lib/metrics:event",
"//src/main/java/com/google/devtools/build/lib/metrics:memory-use-recorder",
"//src/main/java/com/google/devtools/build/lib/metrics:metrics_module",
"//src/main/java/com/google/devtools/build/lib/profiler",
"//src/main/java/com/google/devtools/build/lib/util:os",
"//src/test/java/com/google/devtools/build/lib/buildtool/util",
"//third_party:guava",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.BuildGraphMetrics;
import com.google.devtools.build.lib.buildeventstream.BuildEventStreamProtos.BuildMetrics.CumulativeMetrics;
import com.google.devtools.build.lib.buildtool.util.BuildIntegrationTestCase;
import com.google.devtools.build.lib.profiler.MemoryProfiler;
import com.google.devtools.build.lib.runtime.BlazeModule;
import com.google.devtools.build.lib.runtime.BlazeRuntime;
import com.google.devtools.build.lib.runtime.CommandEnvironment;
import com.google.devtools.build.lib.util.OS;
import java.util.List;
import org.junit.After;
import org.junit.Assume;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -77,6 +79,12 @@ public void writeTrivialFooTarget() throws Exception {
")");
}

@After
public void resetProfilers() throws Exception {
MemoryProfiler.instance().stop();
PostGCMemoryUseRecorder.get().reset();
}

@Test
public void testActionsCreated() throws Exception {
buildTarget("//foo:foo");
Expand Down

0 comments on commit b059011

Please sign in to comment.