diff options
author | ccalvarin <ccalvarin@google.com> | 2018-02-22 12:41:44 -0800 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-02-22 12:43:37 -0800 |
commit | af79eb49df9fb9a4b5a00194e5068a6cfedf12ae (patch) | |
tree | 89353d1d02053ba8ef8b763898c52ba0d56b1fa3 /src/main/java/com/google/devtools/build/lib/profiler/Profiler.java | |
parent | b3729d8570c6a0c2a8d14dfa393b81862d039a5d (diff) |
Accept Durations in the CriticalPathComponent and Profiler.
RELNOTES: None.
PiperOrigin-RevId: 186658512
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/profiler/Profiler.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/profiler/Profiler.java | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java index f56afc8f9b..0b126555d3 100644 --- a/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java +++ b/src/main/java/com/google/devtools/build/lib/profiler/Profiler.java @@ -30,6 +30,7 @@ import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; +import java.time.Duration; import java.util.ArrayList; import java.util.IdentityHashMap; import java.util.List; @@ -779,41 +780,38 @@ public final class Profiler { } /** - * Used externally to submit simple task (one that does not have any - * subtasks). Depending on the minDuration attribute of the task type, task - * may be just aggregated into the parent task and not stored directly. + * Used externally to submit simple task (one that does not have any subtasks). Depending on the + * minDuration attribute of the task type, task may be just aggregated into the parent task and + * not stored directly. * - * <p>Note that start and stop time must both be acquired from the same clock - * instance. + * <p>Note that start and stop time must both be acquired from the same clock instance. * - * @param startTime task start time - * @param stopTime task stop time + * @param startTimeNanos task start time + * @param stopTimeNanos task stop time * @param type task type - * @param object object associated with that task. Can be String object that - * describes it. + * @param object object associated with that task. Can be String object that describes it. */ - public void logSimpleTask(long startTime, long stopTime, ProfilerTask type, Object object) { + public void logSimpleTask( + long startTimeNanos, long stopTimeNanos, ProfilerTask type, Object object) { if (isActive() && isProfiling(type)) { - logTask(startTime, stopTime - startTime, type, object); + logTask(startTimeNanos, stopTimeNanos - startTimeNanos, type, object); } } /** - * Used externally to submit simple task (one that does not have any - * subtasks). Depending on the minDuration attribute of the task type, task - * may be just aggregated into the parent task and not stored directly. + * Used externally to submit simple task (one that does not have any subtasks). Depending on the + * minDuration attribute of the task type, task may be just aggregated into the parent task and + * not stored directly. * - * @param startTime task start time (obtained through {@link - * Profiler#nanoTimeMaybe()}) + * @param startTimeNanos task start time (obtained through {@link Profiler#nanoTimeMaybe()}) * @param duration the duration of the task * @param type task type - * @param object object associated with that task. Can be String object that - * describes it. + * @param object object associated with that task. Can be String object that describes it. */ - public void logSimpleTaskDuration(long startTime, long duration, ProfilerTask type, - Object object) { + public void logSimpleTaskDuration( + long startTimeNanos, Duration duration, ProfilerTask type, Object object) { if (isActive() && isProfiling(type)) { - logTask(startTime, duration, type, object); + logTask(startTimeNanos, duration.toNanos(), type, object); } } |