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
.linuxtools
.ctf
.core
.tests
.shared
.CtfTestTrace
;
16 import org
.eclipse
.linuxtools
.tmf
.core
.exceptions
.TmfTraceException
;
17 import org
.eclipse
.linuxtools
.tmf
.ctf
.core
.CtfTmfEvent
;
18 import org
.eclipse
.linuxtools
.tmf
.ctf
.core
.CtfTmfTrace
;
19 import org
.eclipse
.linuxtools
.tmf
.ctf
.core
.tests
.stubs
.CtfTmfTraceStub
;
22 * Available CTF TMF test traces. Kind-of-extends {@link CtfTestTrace}.
24 * To run tests using these, you first need to run the "get-traces.[xml|sh]"
25 * script located under lttng/org.eclipse.linuxtools.ctf.core.tests/traces/ .
27 * @author Alexandre Montplaisir
29 public enum CtfTmfTestTrace
{
30 /** Example kernel trace */
32 /** Another kernel trace */
34 /** Kernel trace with event contexts */
36 /** Trace synchronization: source trace */
38 /** Trace synchronization: destination trace */
40 /** UST trace with lots of lost events */
42 /** UST trace with lttng-ust-cyg-profile events (aka -finstrument-functions) */
44 /** UST trace with lttng-ust-cyg-profile-fast events (no address in func_exit) */
46 /** Autogenerated Syntetic trace */
48 /** Trace with non-standard field sizes */
52 private final String fPath
;
53 private CtfTmfTraceStub fTrace
= null;
55 private CtfTmfTestTrace() {
56 /* This makes my head spin */
57 fPath
= CtfTestTrace
.valueOf(this.name()).getPath();
61 * @return The path of this trace
63 public String
getPath() {
68 * Return a CtfTmfTraceStub object of this test trace. It will be already
71 * Make sure you call {@link #exists()} before calling this!
73 * After being used by unit tests, traces must be properly disposed of by
74 * calling the {@link CtfTmfTestTrace#dispose()} method.
76 * @return A CtfTmfTrace reference to this trace
78 public synchronized CtfTmfTrace
getTrace() {
82 fTrace
= new CtfTmfTraceStub();
84 fTrace
.initTrace(null, fPath
, CtfTmfEvent
.class);
85 } catch (TmfTraceException e
) {
86 /* Should not happen if tracesExist() passed */
87 throw new RuntimeException(e
);
93 * Check if the trace actually exists on disk or not.
95 * @return If the trace is present
97 public boolean exists() {
98 return CtfTestTrace
.valueOf(this.name()).exists();
102 * Dispose of the trace
104 public void dispose() {
105 if (fTrace
!= null) {
This page took 0.044344 seconds and 6 git commands to generate.