Search in sources :

Example 1 with AggregateAttr

use of com.google.devtools.build.lib.profiler.ProfileInfo.AggregateAttr in project bazel by bazelbuild.

the class PhaseStatistics method addProfileInfo.

/**
   * Add statistics from {@link ProfileInfo} to the ones already accumulated for this phase.
   */
public void addProfileInfo(String workSpaceName, ProfileInfo info) {
    Task phaseTask = info.getPhaseTask(phase);
    if (phaseTask != null) {
        if (vfsStatistics != null) {
            vfsStatistics.addProfileInfo(workSpaceName, info);
        }
        wasExecuted = true;
        long infoPhaseDuration = info.getPhaseDuration(phaseTask);
        phaseDurationNanos += infoPhaseDuration;
        List<Task> taskList = info.getTasksForPhase(phaseTask);
        long duration = infoPhaseDuration;
        for (Task task : taskList) {
            // Tasks on the phaseTask thread already accounted for in the phaseDuration.
            if (task.threadId != phaseTask.threadId) {
                duration += task.durationNanos;
            }
        }
        totalDurationNanos += duration;
        for (ProfilerTask type : ProfilerTask.values()) {
            AggregateAttr attr = info.getStatsForType(type, taskList);
            long totalTime = Math.max(0, attr.totalTime);
            long count = Math.max(0, attr.count);
            add(taskCounts, type, count);
            add(taskDurations, type, totalTime);
        }
    }
}
Also used : Task(com.google.devtools.build.lib.profiler.ProfileInfo.Task) ProfilerTask(com.google.devtools.build.lib.profiler.ProfilerTask) ProfilerTask(com.google.devtools.build.lib.profiler.ProfilerTask) AggregateAttr(com.google.devtools.build.lib.profiler.ProfileInfo.AggregateAttr)

Aggregations

AggregateAttr (com.google.devtools.build.lib.profiler.ProfileInfo.AggregateAttr)1 Task (com.google.devtools.build.lib.profiler.ProfileInfo.Task)1 ProfilerTask (com.google.devtools.build.lib.profiler.ProfilerTask)1