diff options
author | ulfjack <ulfjack@google.com> | 2018-06-11 06:00:36 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-11 06:01:34 -0700 |
commit | 4cf2ebdcef7b5d4c46e533a560642b89eb3f02a5 (patch) | |
tree | cf2b64cf0f82827955cb34ce7b188fc641b946d6 /src/main/java/com/google/devtools/build/lib/vfs | |
parent | c720152ec1936a537c9519d522d3cb41d19cff77 (diff) |
Add AutoProfiler-like API to Profiler
- migrate all startTask/completeTask pairs to the new API
PiperOrigin-RevId: 200038703
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/vfs')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java b/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java index c70270c6a2..24cdeaeb3e 100644 --- a/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java +++ b/src/main/java/com/google/devtools/build/lib/vfs/UnixGlob.java @@ -35,6 +35,7 @@ import com.google.common.util.concurrent.SettableFuture; import com.google.common.util.concurrent.Uninterruptibles; import com.google.devtools.build.lib.profiler.Profiler; import com.google.devtools.build.lib.profiler.ProfilerTask; +import com.google.devtools.build.lib.profiler.SilentCloseable; import java.io.IOException; import java.util.Collection; import java.util.Collections; @@ -606,8 +607,8 @@ public final class UnixGlob { new Runnable() { @Override public void run() { - Profiler.instance().startTask(ProfilerTask.VFS_GLOB, base.getPathString()); - try { + try (SilentCloseable c = + Profiler.instance().profile(ProfilerTask.VFS_GLOB, base.getPathString())) { reallyGlob(base, baseIsDir, idx, context); } catch (IOException e) { ioException.set(e); @@ -615,8 +616,6 @@ public final class UnixGlob { runtimeException.set(e); } catch (Error e) { error.set(e); - } finally { - Profiler.instance().completeTask(ProfilerTask.VFS_GLOB); } } |