Mercurial > stress-tester
changeset 583:a2c21f45a503
minor
author | Devel 1 |
---|---|
date | Mon, 02 Oct 2017 09:52:48 +0200 |
parents | 41c917297b0e |
children | 5f07f000f00f |
files | stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java |
diffstat | 1 files changed, 24 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java Mon Oct 02 09:48:09 2017 +0200 +++ b/stress-tester-reporter/src/main/java/com/passus/st/reporter/ReporterImpl.java Mon Oct 02 09:52:48 2017 +0200 @@ -16,6 +16,12 @@ */ public class ReporterImpl implements Reporter { + public static final String REQ_FILE = "requests.csv"; + public static final String RESP_FILE = "responses.csv"; + public static final String REQ_RESP_FILE = "merged.csv"; + public static final String EMITTER_FILE = "emitter.csv"; + public static final String CHARSET = "UTF-8"; + private final PrintWriter reqFile; private final PrintWriter respFile; private final PrintWriter reqRespFile; @@ -28,10 +34,10 @@ } public ReporterImpl(boolean merge) throws IOException { - reqFile = new PrintWriter("requests.csv", "UTF-8"); - respFile = new PrintWriter("responses.csv", "UTF-8"); - reqRespFile = merge ? new PrintWriter("all.csv", "UTF-8") : null; - emitterFile = new PrintWriter("emitter.csv", "UTF-8"); + reqFile = new PrintWriter(REQ_FILE, CHARSET); + respFile = new PrintWriter(RESP_FILE, CHARSET); + reqRespFile = merge ? new PrintWriter(REQ_RESP_FILE, CHARSET) : null; + emitterFile = new PrintWriter(EMITTER_FILE, CHARSET); this.merge = merge; } @@ -48,7 +54,7 @@ this.verbose = verbose; } - private static void addValue(StringBuilder builder, Object value) { + public static void addValue(StringBuilder builder, Object value) { if (value != null) { builder.append('"'); builder.append(value.toString()); @@ -172,24 +178,24 @@ addValue(builder, collection.getStartTimestamp()); addValue(builder, collection.getEndTimestamp()); - MetricRecord emitterMetric = findMetric(collection, "emitter"); - if (emitterMetric != null) { - Map<CharSequence, Object> emitterFields = emitterMetric.getFields(); - addValue(builder, emitterFields.get(new Utf8("receivedBytes"))); - addValue(builder, emitterFields.get(new Utf8("sentBytes"))); - addValue(builder, emitterFields.get(new Utf8("establishedConnections"))); - addValue(builder, emitterFields.get(new Utf8("closedConnections"))); - addValue(builder, emitterFields.get(new Utf8("bindErrors"))); + MetricRecord metric = findMetric(collection, "emitter"); + if (metric != null) { + Map<CharSequence, Object> fields = metric.getFields(); + addValue(builder, fields.get(new Utf8("receivedBytes"))); + addValue(builder, fields.get(new Utf8("sentBytes"))); + addValue(builder, fields.get(new Utf8("establishedConnections"))); + addValue(builder, fields.get(new Utf8("closedConnections"))); + addValue(builder, fields.get(new Utf8("bindErrors"))); } else { builder.append(";;;;;"); } - emitterMetric = findMetric(collection, "pcapSource"); - if (emitterMetric != null) { - Map<CharSequence, Object> emitterFields = emitterMetric.getFields(); - addValue(builder, emitterFields.get(new Utf8("frames"))); - addValue(builder, emitterFields.get(new Utf8("tcpPackets"))); + metric = findMetric(collection, "pcapSource"); + if (metric != null) { + Map<CharSequence, Object> fields = metric.getFields(); + addValue(builder, fields.get(new Utf8("frames"))); + addValue(builder, fields.get(new Utf8("tcpPackets"))); } else { builder.append(";;"); }