1 package org
.eclipse
.linuxtools
.lttng
.jni
;
3 import org
.eclipse
.linuxtools
.lttng
.jni
.common
.Jni_C_Pointer_And_Library_Id
;
4 import org
.eclipse
.linuxtools
.lttng
.jni
.exception
.JniException
;
5 import org
.eclipse
.linuxtools
.lttng
.jni
.exception
.JniMarkerFieldException
;
9 * <b><u>JniMarkerField</u></b> <p>
10 * A JniMarkerField is one of the field of the unparsed content (payload) of an event. <p>
12 * Provides access to the marker_field C structure (from LTT) in java.<p>
14 * Most important attributes in the JniMarkerField are :
16 * <li> the name (field) of in String
17 * <li> the marker field format (in C style printf format)
21 * This class is ABSTRACT, you need to extends it to support your specific LTTng version.<p>
24 public abstract class JniMarkerField
extends Jni_C_Common
26 // Internal C pointer of the JniEvent used in LTT
27 private Jni_C_Pointer_And_Library_Id thisMarkerFieldPtr
= new Jni_C_Pointer_And_Library_Id();
29 private String field
= "";
30 private String format
= "";
32 // Native access method
33 protected native String
ltt_getField(int libId
, long markerFieldPtr
);
34 protected native int ltt_getType(int libId
, long markerFieldPtr
);
35 protected native long ltt_getOffset(int libId
, long markerFieldPtr
);
36 protected native long ltt_getSize(int libId
, long markerFieldPtr
);
37 protected native long ltt_getAlignment(int libId
, long markerFieldPtr
);
38 protected native long ltt_getAttributes(int libId
, long markerFieldPtr
);
39 protected native int ltt_getStatic_offset(int libId
, long markerFieldPtr
);
40 protected native String
ltt_getFormat(int libId
, long markerFieldPtr
);
42 // Debug native function, ask LTT to print marker structure
43 protected native void ltt_printMarkerField(int libId
, long markerFieldPtr
);
46 * Default constructor is forbidden
48 protected JniMarkerField() {
52 * Copy constructor.<p>
54 * @param oldMarkerField Reference to the JniMarkerField you want to copy.
56 public JniMarkerField(JniMarkerField oldMarkerField
) {
57 thisMarkerFieldPtr
= oldMarkerField
.getMarkerFieldPtr();
58 field
= oldMarkerField
.getField();
59 format
= oldMarkerField
.getFormat();
63 * Constructor, using pointer.<p>
65 * @param newMarkerFieldPtr Pointer to a C marker_field structure
67 * @exception JniException
69 * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
71 public JniMarkerField(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr
) throws JniException
{
72 thisMarkerFieldPtr
= newMarkerFieldPtr
;
74 // Populate the marker field
75 populateMarkerFieldInformation();
79 * This function populates the marker field data with data from LTT
82 private void populateMarkerFieldInformation() throws JniException
{
83 if (thisMarkerFieldPtr
.getPointer() == NULL
) {
84 throw new JniMarkerFieldException(
85 "Pointer is NULL, trace closed? (populateMarkerInformation)");
87 field
= ltt_getField(thisMarkerFieldPtr
.getLibraryId(), thisMarkerFieldPtr
.getPointer());
88 format
= ltt_getFormat(thisMarkerFieldPtr
.getLibraryId(), thisMarkerFieldPtr
.getPointer());
92 public String
getField() {
96 public String
getFormat() {
101 * Pointer to the marker_field C structure.<p>
103 * The pointer should only be used <u>INTERNALY</u>, do not use these unless you
104 * know what you are doing.<p>
106 * @return The actual (long converted) pointer or NULL
108 * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
110 public Jni_C_Pointer_And_Library_Id
getMarkerFieldPtr() {
111 return thisMarkerFieldPtr
;
115 * Print information for this event. <u>Intended to debug</u><br>
117 * This function will call Ltt to print, so information printed will be the one from
118 * the C structure, not the one populated in java.<p>
120 public void printMarkerFieldInformation() {
121 ltt_printMarkerField(thisMarkerFieldPtr
.getLibraryId(), thisMarkerFieldPtr
.getPointer());
126 * <u>Intended to debug</u><br>
128 * @return Attributes of the object concatenated in String
131 public String
toString() {
132 String returnData
= "";
133 returnData
+= "field : " + field
+ "\n";
134 returnData
+= "format : " + format
+ "\n";