|
29 | 29 |
|
30 | 30 | class InnerEvent { |
31 | 31 |
|
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 | + } |
43 | 46 |
|
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; |
49 | 52 |
|
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 | + } |
57 | 60 |
|
58 | | - public String getMessage() { |
59 | | - return message.getMessage(); |
60 | | - } |
| 61 | + public String getMessage() { |
| 62 | + return message.getMessage(); |
| 63 | + } |
61 | 64 |
|
62 | | - public double getTs() { |
63 | | - return ts; |
64 | | - } |
| 65 | + public double getTs() { |
| 66 | + return ts; |
| 67 | + } |
65 | 68 |
|
66 | | - public String getTid() { |
67 | | - return tid; |
68 | | - } |
| 69 | + public String getTid() { |
| 70 | + return tid; |
| 71 | + } |
69 | 72 |
|
70 | | - public String getPid() { |
71 | | - return pid; |
72 | | - } |
| 73 | + public String getPid() { |
| 74 | + return pid; |
| 75 | + } |
73 | 76 |
|
74 | | - public String getPhase() { |
75 | | - return phase; |
76 | | - } |
| 77 | + public String getPhase() { |
| 78 | + return phase; |
| 79 | + } |
77 | 80 | } |
0 commit comments