1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
9 * Alexandre Montplaisir - Initial API and implementation
10 *******************************************************************************/
12 package org
.eclipse
.tracecompass
.ctf
.core
.tests
.shared
;
16 import org
.eclipse
.tracecompass
.ctf
.core
.CTFException
;
17 import org
.eclipse
.tracecompass
.ctf
.core
.tests
.synthetictraces
.LttngKernelTraceGenerator
;
18 import org
.eclipse
.tracecompass
.ctf
.core
.trace
.CTFTrace
;
21 * Here is the list of the available test traces for the CTF parser.
23 * Make sure you run the traces/get-traces.xml Ant script to download them
26 * @author Alexandre Montplaisir
28 public enum CtfTestTrace
{
30 * Example kernel trace
34 * Tracer: lttng-modules 2.0.0
35 * Event count: 695 319
36 * Kernel version: 3.0.0-16-generic-pae
40 KERNEL("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/kernel", 695319, 10),
43 * Another kernel trace
47 * Tracer: lttng-modules 2.0.0
48 * Event count: 595 641
49 * Kernel version: 3.2.0-18-generic
53 TRACE2("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/trace2", 595641, 11),
56 * Kernel trace with event contexts: pid, ppid, tid, procname,
57 * perf_page_fault, perf_major_faults, perf_minor_faults
61 * Tracer: lttng-modules 2.1.0
62 * Event count: 714 484
63 * Kernel version: 3.8.1
67 KERNEL_VM("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/kernel_vm", 714484, 29),
70 * Kernel trace with all events enabled. Contains 'inet_sock_local_*' events
71 * provided by Francis's Giraldeau lttng-modules addons branch to trace TCP
72 * events. Can be used along with {@link CtfTestTrace#SYNC_DEST} for trace
77 * Tracer: lttng-modules 2.1.0
78 * Event count: 110 771
79 * Kernel version: 3.6.11-1-ARCH
83 SYNC_SRC("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_src", 110771, 23),
86 * Kernel trace with all events enabled. Contains 'inet_sock_local_*' events
87 * provided by Francis's Giraldeau lttng-modules addons branch to trace TCP
88 * events. Can be used along with {@link CtfTestTrace#SYNC_SRC} for trace
93 * Tracer: lttng-modules 2.1.0
95 * Kernel version: 3.6.11-1-ARCH
99 SYNC_DEST("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_dest", 85729, 17),
102 * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
103 * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
104 * be used along with {@link CtfTestTrace#DJANGO_DB} and
105 * {@link CtfTestTrace#DJANGO_HTTPD} for trace synchronization.
109 * Tracer: lttng-modules 2.4.0
110 * Event count: 754 787
111 * Kernel version: 3.13.0-24-generic
115 DJANGO_CLIENT("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-client", 754787, 15),
118 * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
119 * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
120 * be used along with {@link CtfTestTrace#DJANGO_CLIENT} and
121 * {@link CtfTestTrace#DJANGO_HTTPD} for trace synchronization.
125 * Tracer: lttng-modules 2.4.0
126 * Event count: 692 098
127 * Kernel version: 3.13.0-24-generic
131 DJANGO_DB("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-db", 692098, 14),
134 * LTTng Kernel trace. Contains 'inet_sock_local_*' events provided by
135 * Francis's Giraldeau lttng-modules addons branch to trace TCP events. Can
136 * be used along with {@link CtfTestTrace#DJANGO_DB} and
137 * {@link CtfTestTrace#DJANGO_CLIENT} for trace synchronization.
141 * Tracer: lttng-modules 2.4.0
142 * Event count: 779 096
143 * Kernel version:3.13.0-24-generic
147 DJANGO_HTTPD("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-httpd", 779096, 13),
150 * UST trace with lots of lost events
154 * Tracer: lttng-ust 2.3
155 * Event count: 1 000 000, with 967 700 lost events
156 * Trace length: 279ms
159 HELLO_LOST("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/hello-lost", 1000000, 0),
162 * UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions)
166 * Tracer: lttng-ust 2.3
171 CYG_PROFILE("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile", 4977, 10),
174 * UST trace with lttng-ust-cyg-profile-fast events (no address in
179 * Tracer: lttng-ust 2.3
184 CYG_PROFILE_FAST("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile-fast", 5161, 11),
186 /** Autogenerated Syntetic trace */
187 SYNTHETIC_TRACE(LttngKernelTraceGenerator
.getPath(), -1, -1),
189 /** Trace with non-standard field sizes */
190 FUNKY_TRACE("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/funky_trace", 100002, 0),
193 * Kernel Trace with 64 bit aligned headers
197 * Tracer: lttng-kernel 2.5
198 * Event count: 31 556
202 ARM_64_BIT_HEADER("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/bug446190", 31556, 6),
205 * Kernel Trace with flipping endianness
209 * Tracer: lttng-kernel 2.5
210 * Event count: 14 310
214 FLIPPING_ENDIANNESS("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/flipping-endianness", 14310, 41),
217 * Example dynamic scope, timestamp in field, empty stream trace
222 * Event count: 101 003
223 * Kernel version: 4.0.6-1
227 DYNSCOPE("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/ctfwriter_JF8nq3", 101003, 1),
229 /** Set of many traces, do not call getTrace */
230 TRACE_EXPERIMENT("../../ctf/org.eclipse.tracecompass.ctf.core.tests/traces/exp", -1, -1);
232 private final String fPath
;
233 private CTFTrace fTrace
= null;
234 private CTFTrace fTraceFromFile
= null;
235 private final int fNbEvent
;
236 private int fDuration
;
238 private CtfTestTrace(String path
, int nbEvent
, int time
) {
245 * @return The path to the test trace
247 public String
getPath() {
252 * Get the number of events for a trace
254 * @return the number of events, -1 if irrelevant
256 public int getNbEvents() {
261 * Get the duration in seconds of a trace
263 * @return the duration in seconds of a trace, -1 if irrelevant
265 public int getDuration() {
270 * Get a CTFTrace instance of a test trace. Make sure {@link #exists()}
271 * before calling this!
273 * @return The CTFTrace object
274 * @throws CTFException
275 * If the trace cannot be found.
277 public CTFTrace
getTrace() throws CTFException
{
278 if (fTrace
== null) {
279 fTrace
= new CTFTrace(fPath
);
285 * Get a CTFTrace instance created from a File. Make sure {@link #exists()}
286 * before calling this!
288 * @return The CTFTrace object
289 * @throws CTFException
290 * If the trace cannot be found.
292 public CTFTrace
getTraceFromFile() throws CTFException
{
293 if (fTraceFromFile
== null) {
294 fTraceFromFile
= new CTFTrace(new File(fPath
));
296 return fTraceFromFile
;
300 * Check if this test trace actually exists on disk.
302 * @return If the trace exists
304 public boolean exists() {
307 } catch (CTFException e
) {