Save subtasks for Skylark function profiler tasks and then report self time of function calls in HTML output
--
MOS_MIGRATED_REVID=102663672
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/UserDefinedFunction.java b/src/main/java/com/google/devtools/build/lib/syntax/UserDefinedFunction.java
index f50e6ee..1ad455da 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/UserDefinedFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/UserDefinedFunction.java
@@ -56,7 +56,8 @@
env.update(name, arguments[i++]);
}
- long startTimeProfiler = Profiler.nanoTimeMaybe();
+ Profiler.instance().startTask(ProfilerTask.SKYLARK_USER_FN,
+ getLocationPathAndLine() + "#" + getName());
Statement lastStatement = null;
try {
for (Statement stmt : statements) {
@@ -75,10 +76,7 @@
real.registerStatement(lastStatement);
throw real;
} finally {
- Profiler.instance().logSimpleTask(
- startTimeProfiler,
- ProfilerTask.SKYLARK_USER_FN,
- getLocationPathAndLine() + "#" + getName());
+ Profiler.instance().completeTask(ProfilerTask.SKYLARK_USER_FN);
}
return Runtime.NONE;
}