From 58eb7d154c33a2813abfc0c8470dcf10df6c0f8b Mon Sep 17 00:00:00 2001 From: Alexander Bigerl Date: Tue, 31 Oct 2023 13:19:12 +0100 Subject: [PATCH] make calculation more readable --- .../java/org/aksw/iguana/rp/metrics/impl/AvgQPSMetric.java | 4 ++-- .../java/org/aksw/iguana/rp/metrics/impl/QPSMetric.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) 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 58404c20a..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,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); 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 2619a9f51..449fcb7a6 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 @@ -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{ @@ -175,8 +175,8 @@ private void addToModel(Map 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);