[feature](profile) add avg/min/max info in uint counter #27883

This commit is contained in:
Mryange
2023-12-02 17:32:35 +08:00
committed by GitHub
parent 934f37ee4f
commit 654984206b
2 changed files with 12 additions and 1 deletions

View File

@ -68,7 +68,17 @@ public class AggCounter extends Counter {
+ RuntimeProfile.printCounter(min.getValue(), min.getType());
return infoString;
} else {
String infoString = RuntimeProfile.printCounter(sum.getValue(), sum.getType());
Counter avg = new Counter(sum.getType(), sum.getValue());
avg.divValue(number);
String infoString = ""
+ RuntimeProfile.SUM_TIME_PRE
+ RuntimeProfile.printCounter(sum.getValue(), sum.getType()) + ", "
+ RuntimeProfile.AVG_TIME_PRE
+ RuntimeProfile.printCounter(avg.getValue(), avg.getType()) + ", "
+ RuntimeProfile.MAX_TIME_PRE
+ RuntimeProfile.printCounter(max.getValue(), max.getType()) + ", "
+ RuntimeProfile.MIN_TIME_PRE
+ RuntimeProfile.printCounter(min.getValue(), min.getType());
return infoString;
}
}

View File

@ -51,6 +51,7 @@ public class RuntimeProfile {
public static String MAX_TIME_PRE = "max ";
public static String MIN_TIME_PRE = "min ";
public static String AVG_TIME_PRE = "avg ";
public static String SUM_TIME_PRE = "sum ";
private Counter counterTotalTime;
private double localTimePercent;