Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the calculation of the penalized metrics #224

Merged
merged 4 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,16 @@ 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]*1.0/((double)resArr[7]/1000.0);
map.putIfAbsent(queryID, new Number[]{Double.valueOf(0), Long.valueOf(0), Double.valueOf(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);
Long succ = (long)resArr[1]+(Long)current[1];
Long fail = (long)resArr[2]+(Long)current[2];
Double time = (double)resArr[0]+(Double)current[0];
Double penTime = (double)resArr[7]+(Double)current[2];
map.put(queryID, new Number[]{time, succ, penTime});
Double penTime = (double)resArr[7]+(Double)current[3];
map.put(queryID, new Number[]{time, succ, fail, penTime});
avgQps+=qps;
penalizedAvgQps+=penalizedQPS;
}
Expand All @@ -71,7 +72,7 @@ protected void qpsClose(){
Double penalizedAvgQps=0.0;
for(Object queryID : map.keySet()) {
Double qps = (Long)map.get(queryID)[1]*1.0/((Double)map.get(queryID)[0]/1000.0);
Double penalizedQPS = (long)map.get(queryID)[1]*1.0/((double)map.get(queryID)[2]/1000.0);
Double penalizedQPS = ((long)map.get(queryID)[1] + (long)map.get(queryID)[2]) *1.0/((double)map.get(queryID)[3]/1000.0);
avgQps+=qps;
penalizedAvgQps+=penalizedQPS;
}
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]*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