Use task type to count input discovery instead of comparing descriptions.
... to get free speedup!
PiperOrigin-RevId: 627015083
Change-Id: I09ef23dae4f0e2763017754685ee89c744e940ab
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 1ba954c..d5fde8f 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
@@ -808,9 +808,8 @@
private static final SilentCloseable NOP = () -> {};
- private boolean countAction(ProfilerTask type, TaskData taskData) {
- return type == ProfilerTask.ACTION
- || (type == ProfilerTask.INFO && "discoverInputs".equals(taskData.description));
+ private boolean countAction(ProfilerTask type) {
+ return type == ProfilerTask.ACTION || type == ProfilerTask.DISCOVER_INPUTS;
}
public void completeTask(long startTimeNanos, ProfilerTask type, String description) {
@@ -862,7 +861,7 @@
writer.enqueue(data);
}
long endTimeNanos = data.startTimeNanos + data.durationNanos;
- if (actionCountTimeSeries != null && countAction(data.type, data)) {
+ if (actionCountTimeSeries != null && countAction(data.type)) {
synchronized (this) {
actionCountTimeSeries.addRange(
Duration.ofNanos(data.startTimeNanos), Duration.ofNanos(endTimeNanos));
diff --git a/src/main/java/com/google/devtools/build/lib/profiler/ProfilerTask.java b/src/main/java/com/google/devtools/build/lib/profiler/ProfilerTask.java
index bbc0c3f..6e52c0e 100644
--- a/src/main/java/com/google/devtools/build/lib/profiler/ProfilerTask.java
+++ b/src/main/java/com/google/devtools/build/lib/profiler/ProfilerTask.java
@@ -23,6 +23,7 @@
public enum ProfilerTask {
PHASE("build phase marker"),
ACTION("action processing"),
+ DISCOVER_INPUTS("discover inputs"),
ACTION_CHECK("action dependency checking", Threshold.TEN_MILLIS),
ACTION_LOCK("action resource lock", Threshold.TEN_MILLIS),
ACTION_UPDATE("update action information", Threshold.TEN_MILLIS),
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
index 0fb59c1..f599087 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
@@ -855,7 +855,8 @@
action.prepareInputDiscovery();
state.preparedInputDiscovery = true;
}
- try (SilentCloseable c = Profiler.instance().profile(ProfilerTask.INFO, "discoverInputs")) {
+ try (SilentCloseable c =
+ Profiler.instance().profile(ProfilerTask.DISCOVER_INPUTS, "discoverInputs")) {
state.discoveredInputs =
skyframeActionExecutor.discoverInputs(
action,