Search in sources :

Example 1 with Stat

use of com.google.devtools.build.lib.profiler.statistics.PhaseVfsStatistics.Stat in project bazel by bazelbuild.

the class PhaseHtml method printVfsStatistics.

/**
   * Print the time spent on VFS operations on each path. Output is grouped by operation and sorted
   * by descending duration. If multiple of the same VFS operation were logged for the same path,
   * print the total duration.
   */
private void printVfsStatistics(@Nullable PhaseVfsStatistics stats) {
    if (vfsStatsLimit == 0 || stats == null || stats.isEmpty()) {
        return;
    }
    lnElement("h4", "VFS path statistics:");
    lnOpen("table", "class", "phase-statistics");
    lnOpen("tr");
    element("td", "Type");
    element("td", "Frequency");
    element("td", "Duration");
    element("td", "class", "left", "Path");
    // tr
    close();
    for (ProfilerTask type : stats) {
        int numPrinted = 0;
        for (Stat stat : stats.getSortedStatistics(type)) {
            lnOpen("tr");
            if (vfsStatsLimit != -1 && numPrinted++ == vfsStatsLimit) {
                open("td", "class", "center", "colspan", "4");
                printf("... %d more ...", stats.getStatisticsCount(type) - vfsStatsLimit);
                close();
                // tr
                close();
                break;
            }
            element("td", type.name());
            element("td", stat.getCount());
            element("td", TimeUtilities.prettyTime(stat.getDuration()));
            element("td", "class", "left", stat.path);
            // tr
            close();
        }
    }
    // table
    lnClose();
}
Also used : Stat(com.google.devtools.build.lib.profiler.statistics.PhaseVfsStatistics.Stat) ProfilerTask(com.google.devtools.build.lib.profiler.ProfilerTask)

Example 2 with Stat

use of com.google.devtools.build.lib.profiler.statistics.PhaseVfsStatistics.Stat in project bazel by bazelbuild.

the class PhaseText method printVfsStatistics.

/**
   * Print the time spent on VFS operations on each path. Output is grouped by operation and
   * sorted by descending duration. If multiple of the same VFS operation were logged for the same
   * path, print the total duration.
   */
private void printVfsStatistics(@Nullable PhaseVfsStatistics stats) {
    if (vfsStatsLimit == 0 || stats == null || stats.isEmpty()) {
        return;
    }
    lnPrint("VFS path statistics:");
    lnPrintf("%15s %10s %10s %s", "Type", "Frequency", "Duration", "Path");
    for (ProfilerTask type : stats) {
        int numPrinted = 0;
        for (Stat stat : stats.getSortedStatistics(type)) {
            if (vfsStatsLimit != -1 && numPrinted++ == vfsStatsLimit) {
                lnPrintf("... %d more ...", stats.getStatisticsCount(type) - vfsStatsLimit);
                break;
            }
            lnPrintf("%15s %10d %10s %s", type.name(), stat.getCount(), TimeUtilities.prettyTime(stat.getDuration()), stat.path);
        }
    }
    printLn();
}
Also used : Stat(com.google.devtools.build.lib.profiler.statistics.PhaseVfsStatistics.Stat) ProfilerTask(com.google.devtools.build.lib.profiler.ProfilerTask)

Aggregations

ProfilerTask (com.google.devtools.build.lib.profiler.ProfilerTask)2 Stat (com.google.devtools.build.lib.profiler.statistics.PhaseVfsStatistics.Stat)2