From 6bd4f2da3288a1508bdafe3072a1a2f611eb8316 Mon Sep 17 00:00:00 2001 From: Klaas Boesche Date: Tue, 22 Sep 2015 11:29:47 +0000 Subject: Heavily refactor ProfileCommand to separate output and statistics generation and enable their reuse -- MOS_MIGRATED_REVID=103634406 --- .../com/google/devtools/build/lib/profiler/ProfileInfo.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java') diff --git a/src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java b/src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java index d30b3dfd48..10f124f043 100644 --- a/src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java +++ b/src/main/java/com/google/devtools/build/lib/profiler/ProfileInfo.java @@ -14,7 +14,6 @@ package com.google.devtools.build.lib.profiler; import static com.google.devtools.build.lib.profiler.ProfilerTask.CRITICAL_PATH; -import static com.google.devtools.build.lib.profiler.ProfilerTask.CRITICAL_PATH_COMPONENT; import static com.google.devtools.build.lib.profiler.ProfilerTask.TASK_COUNT; import com.google.common.base.Joiner; @@ -295,6 +294,15 @@ public class ProfileInfo { public long getCriticalTime() { return criticalTime; } + + /** + * @return true when this is just an action element on the critical path as logged by + * {@link com.google.devtools.build.lib.runtime.BuildSummaryStatsModule} and is thus a + * pre-processed and -analyzed critical path element + */ + public boolean isComponent() { + return task.type == ProfilerTask.CRITICAL_PATH_COMPONENT; + } } /** @@ -760,7 +768,7 @@ public class ProfileInfo { public void analyzeCriticalPath(Set ignoredTypes, CriticalPathEntry path) { // With light critical path we do not need to analyze since it is already preprocessed // by blaze build. - if (path != null && path.task.type == CRITICAL_PATH_COMPONENT) { + if (path == null || path.isComponent()) { return; } for (CriticalPathEntry entry = path; entry != null; entry = entry.next) { -- cgit v1.2.3