Commit b5eb7375 authored by Christian Wulf's avatar Christian Wulf

added configured logger to TimingsReader

parent 645b5d1a
import ch.qos.logback.classic.filter.ThresholdFilter
statusListener(OnConsoleStatusListener)
/*appender("FILE", FileAppender) {
file = "testFile.log"
append = true
appender("FILE", FileAppender) {
file = "src/test/data/load-logs/timings-results.txt"
append = false
filter(ThresholdFilter) {
level = INFO
}
encoder(PatternLayoutEncoder) {
pattern = "%level %logger - %msg%n"
pattern = "%msg%n"
}
}
*/
appender("CONSOLE", ConsoleAppender) {
append = true
encoder(PatternLayoutEncoder) {
pattern = "%d{HH:mm:ss.SSS} %level %logger - %msg%n"
}
}
root WARN, ["CONSOLE"]
//root WARN, ["CONSOLE"]
root WARN
//logger "teetime.variant.methodcallWithPorts.stage", DEBUG, ["CONSOLE"]
logger "teetime.variant.methodcallWithPorts.stage", INFO
\ No newline at end of file
logger "teetime.variant.methodcallWithPorts.stage", INFO
logger "teetime.variant.methodcallWithPorts.examples.kiekerdays.TimingsReader", TRACE, ["CONSOLE", "FILE"]
\ No newline at end of file
......@@ -112,7 +112,7 @@ public class StatisticsUtil {
return quintileValues;
}
public static void removeFirstZeroThroughputs(final List<Long> throughputs) {
public static void removeLeadingZeroThroughputs(final List<Long> throughputs) {
Iterator<Long> iterator = throughputs.iterator();
while (iterator.hasNext()) {
if (iterator.next() == 0) {
......
......@@ -6,6 +6,9 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.StatisticsUtil;
import com.google.common.base.Charsets;
......@@ -15,16 +18,20 @@ import com.google.common.io.Files;
public class TimingsReader {
private final static Logger LOGGER = LoggerFactory.getLogger(TimingsReader.class);
public static void main(final String[] args) throws IOException {
String fileName = args[0];
LOGGER.trace("Reading " + fileName);
CharSource charSource = Files.asCharSource(new File(fileName), Charsets.UTF_8);
ImmutableList<String> lines = charSource.readLines();
System.out.println("#lines: " + lines.size());
LOGGER.trace("#lines: " + lines.size());
List<Long> durationsInNs = new LinkedList<Long>();
LOGGER.trace("Extracting timings from the last half of lines...");
int startIndex = lines.size() / 2;
for (int i = startIndex; i < lines.size(); i++) {
String line = lines.get(i);
......@@ -33,9 +40,14 @@ public class TimingsReader {
durationsInNs.add(timing);
}
System.out.println("Calculating quantiles...");
LOGGER.trace("Removing leading zeros...");
StatisticsUtil.removeLeadingZeroThroughputs(durationsInNs);
LOGGER.trace("Calculating quantiles...");
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(durationsInNs);
System.out.println(StatisticsUtil.getQuantilesString(quintiles));
LOGGER.info(StatisticsUtil.getQuantilesString(quintiles));
long confidenceWidth = StatisticsUtil.calculateConfidenceWidth(durationsInNs);
LOGGER.info("Confidence width: " + confidenceWidth);
}
}
......@@ -69,7 +69,7 @@ public class ChwHomeTraceReconstructionAnalysisTest {
analysis.onTerminate();
}
StatisticsUtil.removeFirstZeroThroughputs(analysis.getThroughputs());
StatisticsUtil.removeLeadingZeroThroughputs(analysis.getThroughputs());
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(analysis.getThroughputs());
System.out.println("Median throughput: " + quintiles.get(0.5) + " elements/time unit");
......@@ -99,7 +99,7 @@ public class ChwHomeTraceReconstructionAnalysisTest {
analysis.onTerminate();
}
StatisticsUtil.removeFirstZeroThroughputs(analysis.getThroughputs());
StatisticsUtil.removeLeadingZeroThroughputs(analysis.getThroughputs());
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(analysis.getThroughputs());
System.out.println("Median throughput: " + quintiles.get(0.5) + " elements/time unit");
......@@ -129,7 +129,7 @@ public class ChwHomeTraceReconstructionAnalysisTest {
analysis.onTerminate();
}
StatisticsUtil.removeFirstZeroThroughputs(analysis.getThroughputs());
StatisticsUtil.removeLeadingZeroThroughputs(analysis.getThroughputs());
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(analysis.getThroughputs());
System.out.println("Median throughput: " + quintiles.get(0.5) + " elements/time unit");
......
......@@ -78,7 +78,7 @@ public class ChwWorkTraceReconstructionAnalysisTest {
TraceEventRecords trace6886 = analysis.getElementCollection().get(1);
assertEquals(6886, trace6886.getTraceMetadata().getTraceId());
StatisticsUtil.removeFirstZeroThroughputs(analysis.getThroughputs());
StatisticsUtil.removeLeadingZeroThroughputs(analysis.getThroughputs());
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(analysis.getThroughputs());
System.out.println("Median throughput: " + quintiles.get(0.5) + " elements/time unit");
}
......@@ -106,7 +106,7 @@ public class ChwWorkTraceReconstructionAnalysisTest {
TraceEventRecords trace1 = analysis.getElementCollection().get(1);
assertEquals(8974347286117089281l, trace1.getTraceMetadata().getTraceId());
StatisticsUtil.removeFirstZeroThroughputs(analysis.getThroughputs());
StatisticsUtil.removeLeadingZeroThroughputs(analysis.getThroughputs());
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(analysis.getThroughputs());
System.out.println("Median throughput: " + quintiles.get(0.5) + " elements/time unit");
......@@ -136,7 +136,7 @@ public class ChwWorkTraceReconstructionAnalysisTest {
TraceEventRecords trace1 = analysis.getElementCollection().get(1);
assertEquals(1, trace1.getTraceMetadata().getTraceId());
StatisticsUtil.removeFirstZeroThroughputs(analysis.getThroughputs());
StatisticsUtil.removeLeadingZeroThroughputs(analysis.getThroughputs());
Map<Double, Long> quintiles = StatisticsUtil.calculateQuintiles(analysis.getThroughputs());
System.out.println("Median throughput: " + quintiles.get(0.5) + " elements/time unit");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment