Merge branch 'GP-0_ryanmkurtz_PR-8915_belmegatron_getTaskTimesString'

(Closes #8915, Closes #8914)
This commit is contained in:
Ryan Kurtz
2026-02-05 10:44:59 -05:00
@@ -4,9 +4,9 @@
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -1183,18 +1183,15 @@ public class AutoAnalysisManager {
} }
/** /**
* Get the time taken by a named task * {@return the time taken by a named task, or {@code -1} if the named task could not be found}
* The names of tasks that have run can be retrieved using getTimedTasks * <p>
* The names of tasks that have run can be retrieved using {@link #getTimedTasks()}.
*
* @param map the times by task names * @param map the times by task names
* @param taskName the task name * @param taskName the task name
* @return the time taken by a named task
*/ */
public long getTaskTime(Map<String, Long> map, String taskName) { public long getTaskTime(Map<String, Long> map, String taskName) {
Long time = map.get(taskName); return map.getOrDefault(taskName, -1L);
if (time == null) {
return -1;
}
return time.longValue();
} }
/** /**
@@ -1249,9 +1246,7 @@ public class AutoAnalysisManager {
long taskTime = getTaskTime(timedTasks, element); long taskTime = getTaskTime(timedTasks, element);
double totalTime = taskTime / 1000.00; double totalTime = taskTime / 1000.00;
String partTime = (((int) (totalTime * 1000.0)) % 1000) + ""; String secString = String.format("%.3f secs", totalTime);
String secString =
((int) totalTime) + "." + "000".substring(partTime.length()) + partTime + " secs";
int testLen = element.length() + secString.length(); int testLen = element.length() + secString.length();
if (testLen > spacer.length()) { if (testLen > spacer.length()) {
testLen = spacer.length() - 5; testLen = spacer.length() - 5;