Commit | Line | Data |
---|---|---|
9ac63b5b | 1 | /******************************************************************************* |
ed902a2b | 2 | * Copyright (c) 2013, 2014 Ericsson |
9ac63b5b AM |
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 | ||
f357bcd4 | 12 | package org.eclipse.tracecompass.ctf.core.tests.shared; |
9ac63b5b AM |
13 | |
14 | import java.io.File; | |
15 | ||
680f9173 | 16 | import org.eclipse.tracecompass.ctf.core.CTFException; |
f357bcd4 | 17 | import org.eclipse.tracecompass.ctf.core.tests.synthetictraces.LttngKernelTraceGenerator; |
f357bcd4 | 18 | import org.eclipse.tracecompass.ctf.core.trace.CTFTrace; |
9ac63b5b AM |
19 | |
20 | /** | |
21 | * Here is the list of the available test traces for the CTF parser. | |
22 | * | |
a74472c3 AM |
23 | * Make sure you run the traces/get-traces.xml Ant script to download them |
24 | * first! | |
9ac63b5b AM |
25 | * |
26 | * @author Alexandre Montplaisir | |
27 | */ | |
28 | public enum CtfTestTrace { | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 40 | KERNEL("../org.eclipse.tracecompass.ctf.core.tests/traces/kernel", 695319, 10), |
6e4358bd | 41 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 53 | TRACE2("../org.eclipse.tracecompass.ctf.core.tests/traces/trace2", 595641, 11), |
6e4358bd | 54 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 67 | KERNEL_VM("../org.eclipse.tracecompass.ctf.core.tests/traces/kernel_vm", 714484, 29), |
6e4358bd | 68 | |
34bb48f2 GB |
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 | |
0f2a4641 | 80 | * Trace length: 23s |
34bb48f2 GB |
81 | * </pre> |
82 | */ | |
0f2a4641 | 83 | SYNC_SRC("../org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_src", 110771, 23), |
6e4358bd | 84 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 99 | SYNC_DEST("../org.eclipse.tracecompass.ctf.core.tests/traces/synctraces/scp_dest", 85729, 17), |
6e4358bd | 100 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 115 | DJANGO_CLIENT("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-client", 754787, 15), |
ef3a9bfd | 116 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 131 | DJANGO_DB("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-db", 692098, 14), |
ef3a9bfd | 132 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 147 | DJANGO_HTTPD("../org.eclipse.tracecompass.ctf.core.tests/traces/django-benchmark/django-httpd", 779096, 13), |
ef3a9bfd | 148 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 159 | HELLO_LOST("../org.eclipse.tracecompass.ctf.core.tests/traces/hello-lost", 1000000, 0), |
6e4358bd | 160 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 171 | CYG_PROFILE("../org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile", 4977, 10), |
6e4358bd | 172 | |
34bb48f2 GB |
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 | */ | |
0f2a4641 | 184 | CYG_PROFILE_FAST("../org.eclipse.tracecompass.ctf.core.tests/traces/cyg-profile/glxgears-cyg-profile-fast", 5161, 11), |
d957af45 | 185 | |
c2fa72bc | 186 | /** Autogenerated Syntetic trace */ |
0f2a4641 | 187 | SYNTHETIC_TRACE(LttngKernelTraceGenerator.getPath(), -1, -1), |
d957af45 | 188 | |
9ab4ca26 | 189 | /** Trace with non-standard field sizes */ |
0f2a4641 | 190 | FUNKY_TRACE("../org.eclipse.tracecompass.ctf.core.tests/traces/funky_trace", 100002, 0), |
43d15218 | 191 | |
5002d6c4 MK |
192 | /** |
193 | * Kernel Trace with 64 bit aligned headers | |
194 | * | |
195 | * <pre> | |
196 | * Trace Size: 1.1 MB | |
197 | * Tracer: lttng-kernel 2.5 | |
0f2a4641 | 198 | * Event count: 31 556 |
5002d6c4 MK |
199 | * Trace length: 6 s |
200 | * </pre> | |
201 | */ | |
0f2a4641 | 202 | ARM_64_BIT_HEADER("../org.eclipse.tracecompass.ctf.core.tests/traces/bug446190", 31556, 6), |
5002d6c4 | 203 | |
de405a2e MAL |
204 | /** |
205 | * Kernel Trace with flipping endianness | |
206 | * | |
207 | * <pre> | |
208 | * Trace Size: 327 KB | |
209 | * Tracer: lttng-kernel 2.5 | |
210 | * Event count: 14 310 | |
211 | * Trace length: 41 s | |
212 | * </pre> | |
213 | */ | |
214 | FLIPPING_ENDIANNESS("../org.eclipse.tracecompass.ctf.core.tests/traces/flipping-endianness", 14310, 41), | |
215 | ||
43d15218 | 216 | /** Set of many traces, do not call getTrace */ |
0f2a4641 | 217 | TRACE_EXPERIMENT("../org.eclipse.tracecompass.ctf.core.tests/traces/exp", -1, -1); |
9ac63b5b | 218 | |
9ac63b5b AM |
219 | private final String fPath; |
220 | private CTFTrace fTrace = null; | |
221 | private CTFTrace fTraceFromFile = null; | |
0f2a4641 MK |
222 | private final int fNbEvent; |
223 | private int fDuration; | |
9ac63b5b | 224 | |
0f2a4641 | 225 | private CtfTestTrace(String path, int nbEvent, int time) { |
9ac63b5b | 226 | fPath = path; |
0f2a4641 MK |
227 | fNbEvent = nbEvent; |
228 | fDuration = time; | |
9ac63b5b AM |
229 | } |
230 | ||
231 | /** @return The path to the test trace */ | |
232 | public String getPath() { | |
233 | return fPath; | |
234 | } | |
235 | ||
236 | /** | |
0f2a4641 MK |
237 | * Get the number of events for a trace |
238 | * | |
239 | * @return the number of events, -1 if irrelevant | |
240 | */ | |
241 | public int getNbEvents() { | |
242 | return fNbEvent; | |
243 | } | |
244 | ||
245 | /** | |
246 | * Get the duration in seconds of a trace | |
247 | * | |
248 | * @return the duration in seconds of a trace, -1 if irrelevant | |
249 | */ | |
250 | public int getDuration() { | |
251 | return fDuration; | |
252 | } | |
253 | ||
254 | /** | |
255 | * Get a CTFTrace instance of a test trace. Make sure {@link #exists()} | |
256 | * before calling this! | |
9ac63b5b AM |
257 | * |
258 | * @return The CTFTrace object | |
680f9173 | 259 | * @throws CTFException |
9ac63b5b AM |
260 | * If the trace cannot be found. |
261 | */ | |
680f9173 | 262 | public CTFTrace getTrace() throws CTFException { |
9ac63b5b AM |
263 | if (fTrace == null) { |
264 | fTrace = new CTFTrace(fPath); | |
265 | } | |
266 | return fTrace; | |
267 | } | |
268 | ||
269 | /** | |
0f2a4641 MK |
270 | * Get a CTFTrace instance created from a File. Make sure {@link #exists()} |
271 | * before calling this! | |
9ac63b5b AM |
272 | * |
273 | * @return The CTFTrace object | |
680f9173 | 274 | * @throws CTFException |
9ac63b5b AM |
275 | * If the trace cannot be found. |
276 | */ | |
680f9173 | 277 | public CTFTrace getTraceFromFile() throws CTFException { |
9ac63b5b AM |
278 | if (fTraceFromFile == null) { |
279 | fTraceFromFile = new CTFTrace(new File(fPath)); | |
280 | } | |
281 | return fTraceFromFile; | |
282 | } | |
283 | ||
284 | /** | |
285 | * Check if this test trace actually exists on disk. | |
286 | * | |
287 | * @return If the trace exists | |
288 | */ | |
289 | public boolean exists() { | |
290 | try { | |
291 | getTrace(); | |
680f9173 | 292 | } catch (CTFException e) { |
9ac63b5b AM |
293 | return false; |
294 | } | |
295 | return true; | |
296 | } | |
297 | } |