1 /*******************************************************************************
2 * Copyright (c) 2013, 2014 Ericsson
4 * All rights reserved. This program and the accompanying materials are
5 * made available under the terms of the Eclipse Public License v1.0 which
6 * accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.ctf
.core
.tests
.shared
;
15 import org
.eclipse
.jdt
.annotation
.NonNull
;
16 import org
.eclipse
.jdt
.annotation
.NonNullByDefault
;
17 import org
.eclipse
.jdt
.annotation
.Nullable
;
18 import org
.eclipse
.tracecompass
.ctf
.core
.tests
.shared
.CtfTestTrace
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.exceptions
.TmfTraceException
;
20 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.event
.CtfTmfEvent
;
21 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.tests
.stubs
.CtfTmfTraceStub
;
22 import org
.eclipse
.tracecompass
.tmf
.ctf
.core
.trace
.CtfTmfTrace
;
25 * Available CTF TMF test traces. Kind-of-extends {@link CtfTestTrace}.
27 * To run tests using these, you first need to run the "get-traces.[xml|sh]"
28 * script located under lttng/org.eclipse.tracecompass.ctf.core.tests/traces/ .
30 * @author Alexandre Montplaisir
33 public enum CtfTmfTestTrace
{
34 /** Example kernel trace */
36 /** Another kernel trace */
38 /** Kernel trace with event contexts */
40 /** Trace synchronization: source trace */
42 /** Trace synchronization: destination trace */
44 /** Trace synchronization (case 2): django client trace */
46 /** Trace synchronization (case 2): django db trace */
48 /** Trace synchronization (case 2): django web server trace */
50 /** UST trace with lots of lost events */
52 /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
54 /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
56 /** Autogenerated Syntetic trace */
58 /** Trace with non-standard field sizes */
62 private final String fPath
;
63 private @Nullable CtfTmfTraceStub fTrace
= null;
65 private CtfTmfTestTrace() {
66 @SuppressWarnings("null")
67 @NonNull String path
= CtfTestTrace
.valueOf(this.name()).getPath();
72 * @return The path of this trace
74 public String
getPath() {
79 * Return a CtfTmfTraceStub object of this test trace. It will be already
82 * Make sure you call {@link #exists()} before calling this!
84 * After being used by unit tests, traces must be properly disposed of by
85 * calling the {@link CtfTmfTestTrace#dispose()} method.
87 * @return A CtfTmfTrace reference to this trace
89 public synchronized CtfTmfTrace
getTrace() {
90 CtfTmfTraceStub trace
= fTrace
;
94 trace
= new CtfTmfTraceStub();
96 trace
.initTrace(null, fPath
, CtfTmfEvent
.class);
97 } catch (TmfTraceException e
) {
98 /* Should not happen if tracesExist() passed */
99 throw new RuntimeException(e
);
106 * Check if the trace actually exists on disk or not.
108 * @return If the trace is present
110 public boolean exists() {
111 return CtfTestTrace
.valueOf(this.name()).exists();
115 * Dispose of the trace
117 public void dispose() {
118 if (fTrace
!= null) {
This page took 0.033152 seconds and 5 git commands to generate.