Skip to content
Snippets Groups Projects
Commit 0e0cc0d2 authored by Christian Wulf's avatar Christian Wulf
Browse files

added BucketTimingsReader

parent b843dc90
No related branches found
No related tags found
No related merge requests found
...@@ -27,3 +27,4 @@ logger "teetime.variant.methodcallWithPorts.stage", INFO ...@@ -27,3 +27,4 @@ logger "teetime.variant.methodcallWithPorts.stage", INFO
logger "teetime.variant.methodcallWithPorts.framework.core.pipe", INFO logger "teetime.variant.methodcallWithPorts.framework.core.pipe", INFO
logger "util.TimingsReader", TRACE, ["FILE"] logger "util.TimingsReader", TRACE, ["FILE"]
logger "util.BucketTimingsReader", TRACE, ["FILE"]
\ No newline at end of file
package util;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.google.common.base.Charsets;
import com.google.common.io.CharSource;
import com.google.common.io.Files;
public class BucketTimingsReader {
private final static Logger LOGGER = LoggerFactory.getLogger(BucketTimingsReader.class);
public static void main(final String[] args) throws IOException {
String fileName = args[0];
Long[] currentTimings = new Long[10000];
int processedLines = 0;
List<Long> buckets = new LinkedList<Long>();
LOGGER.trace("Reading " + fileName);
CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8);
BufferedReader bufferedStream = charSource.openBufferedStream();
String line;
while (null != (line = bufferedStream.readLine())) {
String[] strings = line.split(";");
Long timing = new Long(strings[1]);
currentTimings[processedLines] = timing;
processedLines++;
if (currentTimings.length == processedLines) {
Long aggregatedTimings = StatisticsUtil.calculateAverage(Arrays.asList(currentTimings));
buckets.add(aggregatedTimings);
processedLines = 0;
}
}
LOGGER.trace("#buckets: " + buckets.size());
List<Long> durationsInNs = buckets.subList(buckets.size() / 2, buckets.size());
LOGGER.trace("Calculating quantiles...");
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs);
LOGGER.info(StatisticsUtil.getQuantilesString(quintiles));
long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs);
LOGGER.info("Confidence width: " + confidenceWidth);
}
}
0.0 % : 3370 ns
25.0 % : 3979 ns
50.0 % : 4425 ns
75.0 % : 4900 ns
100.0 % : 15588 ns
Confidence width: 14
Subproject commit 75998aa20b7ec897ec321c1f94192de888f2dc6e Subproject commit 88e1e25f9519b250258c7e5ada30935975ab2d10
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment