aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Klaas Boesche <klaasb@google.com>2015-09-21 09:19:27 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2015-09-21 09:47:28 +0000
commit64228bfe646ab30d0361f43519f560e011d01509 (patch)
tree76955f926edfe03def74104412f702612ca189b5 /src
parent6e91eb9485a7a3aabdd3dd83ef2370251a43bf94 (diff)
Remove html title handling from Chart, ChartCreators, and HtmlChartVisitor, handle in HtmlCreator
-- MOS_MIGRATED_REVID=103528221
Diffstat (limited to 'src')
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java18
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java2
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java1
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java9
5 files changed, 9 insertions, 23 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
index 3a81934374..85b28a6bcb 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/AggregatingChartCreator.java
@@ -100,7 +100,7 @@ public class AggregatingChartCreator implements ChartCreator {
@Override
public Chart create() {
- Chart chart = new Chart(info.comment);
+ Chart chart = new Chart();
CommonChartCreator.createCommonChartItems(chart, info);
createTypes(chart);
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java
index b13fb8f1c2..47119a4023 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/Chart.java
@@ -14,7 +14,6 @@
package com.google.devtools.build.lib.profiler.chart;
-import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -29,9 +28,6 @@ public class Chart {
/** The type that is returned when an unknown type is looked up. */
public static final ChartBarType UNKNOWN_TYPE = new ChartBarType("Unknown type", Color.RED);
- /** The title of the chart. */
- private final String title;
-
/** The rows of the chart. */
private final Map<Long, ChartRow> rows = new HashMap<>();
@@ -51,16 +47,6 @@ public class Chart {
private long maxStop;
/**
- * Creates a chart.
- *
- * @param title the title of the chart
- */
- public Chart(String title) {
- Preconditions.checkNotNull(title);
- this.title = title;
- }
-
- /**
* Adds a bar to a row of the chart. If a row with the given id already
* exists, the bar is added to the row, otherwise a new row is created and the
* bar is added to it.
@@ -206,10 +192,6 @@ public class Chart {
return list;
}
- public String getTitle() {
- return title;
- }
-
public int getRowCount() {
return rows.size();
}
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
index 2689b34cb1..ea53104749 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/DetailedChartCreator.java
@@ -41,7 +41,7 @@ public class DetailedChartCreator implements ChartCreator {
@Override
public Chart create() {
- Chart chart = new Chart(info.comment);
+ Chart chart = new Chart();
CommonChartCreator.createCommonChartItems(chart, info);
createTypes(chart);
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java
index f9c8993707..c288d8a229 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlChartVisitor.java
@@ -73,7 +73,6 @@ public class HtmlChartVisitor implements ChartVisitor {
@Override
public void visit(Chart chart) {
maxStop = chart.getMaxStop();
- heading(chart.getTitle(), 1);
printContentBox();
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java
index 4059301a03..899e339d4c 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/chart/HtmlCreator.java
@@ -34,6 +34,7 @@ public final class HtmlCreator {
private final Chart chart;
private final HtmlChartVisitor chartVisitor;
private final Optional<SkylarkStatistics> skylarkStats;
+ private final String title;
/**
* Pre-formatted statistics for each phase of the profiled build.
@@ -42,11 +43,13 @@ public final class HtmlCreator {
private HtmlCreator(
PrintStream out,
+ String title,
Chart chart,
Optional<SkylarkStatistics> skylarkStats,
int htmlPixelsPerSecond,
List<ProfilePhaseStatistics> statistics) {
this.out = out;
+ this.title = title;
this.chart = chart;
chartVisitor = new HtmlChartVisitor(out, htmlPixelsPerSecond);
this.skylarkStats = skylarkStats;
@@ -68,7 +71,7 @@ public final class HtmlCreator {
private void htmlFrontMatter() {
out.println("<html><head>");
- out.printf("<title>%s</title>", chart.getTitle());
+ out.printf("<title>%s</title>", title);
chartVisitor.printCss(chart.getSortedTypes());
if (skylarkStats.isPresent()) {
@@ -77,6 +80,7 @@ public final class HtmlCreator {
out.println("</head>");
out.println("<body>");
+ out.printf("<h1>%s</h1>\n", title);
}
private void htmlBackMatter() {
@@ -130,7 +134,8 @@ public final class HtmlCreator {
skylarkStats = Optional.absent();
}
Chart chart = chartCreator.create();
- new HtmlCreator(out, chart, skylarkStats, htmlPixelsPerSecond, statistics).print();
+ new HtmlCreator(out, info.comment, chart, skylarkStats, htmlPixelsPerSecond, statistics)
+ .print();
}
}
}