[fix](profile) fix simply profile because counter may be not same
This commit is contained in:
@ -51,6 +51,9 @@ public class Counter {
|
||||
}
|
||||
|
||||
public void addValue(Counter other) {
|
||||
if (other == null) {
|
||||
return;
|
||||
}
|
||||
this.value += other.value;
|
||||
}
|
||||
|
||||
|
||||
@ -374,7 +374,6 @@ public class RuntimeProfile {
|
||||
counter.addValue(othCounter);
|
||||
}
|
||||
}
|
||||
counter.setValue(0); // Because the time is not accurate, it has been set to 0.
|
||||
}
|
||||
|
||||
private static void removePipelineContext(RuntimeProfile src) {
|
||||
@ -432,6 +431,9 @@ public class RuntimeProfile {
|
||||
|
||||
private static void mergeCounter(RuntimeProfile src, String counterName, Counter counter,
|
||||
LinkedList<Counter> rhsCounter) {
|
||||
if (rhsCounter == null) {
|
||||
return;
|
||||
}
|
||||
if (rhsCounter.size() == 0) {
|
||||
return;
|
||||
}
|
||||
@ -439,15 +441,19 @@ public class RuntimeProfile {
|
||||
Counter maxCounter = new Counter(counter.getType(), counter.getValue());
|
||||
Counter minCounter = new Counter(counter.getType(), counter.getValue());
|
||||
for (Counter cnt : rhsCounter) {
|
||||
if (cnt.getValue() > maxCounter.getValue()) {
|
||||
maxCounter.setValue(cnt.getValue());
|
||||
}
|
||||
if (cnt.getValue() < minCounter.getValue()) {
|
||||
minCounter.setValue(cnt.getValue());
|
||||
if (cnt != null) {
|
||||
if (cnt.getValue() > maxCounter.getValue()) {
|
||||
maxCounter.setValue(cnt.getValue());
|
||||
}
|
||||
if (cnt.getValue() < minCounter.getValue()) {
|
||||
minCounter.setValue(cnt.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
for (Counter cnt : rhsCounter) {
|
||||
counter.addValue(cnt);
|
||||
if (cnt != null) {
|
||||
counter.addValue(cnt);
|
||||
}
|
||||
}
|
||||
long countNumber = rhsCounter.size() + 1;
|
||||
counter.divValue(countNumber);
|
||||
@ -476,7 +482,9 @@ public class RuntimeProfile {
|
||||
return;
|
||||
}
|
||||
for (Counter cnt : rhsCounter) {
|
||||
counter.addValue(cnt);
|
||||
if (cnt != null) {
|
||||
counter.addValue(cnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user