Search in sources :

Example 1 with MiddleManStatistics

use of com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics.MiddleManStatistics in project bazel by bazelbuild.

the class CriticalPathText method printCriticalPath.

private void printCriticalPath(String title, CriticalPathEntry path) {
    lnPrintf("%s (%s):", title, TimeUtilities.prettyTime(path.cumulativeDuration));
    boolean isComponent = path.isComponent();
    if (isComponent) {
        lnPrintf("%6s %11s %8s   %s", "Id", "Time", "Percentage", "Description");
    } else {
        lnPrintf("%6s %11s %8s %8s   %s", "Id", "Time", "Share", "Critical", "Description");
    }
    long totalPathTime = path.cumulativeDuration;
    for (CriticalPathEntry pathEntry : criticalPathStats.getMiddlemanFilteredPath(path)) {
        String desc = pathEntry.task.getDescription().replace(':', ' ');
        if (isComponent) {
            lnPrintf("%6d %11s %8s   %s", pathEntry.task.id, TimeUtilities.prettyTime(pathEntry.duration), prettyPercentage((double) pathEntry.duration / totalPathTime), desc);
        } else {
            lnPrintf("%6d %11s %8s %8s   %s", pathEntry.task.id, TimeUtilities.prettyTime(pathEntry.duration), prettyPercentage((double) pathEntry.duration / totalPathTime), prettyPercentage((double) pathEntry.getCriticalTime() / totalPathTime), desc);
        }
    }
    MiddleManStatistics middleMan = MiddleManStatistics.create(path);
    if (middleMan.count > 0) {
        if (isComponent) {
            lnPrintf("       %11s %8s   [%d middleman actions]", TimeUtilities.prettyTime(middleMan.duration), prettyPercentage((double) middleMan.duration / totalPathTime), middleMan.count);
        } else {
            lnPrintf("       %11s %8s %8s   [%d middleman actions]", TimeUtilities.prettyTime(middleMan.duration), prettyPercentage((double) middleMan.duration / totalPathTime), prettyPercentage((double) middleMan.criticalTime / totalPathTime), middleMan.count);
        }
    }
}
Also used : CriticalPathEntry(com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry) MiddleManStatistics(com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics.MiddleManStatistics)

Example 2 with MiddleManStatistics

use of com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics.MiddleManStatistics in project bazel by bazelbuild.

the class CriticalPathHtml method printCriticalPath.

private void printCriticalPath(String title, CriticalPathEntry path) {
    lnOpen("table");
    lnOpen("tr");
    element("td", "colspan", "4", String.format("%s (%s):", title, TimeUtilities.prettyTime(path.cumulativeDuration)));
    // tr
    close();
    lnOpen("tr");
    boolean pathIsComponent = path.isComponent();
    element("th", "Id");
    element("th", "Time");
    element("th", "Share");
    if (!pathIsComponent) {
        element("th", "Critical");
    }
    element("th", "Description");
    // tr
    close();
    long totalPathTime = path.cumulativeDuration;
    for (CriticalPathEntry pathEntry : criticalPathStats.getMiddlemanFilteredPath(path)) {
        String desc = pathEntry.task.getDescription().replace(':', ' ');
        lnOpen("tr");
        element("td", pathEntry.task.id);
        element("td", "style", "text-align: right", TimeUtilities.prettyTime(pathEntry.duration).replace(" ", " "));
        element("td", prettyPercentage((double) pathEntry.duration / totalPathTime));
        if (!pathIsComponent) {
            element("td", prettyPercentage((double) pathEntry.getCriticalTime() / totalPathTime));
        }
        element("td", desc);
        // tr
        close();
    }
    MiddleManStatistics middleMan = MiddleManStatistics.create(path);
    if (middleMan.count > 0) {
        lnOpen("tr");
        element("td");
        element("td", TimeUtilities.prettyTime(middleMan.duration));
        element("td", prettyPercentage((double) middleMan.duration / totalPathTime));
        if (!pathIsComponent) {
            element("td", prettyPercentage((double) middleMan.criticalTime / totalPathTime));
        }
        element("td", String.format("[%d middleman actions]", middleMan.count));
        // tr
        close();
    }
    // table
    lnClose();
}
Also used : CriticalPathEntry(com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry) MiddleManStatistics(com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics.MiddleManStatistics)

Aggregations

CriticalPathEntry (com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry)2 MiddleManStatistics (com.google.devtools.build.lib.profiler.statistics.CriticalPathStatistics.MiddleManStatistics)2