aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Perot2014-07-24 18:58:53 (EDT)
committerMatthew Khouzam2014-07-25 17:27:15 (EDT)
commit0a8c907cbf8ccd1bc37a0ea2e38220051c3be6ed (patch)
treef3d068f2a52b82da5eab42eec25546d1cad1aa89
parent0e5509d414889599168ac3008a0c4de08d71ae03 (diff)
downloadorg.eclipse.linuxtools-0a8c907cbf8ccd1bc37a0ea2e38220051c3be6ed.zip
org.eclipse.linuxtools-0a8c907cbf8ccd1bc37a0ea2e38220051c3be6ed.tar.gz
org.eclipse.linuxtools-0a8c907cbf8ccd1bc37a0ea2e38220051c3be6ed.tar.bz2
pcap: use a larger trace for parser benchmarkingrefs/changes/72/30472/3
The previous trace contained only 640 events, so the parser finished parsing the whole file in a couple of microseconds. Thus, the variation of the results was a large percentage of the total CPU time, which is bad. This new trace contains 100k events (and is totally anonymized), so the benchmark gives more precise results. This allows to really see the influence of future commits on the parsing speed. Change-Id: I45900d5a25160d37ceb4dc6a06175d6a6b74f475 Signed-off-by: Vincent Perot <vincent.perot@ericsson.com> Reviewed-on: https://git.eclipse.org/r/30472 Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapReadBenchmark.java28
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapSeekBenchmark.java4
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core.tests/rsc/get-traces.xml3
-rw-r--r--lttng/org.eclipse.linuxtools.pcap.core.tests/shared/org/eclipse/linuxtools/pcap/core/tests/shared/PcapTestTrace.java3
4 files changed, 23 insertions, 15 deletions
diff --git a/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapReadBenchmark.java b/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapReadBenchmark.java
index 30952ef..f1c4fd7 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapReadBenchmark.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapReadBenchmark.java
@@ -27,10 +27,10 @@ import org.eclipse.test.performance.Performance;
import org.eclipse.test.performance.PerformanceMeter;
import org.junit.Test;
-
/**
- * Benchmark of the Pcap parser for reading a trace. Note: We should get a bigger trace. One
- * that has WAYYYY more events since this current trace is just parsed too fast.
+ * Benchmark of the Pcap parser for reading a trace. Note: We should get a
+ * bigger trace. One that has WAYYYY more events since this current trace is
+ * just parsed too fast.
*
* @author Vincent Perot
*/
@@ -39,13 +39,14 @@ public class PcapReadBenchmark {
private static final String TEST_SUITE_NAME = "Pcap Read Benchmark";
private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
private static final int LOOP_COUNT = 25;
+ private static final int RUN_BETWEEN_COMMIT_COUNT = 15;
/**
* Benchmark reading the pcap trace
*/
@Test
public void testPcapTrace() {
- readTrace(PcapTestTrace.MOSTLY_UDP, "trace-pcap", true);
+ readTrace(PcapTestTrace.BENCHMARK_TRACE, "trace-pcap", true);
}
private static void readTrace(PcapTestTrace testTrace, String testName, boolean inGlobalSummary) {
@@ -62,17 +63,18 @@ public class PcapReadBenchmark {
for (int loop = 0; loop < LOOP_COUNT; loop++) {
pm.start();
try (PcapFile trace = testTrace.getTrace();) {
- trace.seekPacket(0);
- while (trace.hasNextPacket()) {
- Packet packet = trace.parseNextPacket();
- if (packet == null) {
- fail("Test failed at iteration " + loop + " packet " + trace.getCurrentRank());
- return;
+ for (int i = 0; i < RUN_BETWEEN_COMMIT_COUNT; i++) {
+ trace.seekPacket(0);
+ while (trace.hasNextPacket()) {
+ Packet packet = trace.parseNextPacket();
+ if (packet == null) {
+ fail("Test failed at iteration " + loop + '.' + i + ", at packet " + trace.getCurrentRank());
+ return;
+ }
+ /* Do something with the packet because we are awesome */
+ packet.getPayload();
}
- /* Do something with the packet because we are awesome */
- packet.getPayload();
}
-
} catch (IOException | BadPcapFileException | BadPacketException e) {
fail("Test failed at iteration " + loop + ':' + e.getMessage());
}
diff --git a/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapSeekBenchmark.java b/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapSeekBenchmark.java
index c242a91..c8439b2 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapSeekBenchmark.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core.tests/perf/org/eclipse/linuxtools/pcap/core/tests/perf/trace/PcapSeekBenchmark.java
@@ -49,7 +49,7 @@ public class PcapSeekBenchmark {
private static final Random RND = new Random(1000);
private static final int LOOP_COUNT = 25;
- private static final int NB_SEEKS = 500;
+ private static final int NB_SEEKS = 1000000;
private static final String TEST_SUITE_NAME = "Pcap Read & Seek Benchmark (" + NB_SEEKS + " seeks)";
private static final String TEST_ID = "org.eclipse.linuxtools#" + TEST_SUITE_NAME;
@@ -58,7 +58,7 @@ public class PcapSeekBenchmark {
*/
@Test
public void testPcapTrace() {
- readAndSeekTrace(PcapTestTrace.MOSTLY_UDP, "trace-pcap", true);
+ readAndSeekTrace(PcapTestTrace.BENCHMARK_TRACE, "trace-pcap", true);
}
private static void readAndSeekTrace(PcapTestTrace testTrace, String testName, boolean inGlobalSummary) {
diff --git a/lttng/org.eclipse.linuxtools.pcap.core.tests/rsc/get-traces.xml b/lttng/org.eclipse.linuxtools.pcap.core.tests/rsc/get-traces.xml
index c764df0..73d7df9 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core.tests/rsc/get-traces.xml
+++ b/lttng/org.eclipse.linuxtools.pcap.core.tests/rsc/get-traces.xml
@@ -22,6 +22,7 @@ http://wiki.wireshark.org/SampleCaptures
<get ignoreerrors="true" maxtime="20" dest="MostlyTCP.pcap.zip" skipexisting="true" src="http://wiki.eclipse.org/images/8/8d/MostlyTCP.pcap.zip" />
<get ignoreerrors="true" maxtime="20" dest="EmptyPcap.pcap.zip" skipexisting="true" src="http://wiki.eclipse.org/images/c/c1/EmptyPcap.pcap.zip" />
<get ignoreerrors="true" maxtime="20" dest="BadPcapFile.pcap.zip" skipexisting="true" src="http://wiki.eclipse.org/images/5/5e/BadPcapFile.pcap.zip" />
+ <get ignoreerrors="true" maxtime="60" dest="BenchmarkTrace.pcap.zip" skipexisting="true" src="http://wiki.eclipse.org/images/1/12/BenchmarkTrace.pcap.zip" />
<get ignoreerrors="true" maxtime="20" dest="sample-ctf-trace-20120412.tar.bz2" skipexisting="true" src="http://lttng.org/files/samples/sample-ctf-trace-20120412.tar.bz2"/>
<condition property="testSuiteExists">
<and>
@@ -36,6 +37,7 @@ http://wiki.wireshark.org/SampleCaptures
<available file="MostlyTCP.pcap.zip"/>
<available file="EmptyPcap.pcap.zip"/>
<available file="BadPcapFile.pcap.zip"/>
+ <available file="BenchmarkTrace.pcap.zip"/>
<available file="sample-ctf-trace-20120412.tar.bz2"/>
</and>
</condition>
@@ -49,6 +51,7 @@ http://wiki.wireshark.org/SampleCaptures
<unzip src="MostlyTCP.pcap.zip" dest="." />
<unzip src="EmptyPcap.pcap.zip" dest="." />
<unzip src="BadPcapFile.pcap.zip" dest="." />
+ <unzip src="BenchmarkTrace.pcap.zip" dest="." />
<bunzip2 src="sample-ctf-trace-20120412.tar.bz2"/>
<untar src="sample-ctf-trace-20120412.tar" dest="." />
<echo message="Traces extracted successfully"/>
diff --git a/lttng/org.eclipse.linuxtools.pcap.core.tests/shared/org/eclipse/linuxtools/pcap/core/tests/shared/PcapTestTrace.java b/lttng/org.eclipse.linuxtools.pcap.core.tests/shared/org/eclipse/linuxtools/pcap/core/tests/shared/PcapTestTrace.java
index ac79b34..374da46 100644
--- a/lttng/org.eclipse.linuxtools.pcap.core.tests/shared/org/eclipse/linuxtools/pcap/core/tests/shared/PcapTestTrace.java
+++ b/lttng/org.eclipse.linuxtools.pcap.core.tests/shared/org/eclipse/linuxtools/pcap/core/tests/shared/PcapTestTrace.java
@@ -43,6 +43,9 @@ public enum PcapTestTrace {
/** A little-endian trace that contains two packets. */
SHORT_LITTLE_ENDIAN("../org.eclipse.linuxtools.pcap.core.tests/rsc/Short_LittleEndian.pcap"),
+ /** A large trace for benchmarking. */
+ BENCHMARK_TRACE("../org.eclipse.linuxtools.pcap.core.tests/rsc/benchmarkTrace.pcap"),
+
/** A Kernel trace directory. */
KERNEL_DIRECTORY("../org.eclipse.linuxtools.pcap.core.tests/rsc/kernel/"),