use of com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry in project bazel by bazelbuild.
the class CriticalPathHtml method printCriticalPaths.
/**
* Print total and optimal critical paths if available.
*/
public void printCriticalPaths() {
CriticalPathEntry totalPath = criticalPathStats.getTotalPath();
printCriticalPath("Critical path", totalPath);
// sense to differentiate it.
if (!totalPath.isComponent()) {
printCriticalPath("Critical path excluding scheduling delays", criticalPathStats.getOptimalPath());
}
}
use of com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry in project bazel by bazelbuild.
the class CriticalPathHtml method printTimingBreakdown.
public void printTimingBreakdown() {
CriticalPathEntry totalPath = criticalPathStats.getTotalPath();
CriticalPathEntry optimalPath = criticalPathStats.getOptimalPath();
if (totalPath != null) {
if (!totalPath.isComponent()) {
printCriticalPathTimingBreakdown(totalPath, optimalPath);
}
} else {
lnPrint("Critical path not available because no action graph was generated.");
}
}
use of com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry 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);
}
}
}
use of com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry in project bazel by bazelbuild.
the class DetailedChartCreator method create.
@Override
public Chart create() {
Chart chart = new Chart();
CommonChartCreator.createCommonChartItems(chart, info);
createTypes(chart);
// calculate the critical path
EnumSet<ProfilerTask> typeFilter = EnumSet.noneOf(ProfilerTask.class);
CriticalPathEntry criticalPath = info.getCriticalPath(typeFilter);
info.analyzeCriticalPath(typeFilter, criticalPath);
for (Task task : info.allTasksById) {
String label = task.type.description + ": " + task.getDescription();
ChartBarType type = chart.lookUpType(task.type.description);
long stop = task.startTime + task.durationNanos;
CriticalPathEntry entry = null;
// for top level tasks, check if they are on the critical path
if (task.parentId == 0 && criticalPath != null) {
entry = info.getNextCriticalPathEntryForTask(criticalPath, task);
// find next top-level entry
if (entry != null) {
CriticalPathEntry nextEntry = entry.next;
while (nextEntry != null && nextEntry.task.parentId != 0) {
nextEntry = nextEntry.next;
}
if (nextEntry != null) {
// time is start and not stop as we traverse the critical back backwards
chart.addVerticalLine(task.threadId, nextEntry.task.threadId, task.startTime);
}
}
}
chart.addBar(task.threadId, task.startTime, stop, type, (entry != null), label);
}
return chart;
}
use of com.google.devtools.build.lib.profiler.ProfileInfo.CriticalPathEntry 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();
}
Aggregations