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
.NonNullByDefault
;
18 import org
.eclipse
.jdt
.annotation
.Nullable
;
19 import org
.eclipse
.tracecompass
.btf
.core
.event
.BtfEvent
;
20 import org
.eclipse
.tracecompass
.common
.core
.NonNullUtils
;
21 import org
.eclipse
.tracecompass
.tmf
.core
.event
.ITmfEvent
;
22 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.ITmfEventAspect
;
23 import org
.eclipse
.tracecompass
.tmf
.core
.event
.aspect
.TmfContentFieldAspect
;
25 import com
.google
.common
.collect
.ImmutableList
;
28 * Columns to use in the BTF event table
30 * @author Alexandre Montplaisir
33 public final class BtfEventAspects
{
35 private BtfEventAspects() {}
37 private static final Iterable
<ITmfEventAspect
> BTF_ASPECTS
=
38 NonNullUtils
.checkNotNull(ImmutableList
.of(
39 ITmfEventAspect
.BaseAspects
.TIMESTAMP
,
40 new BtfSourceAspect(),
41 new TmfContentFieldAspect(BtfColumnNames
.SOURCE_INSTANCE
.toString(), BtfColumnNames
.SOURCE_INSTANCE
.toString()),
42 ITmfEventAspect
.BaseAspects
.EVENT_TYPE
,
43 new BtfTargetAspect(),
44 new TmfContentFieldAspect(BtfColumnNames
.TARGET_INSTANCE
.toString(), BtfColumnNames
.TARGET_INSTANCE
.toString()),
45 new TmfContentFieldAspect(BtfColumnNames
.EVENT
.toString(), BtfColumnNames
.EVENT
.toString()),
46 new TmfContentFieldAspect(BtfColumnNames
.NOTES
.toString(), BtfColumnNames
.NOTES
.toString())
50 * The "source" aspect, whose value comes from {@link ITmfEvent#getSource()}
52 private static class BtfSourceAspect
implements ITmfEventAspect
{
55 public String
getName() {
56 return BtfColumnNames
.SOURCE
.toString();
60 public String
getHelpText() {
65 public @Nullable String
resolve(ITmfEvent event
) {
66 if (!(event
instanceof BtfEvent
)) {
69 String ret
= ((BtfEvent
) event
).getSource();
70 return (ret
== null ? EMPTY_STRING
: ret
);
75 * The "target" aspect, taking its value from
76 * {@link ITmfEvent#getTarget()}.
78 private static class BtfTargetAspect
implements ITmfEventAspect
{
81 public String
getName() {
82 return BtfColumnNames
.TARGET
.toString();
86 public String
getHelpText() {
91 public @Nullable String
resolve(ITmfEvent event
) {
92 if (!(event
instanceof BtfEvent
)) {
95 String ret
= ((BtfEvent
) event
).getTarget();
96 return (ret
== null ? EMPTY_STRING
: ret
);
101 * Return the event aspects defined for BTF traces.
103 * @return The aspects
105 public static Iterable
<ITmfEventAspect
> getAspects() {
This page took 0.032608 seconds and 5 git commands to generate.