diff options
author | 2015-10-07 15:53:01 +0000 | |
---|---|---|
committer | 2015-10-08 12:11:31 +0000 | |
commit | c86cfe6112ae4fdd18de5a2ed68fe55ef2d34b04 (patch) | |
tree | b06afb86a7780ee074b559e8971678e315064d92 /src/main/java/com/google/devtools/build/lib/runtime/commands | |
parent | 6100d595f5c65a4bee8d272eea9c256e108dfd21 (diff) |
Fix unsorted dumping of profiler task info
--
MOS_MIGRATED_REVID=104865475
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/commands')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java index 96384c4abd..30eeb76111 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/ProfileCommand.java @@ -184,13 +184,21 @@ public final class ProfileCommand implements BlazeCommand { try { ProfileInfo info = ProfileInfo.loadProfileVerbosely( profileFile, getInfoListener(env)); - ProfileInfo.aggregateProfile(info, getInfoListener(env)); + + if (opts.dumpMode == null || !opts.dumpMode.contains("unsorted")) { + ProfileInfo.aggregateProfile(info, getInfoListener(env)); + } if (opts.taskTree != null) { printTaskTree(out, name, info, opts.taskTree, opts.taskTreeThreshold); continue; } + if (opts.dumpMode != null) { + dumpProfile(info, out, opts.dumpMode); + continue; + } + PhaseSummaryStatistics phaseSummaryStatistics = new PhaseSummaryStatistics(info); EnumMap<ProfilePhase, PhaseStatistics> phaseStatistics = new EnumMap<>(ProfilePhase.class); @@ -199,9 +207,7 @@ public final class ProfileCommand implements BlazeCommand { phase, new PhaseStatistics(phase, info, runtime.getWorkspaceName())); } - if (opts.dumpMode != null) { - dumpProfile(env, info, out, opts.dumpMode); - } else if (opts.html) { + if (opts.html) { Path htmlFile = profileFile.getParentDirectory().getChild(profileFile.getBaseName() + ".html"); @@ -265,11 +271,10 @@ public final class ProfileCommand implements BlazeCommand { } } - private void dumpProfile( - CommandEnvironment env, ProfileInfo info, PrintStream out, String dumpMode) { - if (!dumpMode.contains("unsorted")) { - ProfileInfo.aggregateProfile(info, getInfoListener(env)); - } + /** + * Dumps all tasks in the requested format. + */ + private void dumpProfile(ProfileInfo info, PrintStream out, String dumpMode) { if (dumpMode.contains("raw")) { for (ProfileInfo.Task task : info.allTasksById) { dumpRaw(task, out); @@ -285,6 +290,9 @@ public final class ProfileCommand implements BlazeCommand { } } + /** + * Dumps the task information and all subtasks. + */ private void dumpTask(ProfileInfo.Task task, PrintStream out, int indent) { StringBuilder builder = new StringBuilder( |