diff --git a/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/AvgQPSMetric.java b/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/AvgQPSMetric.java index b729cf06b..3c468a9e4 100644 --- a/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/AvgQPSMetric.java +++ b/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/AvgQPSMetric.java @@ -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; } @@ -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; } diff --git a/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/QPSMetric.java b/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/QPSMetric.java index ffdb6f775..68e34bbf1 100644 --- a/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/QPSMetric.java +++ b/iguana.resultprocessor/src/main/java/org/aksw/iguana/rp/metrics/impl/QPSMetric.java @@ -90,7 +90,8 @@ private Properties putResults(Properties extra, double time, long success, long Properties tmp = getDataFromContainer(extra); if(tmp!=null && tmp.containsKey(queryID)){ Object[] oldArr = (Object[]) tmp.get(queryID); - oldArr[0] = (double) oldArr[0] + time; + if (success > 0) + oldArr[0] = (double) oldArr[0] + time; oldArr[1] = (long) oldArr[1] + success; oldArr[2] = (long) oldArr[2] + failure; if((long)oldArr[3] 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); diff --git a/pom.xml b/pom.xml index a235a22cd..34cf99d60 100644 --- a/pom.xml +++ b/pom.xml @@ -41,7 +41,7 @@ ${major.version}.${minor.version} 3 3 - 2 + 3