1 /*******************************************************************************
2 * Copyright (c) 2014 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 * Matthew Khouzam - Initial API and implementation
11 * Alexandre Montplaisir - Update to new Event Table API
12 *******************************************************************************/
14 package org
.eclipse
.tracecompass
.btf
.core
.trace
;
16 import org
.eclipse
.jdt
.annotation
.NonNull
;
17 import org
.eclipse
.tracecompass
.btf
.core
.event
.BtfEvent
;
18 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
19 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.ITmfEventAspect
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfEventFieldAspect
;
22 import com
.google
.common
.collect
.ImmutableList
;
25 * Columns to use in the BTF event table
27 * @author Alexandre Montplaisir
29 public final class BtfEventAspects
{
31 private BtfEventAspects() {}
33 @SuppressWarnings("null")
34 private static final @NonNull Iterable
<ITmfEventAspect
> BTF_ASPECTS
= ImmutableList
.of(
35 ITmfEventAspect
.BaseAspects
.TIMESTAMP
,
36 new BtfSourceAspect(),
37 new BtfSourceInstanceAspect(),
38 ITmfEventAspect
.BaseAspects
.EVENT_TYPE
,
39 new BtfTargetAspect(),
40 new BtfTargetInstanceAspect(),
46 * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
48 private static class BtfSourceAspect
implements ITmfEventAspect
{
51 public String
getName() {
52 return BtfColumnNames
.SOURCE
.toString();
56 public String
getHelpText() {
61 public String
resolve(ITmfEvent event
) {
62 if (!(event
instanceof BtfEvent
)) {
65 String ret
= ((BtfEvent
) event
).getSource();
66 return (ret
== null ? EMPTY_STRING
: ret
);
70 public String
getFilterId() {
71 return ITmfEvent
.EVENT_FIELD_SOURCE
;
76 * The "source instance" aspect, whose value comes from the field of the
79 private static class BtfSourceInstanceAspect
extends TmfEventFieldAspect
{
80 public BtfSourceInstanceAspect() {
81 super(BtfColumnNames
.SOURCE_INSTANCE
.toString(),
82 BtfColumnNames
.SOURCE_INSTANCE
.toString());
87 * The "target" aspect, taking its value from
88 * {@link ITmfEvent#getReference()}.
90 private static class BtfTargetAspect
implements ITmfEventAspect
{
93 public String
getName() {
94 return BtfColumnNames
.TARGET
.toString();
98 public String
getHelpText() {
103 public String
resolve(ITmfEvent event
) {
104 if (!(event
instanceof BtfEvent
)) {
107 String ret
= ((BtfEvent
) event
).getReference();
108 return (ret
== null ? EMPTY_STRING
: ret
);
112 public String
getFilterId() {
113 return ITmfEvent
.EVENT_FIELD_REFERENCE
;
118 * The "target instance" aspect, whose value comes from the field of the
121 private static class BtfTargetInstanceAspect
extends TmfEventFieldAspect
{
122 public BtfTargetInstanceAspect() {
123 super(BtfColumnNames
.TARGET_INSTANCE
.toString(),
124 BtfColumnNames
.TARGET_INSTANCE
.toString());
129 * The "event" aspect, whose value comes from the field of the same name.
131 private static class BtfEventAspect
extends TmfEventFieldAspect
{
132 public BtfEventAspect() {
133 super(BtfColumnNames
.EVENT
.toString(),
134 BtfColumnNames
.EVENT
.toString());
139 * The "notes" column, whose value comes from the field of the same name, if
142 private static class BtfNotesAspect
extends TmfEventFieldAspect
{
143 public BtfNotesAspect() {
144 super(BtfColumnNames
.NOTES
.toString(),
145 BtfColumnNames
.NOTES
.toString());
150 * Return the event aspects defined for BTF traces.
152 * @return The aspects
154 public static Iterable
<ITmfEventAspect
> getAspects() {
This page took 0.050959 seconds and 5 git commands to generate.