1 /*******************************************************************************
2 * Copyright (c) 2013 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
.linuxtools
.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
.linuxtools
.ctf
.core
.tests
.shared
.CtfTestTrace
;
19 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfTraceException
;
20 import org
.eclipse
.linuxtools
.tmf
.ctf
.core
.CtfTmfEvent
;
21 import org
.eclipse
.linuxtools
.tmf
.ctf
.core
.CtfTmfTrace
;
22 import org
.eclipse
.linuxtools
.tmf
.ctf
.core
.tests
.stubs
.CtfTmfTraceStub
;
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.linuxtools.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 /** UST trace with lots of lost events */
46 /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
48 /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
50 /** Autogenerated Syntetic trace */
52 /** Trace with non-standard field sizes */
56 private final String fPath
;
57 private @Nullable CtfTmfTraceStub fTrace
= null;
59 private CtfTmfTestTrace() {
60 @SuppressWarnings("null")
61 @NonNull String path
= CtfTestTrace
.valueOf(this.name()).getPath();
66 * @return The path of this trace
68 public String
getPath() {
73 * Return a CtfTmfTraceStub object of this test trace. It will be already
76 * Make sure you call {@link #exists()} before calling this!
78 * After being used by unit tests, traces must be properly disposed of by
79 * calling the {@link CtfTmfTestTrace#dispose()} method.
81 * @return A CtfTmfTrace reference to this trace
83 public synchronized CtfTmfTrace
getTrace() {
84 CtfTmfTraceStub trace
= fTrace
;
88 trace
= new CtfTmfTraceStub();
90 trace
.initTrace(null, fPath
, CtfTmfEvent
.class);
91 } catch (TmfTraceException e
) {
92 /* Should not happen if tracesExist() passed */
93 throw new RuntimeException(e
);
100 * Check if the trace actually exists on disk or not.
102 * @return If the trace is present
104 public boolean exists() {
105 return CtfTestTrace
.valueOf(this.name()).exists();
109 * Dispose of the trace
111 public void dispose() {
112 if (fTrace
!= null) {
This page took 0.037384 seconds and 6 git commands to generate.