1 /*******************************************************************************
2 * Copyright (c) 2014, 2015 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 * Patrick Tasse - Update for renamed target field
13 *******************************************************************************/
15 package org
.eclipse
.tracecompass
.btf
.core
.trace
;
17 import org
.eclipse
.jdt
.annotation
.NonNull
;
18 import org
.eclipse
.tracecompass
.btf
.core
.event
.BtfEvent
;
19 import org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
;
20 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.ITmfEventAspect
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfContentFieldAspect
;
24 import com
.google
.common
.collect
.ImmutableList
;
27 * Columns to use in the BTF event table
29 * @author Alexandre Montplaisir
31 public final class BtfEventAspects
{
33 private BtfEventAspects() {}
35 private static final @NonNull Iterable
<ITmfEventAspect
> BTF_ASPECTS
=
36 NonNullUtils
.checkNotNull(ImmutableList
.of(
37 ITmfEventAspect
.BaseAspects
.TIMESTAMP
,
38 new BtfSourceAspect(),
39 new TmfContentFieldAspect(BtfColumnNames
.SOURCE_INSTANCE
.toString(), BtfColumnNames
.SOURCE_INSTANCE
.toString()),
40 ITmfEventAspect
.BaseAspects
.EVENT_TYPE
,
41 new BtfTargetAspect(),
42 new TmfContentFieldAspect(BtfColumnNames
.TARGET_INSTANCE
.toString(), BtfColumnNames
.TARGET_INSTANCE
.toString()),
43 new TmfContentFieldAspect(BtfColumnNames
.EVENT
.toString(), BtfColumnNames
.EVENT
.toString()),
44 new TmfContentFieldAspect(BtfColumnNames
.NOTES
.toString(), BtfColumnNames
.NOTES
.toString())
48 * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
50 private static class BtfSourceAspect
implements ITmfEventAspect
{
53 public String
getName() {
54 return BtfColumnNames
.SOURCE
.toString();
58 public String
getHelpText() {
63 public String
resolve(ITmfEvent event
) {
64 if (!(event
instanceof BtfEvent
)) {
67 String ret
= ((BtfEvent
) event
).getSource();
68 return (ret
== null ? EMPTY_STRING
: ret
);
73 * The "target" aspect, taking its value from
74 * {@link ITmfEvent#getTarget()}.
76 private static class BtfTargetAspect
implements ITmfEventAspect
{
79 public String
getName() {
80 return BtfColumnNames
.TARGET
.toString();
84 public String
getHelpText() {
89 public String
resolve(ITmfEvent event
) {
90 if (!(event
instanceof BtfEvent
)) {
93 String ret
= ((BtfEvent
) event
).getTarget();
94 return (ret
== null ? EMPTY_STRING
: ret
);
99 * Return the event aspects defined for BTF traces.
101 * @return The aspects
103 public static @NonNull Iterable
<ITmfEventAspect
> getAspects() {
This page took 0.053347 seconds and 5 git commands to generate.