-
Notifications
You must be signed in to change notification settings - Fork 10
/
TraceEventEvent.java
99 lines (88 loc) · 2.81 KB
/
TraceEventEvent.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*******************************************************************************
* Copyright (c) 2017 Ericsson
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0 which
* accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.tracecompass.incubator.internal.traceevent.core.event;
import java.util.Collections;
import java.util.logging.Level;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.event.ITmfEventField;
import org.eclipse.tracecompass.tmf.core.event.TmfEvent;
import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfCallsite;
import org.eclipse.tracecompass.tmf.core.event.lookup.ITmfSourceLookup;
import org.eclipse.tracecompass.tmf.core.trace.ITmfTrace;
/**
* Trace compass log event
*
* @author Matthew Khouzam
*/
public class TraceEventEvent extends TmfEvent implements ITmfSourceLookup {
private final @Nullable ITmfCallsite fCallsite;
private final Level fLogLevel;
private @NonNull final String fName;
private final TraceEventField fField;
/**
* Constructor
*/
@Deprecated
public TraceEventEvent() {
super();
fCallsite = null;
fLogLevel = Level.OFF;
fName = StringUtils.EMPTY;
fField = new TraceEventField(StringUtils.EMPTY, 0, "X", null, null, null, null, null, Collections.EMPTY_MAP); //$NON-NLS-1$
}
/**
* Constructor for simple traceEventEvent
*
* @param trace
* the trace
* @param rank
* the rank
* @param field
* the event field, contains all the needed data
*/
public TraceEventEvent(ITmfTrace trace, long rank, TraceEventField field) {
super(trace, rank, trace.createTimestamp(field.getTs()), TraceEventLookup.get(field.getPhase()), field.getContent());
fField = field;
fName = field.getName();
fLogLevel = Level.INFO;
fCallsite = null;
}
@Override
public ITmfEventField getContent() {
return fField.getContent();
}
@Override
public @NonNull String getName() {
return fName;
}
@Override
public @Nullable ITmfCallsite getCallsite() {
return fCallsite;
}
/**
* Get the loglevel of the event
*
* @return the log level
*/
public Level getLevel() {
return fLogLevel;
}
/**
* Get the fields of the event
*
* @return the fields of the event
*/
public TraceEventField getField() {
return fField;
}
}