[유치수] [NOBTS] server map에서 request count가 맞지 않는 현상 수정.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@1215 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Chisu Yu
2013-02-18 06:56:42 +00:00
parent 6a2935dbba
commit fe5444dc80
2 changed files with 43 additions and 4 deletions
@@ -1,6 +1,5 @@
package com.nhn.hippo.web.vo;
import java.util.Arrays;
import java.util.List;
import com.profiler.common.Histogram;
@@ -81,6 +80,48 @@ public class ResponseHistogram {
return total;
}
public void mergeWith(ResponseHistogram histogram) {
if (!this.equals(histogram)) {
throw new IllegalArgumentException();
}
long[] otherValues = histogram.values;
for (int i = 0; i < values.length; i++) {
values[i] += otherValues[i];
}
this.errorCount += histogram.errorCount;
this.slowCount += histogram.slowCount;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((histogram == null) ? 0 : histogram.hashCode());
result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ResponseHistogram other = (ResponseHistogram) obj;
if (histogram == null) {
if (other.histogram != null)
return false;
} else if (!histogram.equals(other.histogram))
return false;
if (serviceType != other.serviceType)
return false;
return true;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
@@ -49,9 +49,7 @@ public class TerminalStatistics {
public TerminalStatistics mergeWith(TerminalStatistics terminalRequest) {
if (this.equals(terminalRequest)) {
// TODO merge histogram here.
// this.histogram.mergeWith(terminalRequest.getHistogram());
histogram.mergeWith(terminalRequest.getHistogram());
return this;
} else {
throw new IllegalArgumentException("Can't merge with different link.");