Skip to content

Commit

Permalink
#267 cleanup and fix to metered latency
Browse files Browse the repository at this point in the history
  • Loading branch information
steveblackburn committed Apr 18, 2024
1 parent 2650eb3 commit 2ae32dc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions benchmarks/harness/src/org/dacapo/harness/LatencyReporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,12 @@ public static void reportLatency(String baseLatencyFileName, boolean dumpLatency

// raw latency numbers
int[] latency = new int[events];
float end = 0;
for(int i = 0; i < events; i++) {
latency[i] = (int) ((txend[i] - txbegin[i])/1000);
if (txend[i] > end) {
end = txend[i];
}
}
if (dumpLatencyCSV)
dumpLatencyCSV(latency, txbegin, "simple", baseLatencyFileName, iteration);
Expand All @@ -159,11 +163,12 @@ public static void reportLatency(String baseLatencyFileName, boolean dumpLatency
// synthetically metered --- each query start is evenly spaced, so delays will compound
float[] sorted = Arrays.copyOf(txbegin, events);
Arrays.sort(sorted);
double len = sorted[sorted.length-1]-sorted[0];
double start = sorted[0];
double elapsed = end - start;
double synthstart = 0;
for(int i = 0; i < events; i++) {
int pos = Arrays.binarySearch(sorted, txbegin[i]);
synthstart = sorted[0] + (len*(double) pos / (double) txbegin.length);
double relativePosition = (double) Arrays.binarySearch(sorted, txbegin[i]) / (double) events;
synthstart = start + (elapsed * relativePosition);
int actual = (int) ((txend[i] - txbegin[i])/1000);
int synth = (int) ((txend[i] - synthstart)/1000);
latency[i] = (synth > actual) ? synth : actual;
Expand Down

0 comments on commit 2ae32dc

Please sign in to comment.