diff options
author | Janak Ramakrishnan <janakr@google.com> | 2017-01-25 17:56:23 +0000 |
---|---|---|
committer | Laszlo Csomor <laszlocsomor@google.com> | 2017-01-25 22:24:10 +0000 |
commit | b7ad656850386e26a36951353ba2dffa0a8d0523 (patch) | |
tree | ce851c2552aa70457ff09301038b15d38b98e8da /src/main/java/com/google/devtools/build/lib/profiler/Profiler.java | |
parent | ffc0d2df0213123a4451bed5850827319afcdeee (diff) |
Add desired type of Profiler action to error message on crash. Also use Preconditions check because stringification is lazy.
--
PiperOrigin-RevId: 145560352
MOS_MIGRATED_REVID=145560352
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/profiler/Profiler.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/profiler/Profiler.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java index 7ac8370ffe..d4a7ca14b6 100644 --- a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java +++ b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java @@ -23,7 +23,6 @@ import com.google.devtools.build.lib.profiler.StatRecorder.VfsHeuristics; import com.google.devtools.build.lib.util.Clock; import com.google.devtools.build.lib.util.Preconditions; import com.google.devtools.build.lib.util.VarInt; - import java.io.BufferedOutputStream; import java.io.DataOutputStream; import java.io.IOException; @@ -865,12 +864,13 @@ public final class Profiler { if (isActive() && isProfiling(type)) { long endTime = clock.nanoTime(); TaskData data = taskStack.pop(); - // Do not use Preconditions class below due to the very expensive - // toString() calls used in the message. - if (data.type != type) { - throw new IllegalStateException("Inconsistent Profiler.completeTask() call for the " - + type + " task.\n " + taskStack); - } + Preconditions.checkState( + data.type == type, + "Inconsistent Profiler.completeTask() call: should have been %s but got %s (%s, %s)", + data.type, + type, + data, + taskStack); data.duration = endTime - data.startTime; if (data.parentId > 0) { taskStack.peek().aggregateChild(data.type, data.duration); |