diff options
author | twerth <twerth@google.com> | 2018-08-14 07:53:40 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-08-14 07:55:28 -0700 |
commit | d12db5975687a87b6d36543747234200d0cdc3b5 (patch) | |
tree | ab6500d9a06422d6fdbfe2cf6831ebf6a48531d0 /src/test | |
parent | a05e6ccdba85f5e827245aa581accd2867e40851 (diff) |
Add experimental option to do add local cpu usage values to the JSON profile.
RELNOTES: None
PiperOrigin-RevId: 208646319
Diffstat (limited to 'src/test')
3 files changed, 40 insertions, 17 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/profiler/AutoProfilerBenchmark.java b/src/test/java/com/google/devtools/build/lib/profiler/AutoProfilerBenchmark.java index 044ae8c0d4..448a21baca 100644 --- a/src/test/java/com/google/devtools/build/lib/profiler/AutoProfilerBenchmark.java +++ b/src/test/java/com/google/devtools/build/lib/profiler/AutoProfilerBenchmark.java @@ -27,14 +27,16 @@ public class AutoProfilerBenchmark { @BeforeExperiment void startProfiler() throws Exception { - Profiler.instance().start( - ProfiledTaskKinds.ALL, - new InMemoryFileSystem().getPath("/out.dat").getOutputStream(), - Profiler.Format.BINARY_BAZEL_FORMAT, - "benchmark", - false, - BlazeClock.instance(), - BlazeClock.instance().nanoTime()); + Profiler.instance() + .start( + ProfiledTaskKinds.ALL, + new InMemoryFileSystem().getPath("/out.dat").getOutputStream(), + Profiler.Format.BINARY_BAZEL_FORMAT, + "benchmark", + false, + BlazeClock.instance(), + BlazeClock.instance().nanoTime(), + /* enabledCpuUsageProfiling= */ false); } @BeforeExperiment diff --git a/src/test/java/com/google/devtools/build/lib/profiler/ProfilerChartTest.java b/src/test/java/com/google/devtools/build/lib/profiler/ProfilerChartTest.java index 43d6bbc2d1..468f6bba42 100644 --- a/src/test/java/com/google/devtools/build/lib/profiler/ProfilerChartTest.java +++ b/src/test/java/com/google/devtools/build/lib/profiler/ProfilerChartTest.java @@ -258,7 +258,8 @@ public class ProfilerChartTest extends FoundationTestCase { "basic test", false, BlazeClock.instance(), - BlazeClock.instance().nanoTime()); + BlazeClock.instance().nanoTime(), + /* enabledCpuUsageProfiling= */ false); // Write from multiple threads to generate multiple rows in the chart. for (int i = 0; i < noOfRows; i++) { diff --git a/src/test/java/com/google/devtools/build/lib/profiler/ProfilerTest.java b/src/test/java/com/google/devtools/build/lib/profiler/ProfilerTest.java index a4b5424c1a..4c1878577e 100644 --- a/src/test/java/com/google/devtools/build/lib/profiler/ProfilerTest.java +++ b/src/test/java/com/google/devtools/build/lib/profiler/ProfilerTest.java @@ -79,13 +79,27 @@ public class ProfilerTest { throws IOException { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); profiler.start( - kinds, buffer, format, "test", false, BlazeClock.instance(), BlazeClock.nanoTime()); + kinds, + buffer, + format, + "test", + false, + BlazeClock.instance(), + BlazeClock.nanoTime(), + /* enabledCpuUsageProfiling= */ false); return buffer; } private void startUnbuffered(ProfiledTaskKinds kinds) throws IOException { profiler.start( - kinds, null, null, "test", false, BlazeClock.instance(), BlazeClock.nanoTime()); + kinds, + null, + null, + "test", + false, + BlazeClock.instance(), + BlazeClock.nanoTime(), + /* enabledCpuUsageProfiling= */ false); } @Test @@ -183,7 +197,8 @@ public class ProfilerTest { "basic test", true, BlazeClock.instance(), - BlazeClock.instance().nanoTime()); + BlazeClock.instance().nanoTime(), + /* enabledCpuUsageProfiling= */ false); try (SilentCloseable c = profiler.profile(ProfilerTask.ACTION, "action task")) { // Next task takes less than 10 ms but should be recorded anyway. clock.advanceMillis(1); @@ -212,7 +227,8 @@ public class ProfilerTest { "test", true, BlazeClock.instance(), - BlazeClock.instance().nanoTime()); + BlazeClock.instance().nanoTime(), + /* enabledCpuUsageProfiling= */ false); profiler.logSimpleTask(10000, 20000, ProfilerTask.VFS_STAT, "stat"); profiler.logSimpleTask(20000, 30000, ProfilerTask.REMOTE_EXECUTION, "remote execution"); @@ -320,7 +336,8 @@ public class ProfilerTest { "test", true, BlazeClock.instance(), - BlazeClock.instance().nanoTime()); + BlazeClock.instance().nanoTime(), + /* enabledCpuUsageProfiling= */ false); profiler.logSimpleTask(10000, 20000, ProfilerTask.VFS_STAT, "stat"); assertThat(ProfilerTask.VFS_STAT.collectsSlowestInstances()).isTrue(); @@ -539,7 +556,8 @@ public class ProfilerTest { "testResilenceToNonDecreasingNanoTimes", false, badClock, - initialNanoTime); + initialNanoTime, + /* enabledCpuUsageProfiling= */ false); profiler.logSimpleTask(badClock.nanoTime(), ProfilerTask.INFO, "some task"); profiler.stop(); } @@ -589,7 +607,8 @@ public class ProfilerTest { "basic test", false, BlazeClock.instance(), - BlazeClock.instance().nanoTime()); + BlazeClock.instance().nanoTime(), + /* enabledCpuUsageProfiling= */ false); profiler.logSimpleTaskDuration( Profiler.nanoTimeMaybe(), Duration.ofSeconds(10), ProfilerTask.INFO, "foo"); try { @@ -615,7 +634,8 @@ public class ProfilerTest { "basic test", false, BlazeClock.instance(), - BlazeClock.instance().nanoTime()); + BlazeClock.instance().nanoTime(), + /* enabledCpuUsageProfiling= */ false); profiler.logSimpleTaskDuration( Profiler.nanoTimeMaybe(), Duration.ofSeconds(10), ProfilerTask.INFO, "foo"); try { |