aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/profiler/analysis
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2018-07-02 02:44:51 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-07-02 02:46:16 -0700
commitf45c22407e6b00fcba706eb62141cb9036bd38d7 (patch)
tree4e45e924059b93c84fa1cc4ddb60a81a9e461b24 /src/main/java/com/google/devtools/build/lib/profiler/analysis
parent6c87dfc7a1e3e9879c2e87c5689db779136892fa (diff)
Set the start time of binary and JSON profiles to zero correctly.
Also correct for buggy profiles written previously. RELNOTES: None. PiperOrigin-RevId: 202920255
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/profiler/analysis')
-rw-r--r--src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java b/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java
index 5050eb4436..4eb7f6e115 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/analysis/ProfileInfo.java
@@ -444,6 +444,7 @@ public class ProfileInfo {
private static final AggregateAttr ZERO = new AggregateAttr(0, 0);
public final String comment;
+ private long minTaskStartTime = Long.MAX_VALUE;
private boolean corruptedOrIncomplete = false;
// TODO(bazel-team): (2010) In one case, this list took 277MB of heap. Ideally it should be
@@ -475,6 +476,7 @@ public class ProfileInfo {
private void addTask(Task task) {
allTasksById.add(task);
+ minTaskStartTime = Math.min(minTaskStartTime, task.startTime);
}
/**
@@ -625,6 +627,16 @@ public class ProfileInfo {
}
/**
+ * Returns the minimum task start time, that is, when the profile actually started.
+ *
+ * <p>This should be very close to zero except that some Blaze versions contained a bug that made
+ * them not subtract the current time from task start times in the profile.</p>
+ */
+ public long getMinTaskStartTime() {
+ return minTaskStartTime;
+ }
+
+ /**
* Returns list of all root tasks related to (in other words, started during)
* the specified phase task.
*/