tmf: Annotate methods in ITmfEventField
[deliverable/tracecompass.git] / btf / org.eclipse.tracecompass.btf.core / src / org / eclipse / tracecompass / btf / core / event / BTFPayload.java
CommitLineData
ff71e543 1/*******************************************************************************
df854ddb 2 * Copyright (c) 2014, 2015 Ericsson
ff71e543
MK
3 *
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
8 *
9 * Contributors:
10 * Matthew Khouzam - Initial API and implementation
df854ddb 11 * Patrick Tasse - Update empty descriptions
ff71e543
MK
12 *******************************************************************************/
13
7ce90559 14package org.eclipse.tracecompass.btf.core.event;
ff71e543
MK
15
16import java.util.Map;
88424bb7 17import java.util.Map.Entry;
ff71e543 18
fafdd006 19import org.eclipse.jdt.annotation.NonNull;
7ce90559 20import org.eclipse.tracecompass.btf.core.Messages;
2bdf0193 21import org.eclipse.tracecompass.tmf.core.event.TmfEventField;
ff71e543
MK
22
23import com.google.common.collect.ImmutableMap;
24import com.google.common.collect.ImmutableMap.Builder;
25
26/**
27 * BTF event information (Table 7 and 8 from the spec)
28 *
29 * @author Matthew Khouzam
30 */
31public class BTFPayload {
32
df854ddb 33 /** Description subfield name */
fafdd006 34 public static final @NonNull String DESCRIPTION = "description"; //$NON-NLS-1$
df854ddb 35
ff71e543 36 private static final Map<String, String> EVENT_DESCRIPTIONS;
df854ddb 37 private static final String EMPTY = ""; //$NON-NLS-1$
ff71e543 38 private static final Map<String, TmfEventField[]> FIELDS;
df854ddb 39 private static final TmfEventField[] EMPTY_DESCRIPTION = new TmfEventField[] { new TmfEventField(DESCRIPTION, EMPTY, null) };
ff71e543
MK
40
41 static {
42 ImmutableMap.Builder<String, String> builder = new Builder<>();
43 builder.put("activate", Messages.BTFPayload_Activate); //$NON-NLS-1$
44 builder.put("start", Messages.BTFPayload_Start); //$NON-NLS-1$
45 builder.put("preempt", Messages.BTFPayload_Preempt); //$NON-NLS-1$
46 builder.put("resume", Messages.BTFPayload_Resume); //$NON-NLS-1$
47 builder.put("terminate", Messages.BTFPayload_Terminate); //$NON-NLS-1$
48 builder.put("poll", Messages.BTFPayload_Poll); //$NON-NLS-1$
49 builder.put("run", Messages.BTFPayload_Run); //$NON-NLS-1$
50 builder.put("park", Messages.BTFPayload_Park); //$NON-NLS-1$
51 builder.put("poll_parking", Messages.BTFPayload_PollParking); //$NON-NLS-1$
52 builder.put("release_parking", Messages.BTFPayload_ReleaseParking); //$NON-NLS-1$
53 builder.put("wait", Messages.BTFPayload_Wait); //$NON-NLS-1$
54 builder.put("release", Messages.BTFPayload_Release); //$NON-NLS-1$
55 builder.put("deadline", EMPTY); //$NON-NLS-1$
56 builder.put("mpalimitexceeded", Messages.BTFPayload_MapLimitExceeded); //$NON-NLS-1$
57 builder.put("boundedmigration", Messages.BTFPayload_BoundedMigration); //$NON-NLS-1$
58 builder.put("phasemigration", Messages.BTFPayload_PhaseMigration); //$NON-NLS-1$
59 builder.put("fullmigration", Messages.BTFPayload_FullMigration); //$NON-NLS-1$
60 builder.put("enforcedmigration", Messages.BTFPayload_EnforcedMigration); //$NON-NLS-1$
61 // not yet defined
62 builder.put("execute_idle", EMPTY); //$NON-NLS-1$
63 builder.put("processterminate", EMPTY); //$NON-NLS-1$
64 builder.put("idle", EMPTY); //$NON-NLS-1$
65 builder.put("schedule", EMPTY); //$NON-NLS-1$
66 builder.put("trigger", EMPTY); //$NON-NLS-1$
67 builder.put("schedulepoint", EMPTY); //$NON-NLS-1$
68 builder.put("requestsemaphore", EMPTY); //$NON-NLS-1$
69 builder.put("queued", EMPTY); //$NON-NLS-1$
70 builder.put("lock", EMPTY); //$NON-NLS-1$
71 builder.put("assigned", EMPTY); //$NON-NLS-1$
72 builder.put("unlock", EMPTY); //$NON-NLS-1$
73 builder.put("released", EMPTY); //$NON-NLS-1$
74 builder.put("ready", EMPTY); //$NON-NLS-1$
75 builder.put("free", EMPTY); //$NON-NLS-1$
76 builder.put("set_frequence", EMPTY); //$NON-NLS-1$
77 builder.put("processactivate", EMPTY); //$NON-NLS-1$
78 builder.put("execute", EMPTY); //$NON-NLS-1$
79 builder.put("idle_execution", EMPTY); //$NON-NLS-1$
80 builder.put("suspend", EMPTY); //$NON-NLS-1$
81 builder.put("read", EMPTY); //$NON-NLS-1$
82 builder.put("write", EMPTY); //$NON-NLS-1$
83 builder.put("processpolling", EMPTY); //$NON-NLS-1$
84 builder.put("execute_waiting", EMPTY); //$NON-NLS-1$
85 builder.put("wait_postexecution", EMPTY); //$NON-NLS-1$
86 builder.put("waiting", EMPTY); //$NON-NLS-1$
87 builder.put("overfull", EMPTY); //$NON-NLS-1$
88 builder.put("full", EMPTY); //$NON-NLS-1$
89
90 EVENT_DESCRIPTIONS = builder.build();
91 ImmutableMap.Builder<String, TmfEventField[]> fieldBuilder = new Builder<>();
88424bb7
MK
92 for (Entry<String, String> entry : EVENT_DESCRIPTIONS.entrySet()) {
93 fieldBuilder.put(entry.getKey(), new TmfEventField[] { new TmfEventField(DESCRIPTION, entry.getValue(), null) });
ff71e543
MK
94 }
95 FIELDS = fieldBuilder.build();
96 }
97
98 /**
99 * gets the description of a field
100 *
101 * @param key
102 * the field name
103 * @return the description
104 */
105 public static TmfEventField[] getFieldDescription(String key) {
df854ddb
PT
106 TmfEventField[] retVal = FIELDS.get(key);
107 return (retVal == null) ? EMPTY_DESCRIPTION : retVal;
ff71e543
MK
108 }
109
110}
This page took 0.045812 seconds and 5 git commands to generate.