diff options
author | 2018-06-08 14:14:05 -0700 | |
---|---|---|
committer | 2018-06-08 14:15:45 -0700 | |
commit | f92107b43c108c6f7043f003ec31bb14c158d8ca (patch) | |
tree | 2d6ca8f86945cea5c7c2a16196bf41ea08580467 /src/main/java/com/google/devtools/build/lib/profiler/analysis | |
parent | 99857821f93297ff867c26f77026f8508ac85b62 (diff) |
Clean up Profiler a bit
PiperOrigin-RevId: 199849102
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/profiler/analysis')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java | 86 |
1 files changed, 2 insertions, 84 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java b/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java index 88cb5b8071..6104674086 100644 --- a/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java +++ b/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java @@ -448,7 +448,6 @@ public class ProfileInfo { // TODO(bazel-team): (2010) In one case, this list took 277MB of heap. Ideally it should be // replaced with a trie. private final List<String> descriptionList; - private final Map<Task, Task> parallelBuilderCompletionQueueTasks; public final Map<Long, Task[]> tasksByThread; public final List<Task> allTasksById; public List<Task> rootTasksById; // Not final due to the late initialization. @@ -468,7 +467,6 @@ public class ProfileInfo { descriptionList = Lists.newArrayListWithExpectedSize(10000); tasksByThread = Maps.newHashMap(); - parallelBuilderCompletionQueueTasks = Maps.newHashMap(); allTasksById = Lists.newArrayListWithExpectedSize(50000); phaseTasks = Lists.newArrayList(); actionDependencyMap = Maps.newHashMapWithExpectedSize(10000); @@ -681,43 +679,6 @@ public class ProfileInfo { return duration; } - - /** - * Builds map of dependencies between ACTION tasks based on dependencies - * between ACTION_GRAPH tasks - */ - private Task buildActionTaskTree(Task actionGraphTask, List<Task> actionTasksByDescription) { - Task actionTask = actionGraphTask.relatedTask; - if (actionTask == null) { - actionTask = actionTasksByDescription.get(actionGraphTask.descIndex); - if (actionTask == null) { - // If we cannot find ACTION task that corresponds to the ACTION_GRAPH task, - // most likely scenario is that we dealing with either aborted or failed - // build. In this case we will find or create fake zero-duration action - // task and still reconstruct dependency graph. - actionTask = new Task(-1, --fakeActionId, 0, 0, 0, - ProfilerTask.ACTION, actionGraphTask.descIndex, new CompactStatistics((byte[]) null)); - actionTask.calculateRootStats(); - actionTasksByDescription.set(actionGraphTask.descIndex, actionTask); - } - actionGraphTask.relatedTask = actionTask; - } - if (actionGraphTask.subtasks.length != 0) { - List<Task> list = Lists.newArrayListWithCapacity(actionGraphTask.subtasks.length); - for (Task task : actionGraphTask.subtasks) { - if (task.type == ProfilerTask.ACTION_GRAPH) { - list.add(buildActionTaskTree(task, actionTasksByDescription)); - } - } - if (!list.isEmpty()) { - Task[] actionPrerequisites = list.toArray(new Task[list.size()]); - Arrays.sort(actionPrerequisites); - actionDependencyMap.put(actionTask, actionPrerequisites); - } - } - return actionTask; - } - /** * Builds map of dependencies between ACTION tasks based on dependencies * between ACTION_GRAPH tasks. Root of that dependency tree would be @@ -740,32 +701,9 @@ public class ProfileInfo { } } List<Task> list = new ArrayList<>(); - for (Task task : getTasksForPhase(analysisPhaseTask)) { - if (task.type == ProfilerTask.ACTION_GRAPH) { - list.add(buildActionTaskTree(task, actionTasksByDescription)); - } - } Task[] actionPrerequisites = list.toArray(new Task[list.size()]); Arrays.sort(actionPrerequisites); actionDependencyMap.put(executionPhaseTask, actionPrerequisites); - - // Scan through all execution phase tasks to identify ACTION_SUBMIT tasks and associate - // them with ACTION task counterparts. ACTION_SUBMIT tasks are not necessarily root - // tasks so we need to scan ALL tasks. - for (Task task : allTasksById.subList(executionPhaseTask.id, allTasksById.size())) { - if (task.type == ProfilerTask.ACTION_SUBMIT) { - Task actionTask = actionTasksByDescription.get(task.descIndex); - if (actionTask != null) { - task.relatedTask = actionTask; - actionTask.relatedTask = task; - } - } else if (task.type == ProfilerTask.ACTION_BUILDER) { - Task actionTask = actionTasksByDescription.get(task.descIndex); - if (actionTask != null) { - parallelBuilderCompletionQueueTasks.put(actionTask, task); - } - } - } } /** @@ -903,19 +841,7 @@ public class ProfileInfo { * ACTION task start time and ACTION_SUBMIT task start time). */ public long getActionWaitTime(Task actionTask) { - // Light critical path does not record wait time. - if (actionTask.type == ProfilerTask.CRITICAL_PATH_COMPONENT) { - return 0; - } - Preconditions.checkArgument(actionTask.type == ProfilerTask.ACTION); - if (actionTask.relatedTask != null) { - Preconditions.checkState(actionTask.relatedTask.type == ProfilerTask.ACTION_SUBMIT); - long time = actionTask.startTime - actionTask.relatedTask.startTime; - Preconditions.checkState(time >= 0); - return time; - } else { - return 0L; // submission time is not available. - } + return 0L; // submission time is not available. } /** @@ -928,15 +854,7 @@ public class ProfileInfo { return 0; } Preconditions.checkArgument(actionTask.type == ProfilerTask.ACTION); - Task related = parallelBuilderCompletionQueueTasks.get(actionTask); - if (related != null) { - Preconditions.checkState(related.type == ProfilerTask.ACTION_BUILDER); - long time = related.startTime - (actionTask.startTime + actionTask.durationNanos); - Preconditions.checkState(time >= 0); - return time; - } else { - return 0L; // queue task is not available. - } + return 0L; // queue task is not available. } /** |