fabriziofortino commented on code in PR #1629:
URL: https://github.com/apache/jackrabbit-oak/pull/1629#discussion_r1713394483


##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/FormattingUtils.java:
##########
@@ -21,6 +21,14 @@
 import java.util.concurrent.TimeUnit;
 
 public class FormattingUtils {
+    public static String formatNanosToSeconds(long nanos) {
+        return formatToSeconds(nanos/1_000_000_000);

Review Comment:
   nitpick: formatting
   ```suggestion
           return formatToSeconds(nanos / 1_000_000_000);
   ```



##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/FormattingUtils.java:
##########
@@ -44,4 +52,12 @@ public static String formatToMillis(Stopwatch stopwatch) {
         String sign = millis < 0 ? "-" : "";
         return String.format("%s%02d:%02d:%02d.%03d", sign, hoursPart, 
minutesPart, secondsPart, millisPart);
     }
+
+    public static double safeComputePercentage(long numerator, long 
denominator) {
+        return denominator == 0 ? -1 : (double) numerator / denominator * 100;
+    }
+
+    public static double safeComputeAverage(long totalTime, long 
numberOfEvents) {
+        return numberOfEvents == 0 ? -1 : ((double)totalTime / numberOfEvents);

Review Comment:
   ```suggestion
           return numberOfEvents == 0 ? -1 : ((double) totalTime / 
numberOfEvents);
   ```



##########
oak-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/FormattingUtils.java:
##########
@@ -21,6 +21,14 @@
 import java.util.concurrent.TimeUnit;
 
 public class FormattingUtils {
+    public static String formatNanosToSeconds(long nanos) {
+        return formatToSeconds(nanos/1_000_000_000);
+    }
+
+    public static String formatMillisToSeconds(long millis) {
+        return formatToSeconds(millis/1000);

Review Comment:
   ```suggestion
           return formatToSeconds(millis / 1000);
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to