btf: Move plugins to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.linuxtools.ctf.core.tests / shared / org / eclipse / linuxtools / ctf / core / tests / shared / CtfTestTrace.java
1 /*******************************************************************************
2 * Copyright (c) 2013 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
7 *
8 * Contributors:
9 * Alexandre Montplaisir - Initial API and implementation
10 *******************************************************************************/
11
12 package org.eclipse.linuxtools.ctf.core.tests.shared;
13
14 import java.io.File;
15
16 import org.eclipse.linuxtools.ctf.core.tests.synthetictraces.LttngKernelTraceGenerator;
17 import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
18 import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
19
20 /**
21 * Here is the list of the available test traces for the CTF parser.
22 *
23 * Make sure you run the traces/get-traces.xml Ant script to download them
24 * first!
25 *
26 * @author Alexandre Montplaisir
27 */
28 public enum CtfTestTrace {
29 /**
30 * Example kernel trace
31 *
32 * <pre>
33 * Trace Size: 13 MB
34 * Tracer: lttng-modules 2.0.0
35 * Event count: 695 319
36 * Kernel version: 3.0.0-16-generic-pae
37 * Trace length: 10s
38 * </pre>
39 */
40 KERNEL("../org.eclipse.linuxtools.ctf.core.tests/traces/kernel"),
41
42 /**
43 * Another kernel trace
44 *
45 * <pre>
46 * Trace Size: 14 MB
47 * Tracer: lttng-modules 2.0.0
48 * Event count: 595 641
49 * Kernel version: 3.2.0-18-generic
50 * Trace length: 11s
51 * </pre>
52 */
53 TRACE2("../org.eclipse.linuxtools.ctf.core.tests/traces/trace2"),
54
55 /**
56 * Kernel trace with event contexts: pid, ppid, tid, procname,
57 * perf_page_fault, perf_major_faults, perf_minor_faults
58 *
59 * <pre>
60 * Trace Size: 56 MB
61 * Tracer: lttng-modules 2.1.0
62 * Event count: 714 484
63 * Kernel version: 3.8.1
64 * Trace length: 29s
65 * </pre>
66 */
67 KERNEL_VM("../org.eclipse.linuxtools.ctf.core.tests/traces/kernel_vm"),
68
69 /**
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
73 * synchronization.
74 *
75 * <pre>
76 * Trace Size: 2.4 MB
77 * Tracer: lttng-modules 2.1.0
78 * Event count: 110 771
79 * Kernel version: 3.6.11-1-ARCH
80 * Trace length: 22s
81 * </pre>
82 */
83 SYNC_SRC("../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_src"),
84
85 /**
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
89 * synchronization.
90 *
91 * <pre>
92 * Trace Size: 1.9 MB
93 * Tracer: lttng-modules 2.1.0
94 * Event count: 85 729
95 * Kernel version: 3.6.11-1-ARCH
96 * Trace length: 17s
97 * </pre>
98 */
99 SYNC_DEST("../org.eclipse.linuxtools.ctf.core.tests/traces/synctraces/scp_dest"),
100
101 /**
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.
106 *
107 * <pre>
108 * Trace Size: 33 MB
109 * Tracer: lttng-modules 2.4.0
110 * Event count: 754 787
111 * Kernel version: 3.13.0-24-generic
112 * Trace length: 15s
113 * </pre>
114 */
115 DJANGO_CLIENT("../org.eclipse.linuxtools.ctf.core.tests/traces/django-benchmark/django-client"),
116
117 /**
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.
122 *
123 * <pre>
124 * Trace Size: 28 MB
125 * Tracer: lttng-modules 2.4.0
126 * Event count: 692 098
127 * Kernel version: 3.13.0-24-generic
128 * Trace length: 14s
129 * </pre>
130 */
131 DJANGO_DB("../org.eclipse.linuxtools.ctf.core.tests/traces/django-benchmark/django-db"),
132
133 /**
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.
138 *
139 * <pre>
140 * Trace Size: 31 MB
141 * Tracer: lttng-modules 2.4.0
142 * Event count: 779 096
143 * Kernel version:3.13.0-24-generic
144 * Trace length: 13s
145 * </pre>
146 */
147 DJANGO_HTTPD("../org.eclipse.linuxtools.ctf.core.tests/traces/django-benchmark/django-httpd"),
148
149 /**
150 * UST trace with lots of lost events
151 *
152 * <pre>
153 * Trace Size: 3.4 MB
154 * Tracer: lttng-ust 2.3
155 * Event count: 1 000 000, with 967 700 lost events
156 * Trace length: 279ms
157 * </pre>
158 */
159 HELLO_LOST("../org.eclipse.linuxtools.ctf.core.tests/traces/hello-lost"),
160
161 /**
162 * UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions)
163 *
164 * <pre>
165 * Trace Size: 236 KB
166 * Tracer: lttng-ust 2.3
167 * Event count: 4 977
168 * Trace length: 10s
169 * </pre>
170 */
171 CYG_PROFILE("../org.eclipse.linuxtools.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile"),
172
173 /**
174 * UST trace with lttng-ust-cyg-profile-fast events (no address in
175 * func_exit)
176 *
177 * <pre>
178 * Trace Size: 184 KB
179 * Tracer: lttng-ust 2.3
180 * Event count: 5 161
181 * Trace length: 11s
182 * </pre>
183 */
184 CYG_PROFILE_FAST("../org.eclipse.linuxtools.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile-fast"),
185
186 /** Autogenerated Syntetic trace */
187 SYNTHETIC_TRACE(LttngKernelTraceGenerator.getPath()),
188
189 /** Trace with non-standard field sizes */
190 FUNKY_TRACE("../org.eclipse.linuxtools.ctf.core.tests/traces/funky_trace"),
191
192 /** Set of many traces, do not call getTrace */
193 TRACE_EXPERIMENT("../org.eclipse.linuxtools.ctf.core.tests/traces/exp");
194
195 private final String fPath;
196 private CTFTrace fTrace = null;
197 private CTFTrace fTraceFromFile = null;
198
199 private CtfTestTrace(String path) {
200 fPath = path;
201 }
202
203 /** @return The path to the test trace */
204 public String getPath() {
205 return fPath;
206 }
207
208 /**
209 * Get a CTFTrace instance of a test trace. Make sure
210 * {@link #exists()} before calling this!
211 *
212 * @return The CTFTrace object
213 * @throws CTFReaderException
214 * If the trace cannot be found.
215 */
216 public CTFTrace getTrace() throws CTFReaderException {
217 if (fTrace == null) {
218 fTrace = new CTFTrace(fPath);
219 }
220 return fTrace;
221 }
222
223 /**
224 * Get a CTFTrace instance created from a File. Make sure
225 * {@link #exists()} before calling this!
226 *
227 * @return The CTFTrace object
228 * @throws CTFReaderException
229 * If the trace cannot be found.
230 */
231 public CTFTrace getTraceFromFile() throws CTFReaderException {
232 if (fTraceFromFile == null) {
233 fTraceFromFile = new CTFTrace(new File(fPath));
234 }
235 return fTraceFromFile;
236 }
237
238 /**
239 * Check if this test trace actually exists on disk.
240 *
241 * @return If the trace exists
242 */
243 public boolean exists() {
244 try {
245 getTrace();
246 } catch (CTFReaderException e) {
247 return false;
248 }
249 return true;
250 }
251 }
This page took 0.035637 seconds and 5 git commands to generate.