Skip to content

Commit

Permalink
make calculation more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
bigerl committed Oct 31, 2023
1 parent 6071968 commit 58eb7d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ protected void qpsClose(){
Double penalizedAvgQps=0.0;
for(Object queryID : value.keySet()){
Object[] resArr = (Object[]) value.get(queryID);
Double qps = (long)resArr[1]*1.0/((double)resArr[0]/1000.0);
Double penalizedQPS = ((long)resArr[1] + (long)resArr[2]) *1.0/((double)resArr[7]/1000.0);
Double qps = (long) resArr[1]/*success*/ / (double) resArr[0]/*time*/ / 1000.0/*ms to s*/;
Double penalizedQPS = ((long) resArr[1]/*success*/ + (long) resArr[2]/*failure*/) / (double) resArr[7]/*penalizedTime*/ / 1000.0/*ms to s*/;
map.putIfAbsent(queryID, new Number[]{Double.valueOf(0), Long.valueOf(0), Long.valueOf(0), Double.valueOf(0)});

Number[] current =map.get(queryID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ private Properties putResults(Properties extra, double time, long success, long
oldArr[7] = (double) oldArr[7] + penalizedTime;
}
else if(tmp!=null){
Object[] resArr = {time, success, failure, size, timeout, unknown, wrongCode, penalizedTime, queryHash};
Object[] resArr = {time/*0*/, success/*1*/, failure/*2*/, size/*3*/, timeout/*4*/, unknown/*5*/, wrongCode/*6*/, penalizedTime/*7*/, queryHash/*8*/};
tmp.put(queryID, resArr);
}
else{
Expand Down Expand Up @@ -175,8 +175,8 @@ private void addToModel(Map<Object, Object> value, Resource subjectParent, Model
Object[] resArr = (Object[]) value.get(queryID);
if(map!=null)
mergeResults(map, queryID, resArr);
Double qps = (long)resArr[1]*1.0/((double)resArr[0]/1000.0);
Double pqps = ((long)resArr[1] + (long)resArr[2]) * 1.0 / ((double)resArr[7]/1000.0);
Double qps = (long) resArr[1]/*success*/ / (double) resArr[0]/*time*/ / 1000.0/*ms to s*/;
Double pqps = ((long)resArr[1]/*success*/ + (long)resArr[2]/*failure*/) / ((double)resArr[7]/*penalizedTime*//1000.0/*ms to s*/);

Resource query = ResourceFactory.createResource(subjectParent.getURI()+"/"+queryID);
m.add(subjectParent, queryProperty, query);
Expand Down

0 comments on commit 58eb7d1

Please sign in to comment.