Search in sources :

Example 1 with Task

use of com.google.devtools.build.lib.profiler.ProfileInfo.Task 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)

Example 2 with Task

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

the class PhaseVfsStatistics method collectVfsEntries.

/**
   * Add the VFS operations from the list of tasks to the {@link #statistics} table
   */
private void collectVfsEntries(String workSpaceName, List<Task> taskList) {
    for (Task task : taskList) {
        collectVfsEntries(workSpaceName, Arrays.asList(task.subtasks));
        if (!task.type.name().startsWith("VFS_")) {
            continue;
        }
        String path = pathMapping(workSpaceName, task.getDescription());
        Stat stat = statistics.get(task.type, path);
        if (stat == null) {
            stat = new Stat(path);
            statistics.put(task.type, path, stat);
        }
        stat.add(task.durationNanos);
    }
}
Also used : Task(com.google.devtools.build.lib.profiler.ProfileInfo.Task) ProfilerTask(com.google.devtools.build.lib.profiler.ProfilerTask)

Example 3 with Task

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

the class PhaseVfsStatistics method addProfileInfo.

/**
   * Accumulate statistics from another {@link ProfileInfo} in this object.
   */
public void addProfileInfo(final String workSpaceName, ProfileInfo info) {
    Task phaseTask = info.getPhaseTask(phase);
    if (phaseTask == null) {
        return;
    }
    collectVfsEntries(workSpaceName, info.getTasksForPhase(phaseTask));
}
Also used : Task(com.google.devtools.build.lib.profiler.ProfileInfo.Task) ProfilerTask(com.google.devtools.build.lib.profiler.ProfilerTask)

Example 4 with Task

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

the class SkylarkStatistics method addDurations.

/**
   * Add all durations and self-times of the given function to the maps.
   * @return The sum of the execution times of all {@link Task} values in the collection.
   */
private static long addDurations(Collection<Task> tasks, LongArrayList durations, LongArrayList selfDurations) {
    long totalTime = 0;
    durations.ensureCapacity(durations.size() + tasks.size());
    selfDurations.ensureCapacity(selfDurations.size() + tasks.size());
    for (Task task : tasks) {
        durations.add(task.durationNanos);
        selfDurations.add(task.durationNanos - task.getInheritedDuration());
        totalTime += task.durationNanos;
    }
    return totalTime;
}
Also used : Task(com.google.devtools.build.lib.profiler.ProfileInfo.Task)

Example 5 with Task

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

the class AggregatingChartCreator method create.

@Override
public Chart create() {
    Chart chart = new Chart();
    CommonChartCreator.createCommonChartItems(chart, info);
    createTypes(chart);
    for (ProfileInfo.Task task : info.allTasksById) {
        if (ACTION_TASKS.contains(task.type)) {
            createBar(chart, task, actionType);
        } else if (LOCK_TASKS.contains(task.type)) {
            createBar(chart, task, lockType);
        } else if (BLAZE_TASKS.contains(task.type)) {
            createBar(chart, task, blazeType);
        } else if (showVFS && VFS_TASKS.contains(task.type)) {
            createBar(chart, task, vfsType);
        }
    }
    return chart;
}
Also used : Task(com.google.devtools.build.lib.profiler.ProfileInfo.Task) ProfileInfo(com.google.devtools.build.lib.profiler.ProfileInfo)

Aggregations

Task (com.google.devtools.build.lib.profiler.ProfileInfo.Task)9 ProfilerTask (com.google.devtools.build.lib.profiler.ProfilerTask)6 ProfileInfo (com.google.devtools.build.lib.profiler.ProfileInfo)2 AggregateAttr (com.google.devtools.build.lib.profiler.ProfileInfo.AggregateAttr)1 CriticalPathEntry (com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry)1 LongArrayList (com.google.devtools.build.lib.util.LongArrayList)1 Collection (java.util.Collection)1