1 /*******************************************************************************
2 * Copyright (c) 2009 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 * William Bourque (wbourque@gmail.com) - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.linuxtools
.lttng
.event
;
15 import org
.eclipse
.linuxtools
.tmf
.event
.*;
18 * <b><u>LttngEventType</u></b><p>
20 * Lttng specific implementation of the TmfEventType.<p>
22 * This implementation add some attributes to the basic Tmf object.
24 public class LttngEventType
extends TmfEventType
{
26 private static final String DEFAULT_TYPE_ID
= "Kernel Trace"; //$NON-NLS-1$
27 // These should match the column names in LTTng Events Table
28 public static final String TIMESTAMP_LABEL
= "Timestamp"; //$NON-NLS-1$
29 public static final String TRACE_LABEL
= "Trace"; //$NON-NLS-1$
30 public static final String MARKER_LABEL
= "Marker"; //$NON-NLS-1$
31 public static final String CONTENT_LABEL
= "Content"; //$NON-NLS-1$
32 private static final String
[] DEFAULT_LABELS
= {
33 TIMESTAMP_LABEL
, TRACE_LABEL
, MARKER_LABEL
, CONTENT_LABEL
35 public static final LttngEventType DEFAULT_EVENT_TYPE
= new LttngEventType(DEFAULT_TYPE_ID
, DEFAULT_LABELS
);
37 private String tracefileName
= null;
38 private Long cpuId
= null;
39 private String markerName
= null;
40 private int markerId
= -1;
43 * Default Constructor.<p>
46 public LttngEventType() {
51 * Default Constructor.<p>
54 public LttngEventType(String typeId
, String
[] labels
) {
55 super(typeId
, labels
);
59 * Constructor with parameters.<p>
61 * @param thisTracefileName Tracefile (channel) name in Ltt
62 * @param thisMarkerName Marker name in LTT
63 * @param thisMarkerfieldsName MarkerFields related to this marker
65 public LttngEventType(String thisTracefileName
, Long thisCpuId
, String thisMarkerName
, int thisMarkerId
, String
[] thisMarkerfieldsName
) {
66 super( thisTracefileName
+ "/" + thisCpuId
+ "/" + thisMarkerName
, thisMarkerfieldsName
); //$NON-NLS-1$ //$NON-NLS-2$
68 tracefileName
= thisTracefileName
;
70 markerName
= thisMarkerName
;
71 markerId
= thisMarkerId
;
75 * Copy constructor.<p>
77 * @param oldType Type we want to copy from
79 public LttngEventType(LttngEventType oldType
) {
80 this(oldType
.tracefileName
, oldType
.cpuId
, oldType
.markerName
, oldType
.markerId
, oldType
.getLabels());
84 public String
getTracefileName() {
88 public Long
getCpuId() {
92 public String
getMarkerName() {
96 public int getMarkerId() {
103 * @return TypeId (channel/marker) of the object
106 @SuppressWarnings("nls")
107 public String
toString() {
109 // This is used as-it in the events view, so we won't change its format.
110 // ...but maybe we should?
111 return tracefileName
+ "/" + cpuId
.toString() + "/" + markerName
;
115 public LttngEventType
clone() {
116 LttngEventType clone
= (LttngEventType
) super.clone();
117 clone
.tracefileName
= new String(tracefileName
);
118 clone
.cpuId
= new Long(cpuId
);
119 clone
.markerName
= new String(markerName
);
120 clone
.markerId
= markerId
;