Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Commit 168f838

Browse files
reflow InnerEvent.java
Signed-off-by: Matthew Khouzam <[email protected]>
1 parent 24628e8 commit 168f838

File tree

1 file changed

+41
-38
lines changed

1 file changed

+41
-38
lines changed

src/main/java/org/eclipse/tracecompass/trace_event_logger/InnerEvent.java

Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -29,49 +29,52 @@
2929

3030
class InnerEvent {
3131

32-
public static InnerEvent create(LogRecord lRecord) {
33-
if (lRecord instanceof LogUtils.TraceEventLogRecord) {
34-
TraceEventLogRecord rec = (TraceEventLogRecord) lRecord;
35-
double ts = (double) rec.getParameters()[0];
36-
String phase = (String) rec.getParameters()[1];
37-
String pid = (String) rec.getParameters()[2];
38-
String tid = (String) rec.getParameters()[2];
39-
return new InnerEvent(rec, ts, phase, pid, tid);
40-
}
41-
return null;
42-
}
32+
public static InnerEvent create(LogRecord lRecord) {
33+
if (lRecord instanceof LogUtils.TraceEventLogRecord) {
34+
TraceEventLogRecord rec = (TraceEventLogRecord) lRecord;
35+
Object[] parameters = rec.getParameters();
36+
if (parameters != null && parameters.length >= 3) {
37+
double ts = ((Long) parameters[0]).longValue()*0.001;
38+
String phase = String.valueOf(parameters[1]);
39+
String pid = String.valueOf(parameters[2]);
40+
String tid = String.valueOf(parameters[2]);
41+
return new InnerEvent(rec, ts, phase, pid, tid);
42+
}
43+
}
44+
return null;
45+
}
4346

44-
private final LogRecord message;
45-
private final double ts;
46-
private final String tid;
47-
private final String pid;
48-
private final String phase;
47+
private final LogRecord message;
48+
private final double ts;
49+
private final String tid;
50+
private final String pid;
51+
private final String phase;
4952

50-
public InnerEvent(LogRecord message, double ts, String phase, String pid, String tid) {
51-
this.message = message;
52-
this.ts = ts;
53-
this.phase = phase;
54-
this.tid = tid;
55-
this.pid = pid;
56-
}
53+
public InnerEvent(LogRecord message, double ts, String phase, String pid, String tid) {
54+
this.message = message;
55+
this.ts = ts;
56+
this.phase = phase;
57+
this.tid = tid;
58+
this.pid = pid;
59+
}
5760

58-
public String getMessage() {
59-
return message.getMessage();
60-
}
61+
public String getMessage() {
62+
return message.getMessage();
63+
}
6164

62-
public double getTs() {
63-
return ts;
64-
}
65+
public double getTs() {
66+
return ts;
67+
}
6568

66-
public String getTid() {
67-
return tid;
68-
}
69+
public String getTid() {
70+
return tid;
71+
}
6972

70-
public String getPid() {
71-
return pid;
72-
}
73+
public String getPid() {
74+
return pid;
75+
}
7376

74-
public String getPhase() {
75-
return phase;
76-
}
77+
public String getPhase() {
78+
return phase;
79+
}
7780
}

0 commit comments

Comments
 (0)