simonbence commented on a change in pull request #4821:
URL: https://github.com/apache/nifi/pull/4821#discussion_r579139071



##########
File path: 
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/status/history/ProcessGroupStatusDescriptor.java
##########
@@ -113,16 +113,16 @@ public String getField() {
 
 
     private static long calculateTaskMillis(final ProcessGroupStatus status) {
-        long nanos = 0L;

Review comment:
       Something like this would solve both issues:
   
   ```
   private static long calculateTaskMillis(final ProcessGroupStatus status) {
       return TimeUnit.MILLISECONDS.convert(calculateTaskNanos(status), 
TimeUnit.NANOSECONDS);
   }
   
   private static long calculateTaskNanos(final ProcessGroupStatus status) {
      long nanos = 0L;
   
      for (final ProcessorStatus procStatus : status.getProcessorStatus()) {
          nanos += procStatus.getProcessingNanos();
      }
   
      for (final ProcessGroupStatus childStatus : 
status.getProcessGroupStatus()) {
          nanos += calculateTaskNanos(childStatus);
      }
   
      return nanos;
   }
   ```




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to