--- /dev/null
+#Mon Feb 01 15:09:25 EST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: %Bundle-Name
+Bundle-Name: Jni
Bundle-SymbolicName: org.eclipse.linuxtools.lttng.jni
-Bundle-Version: 0.2.0.qualifier
+Bundle-Version: 0.2.0
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.linuxtools.lttng.jni,
org.eclipse.linuxtools.lttng.jni.common,
org.eclipse.linuxtools.lttng.jni.factory,
org.eclipse.linuxtools.lttng.jni_v2_3,
org.eclipse.linuxtools.lttng.jni_v2_5
-Bundle-Localization: plugin
-Bundle-Vendor: %Bundle-Vendor
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
- .,\
- plugin.properties
+ .
import java.util.HashMap;
import org.eclipse.linuxtools.lttng.jni.common.JniTime;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniEventException;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.exception.JniNoSuchEventException;
* </ul>
* Note that the JniEvent content is not directly accessibe and should be obtained
* using the parseAllFields() or parseFieldBy...() methods.
- *
- * <b>NOTE</b><p>
- * This class is ABSTRACT, you need to extends it to support your specific LTTng version.<p>
- *
*/
-public abstract class JniEvent extends Jni_C_Common implements Comparable<JniEvent>
-{
+public abstract class JniEvent extends Jni_C_Common implements Comparable<JniEvent> {
// Variables to detect if the event have been filled at least once
// this make possible the detection of "uninitialized" struct in Ltt
- // Can be "EOK", "ERANGE" or "EPERM" (defined in Jni_C_Common)
+ // Can be "EOK", "ERANGE" or "EPERM" (defined in Jaf_C_Common)
private int eventState = EPERM; // Start with EPERM to ensure sanity
// Internal C pointer of the JniEvent used in LTT
- private Jni_C_Pointer_And_Library_Id thisEventPtr = new Jni_C_Pointer_And_Library_Id();
+ private Jni_C_Pointer thisEventPtr = new Jni_C_Pointer();
// Reference to the parent tracefile
private JniTracefile parentTracefile = null;
// Note that all type have been scaled up as there is no "unsigned" in java
// This might be a problem about "unsigned long" as there is no equivalent
// in java
- private Jni_C_Pointer_And_Library_Id tracefilePtr = new Jni_C_Pointer_And_Library_Id();
+ private Jni_C_Pointer tracefilePtr = new Jni_C_Pointer();
private JniTime eventTime = null;
// These methods need a tracefile pointer, instead of a event pointer
- protected native int ltt_readNextEvent(int libId, long tracefilePtr);
- protected native int ltt_seekEvent(int libId, long tracefilePtr, JniTime givenTime);
- protected native int ltt_positionToFirstEvent(int libId, long tracefilePtr);
+ protected native int ltt_readNextEvent(long tracefilePtr);
+ protected native int ltt_seekEvent(long tracefilePtr, JniTime givenTime);
+ protected native int ltt_positionToFirstEvent(long tracefilePtr);
// Native access functions
- protected native long ltt_getTracefilePtr(int libId, long eventPtr);
- protected native long ltt_getBlock(int libId, long eventPtr);
- protected native long ltt_getOffset(int libId, long eventPtr);
- protected native long ltt_getCurrentTimestampCounter(int libId, long eventPtr);
- protected native long ltt_getTimestamp(int libId, long eventPtr);
- protected native int ltt_getEventMarkerId(int libId, long eventPtr);
- protected native long ltt_getNanosencondsTime(int libId, long eventPtr);
- protected native void ltt_feedEventTime(int libId, long eventPtr, JniTime eventTime);
- protected native long ltt_getEventDataSize(int libId, long eventPtr);
- protected native long ltt_getEventSize(int libId, long eventPtr);
- protected native int ltt_getCount(int libId, long eventPtr);
- protected native long ltt_getOverflowNanoSeconds(int libId, long eventPtr);
+ protected native long ltt_getTracefilePtr(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getBlock(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getOffset(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getCurrentTimestampCounter(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getTimestamp(long eventPtr);
+ protected native int ltt_getEventMarkerId(long eventPtr);
+ protected native long ltt_getNanosencondsTime(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native void ltt_feedEventTime(long eventPtr, JniTime eventTime);
+ protected native long ltt_getEventDataSize(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getEventSize(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native int ltt_getCount(long eventPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getOverflowNanoSeconds(long eventPtr);
- // This method can be use to obtain the content as byte array
- // Warning : untested!
- protected native void ltt_getDataContent(int libId, long eventPtr, long dataSize, byte[] returnedContent);
+ // This method an event pointer
+ protected native void ltt_getDataContent(long eventPtr, long dataSize, byte[] returnedContent);
// Debug native function, ask LTT to print event structure
- protected native void ltt_printEvent(int libId, long eventPtr);
+ protected native void ltt_printEvent(long eventPtr);
+
+ static {
+ System.loadLibrary("lttvtraceread_loader");
+ }
+
/**
* Default constructor is forbidden
*/
+ @SuppressWarnings("unused")
protected JniEvent() {
- }
+ };
/**
* Copy constructor.<p>
*
* @exception JniException
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniMarker
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTracefile
*/
- public JniEvent(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
-
+ public JniEvent(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+
// Basic test to make sure we didn't get null/empty value
if ((newEventPtr.getPointer() == NULL)
|| (newMarkersMap == null)
*
* If the move fails, the event will not get populated and the last event data will still be available.
*
- * @return LTT read status, as defined in Jni_C_Constant.
+ * @return LTT read status, as defined in Jni_C_Common.
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Constant
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Common
*/
public int readNextEvent() {
// Ask Ltt to read the next event for this particular tracefile
- eventState = ltt_readNextEvent(tracefilePtr.getLibraryId(), tracefilePtr.getPointer() );
+ eventState = ltt_readNextEvent( tracefilePtr.getPointer() );
// If the event state is sane populate it
if (eventState == EOK) {
populateEventInformation();
*
* If the seek fails, the event will not get populated and the last event data will still be available.<p>
*
- * @return LTT read status, as defined in Jni_C_Constant
+ * @return LTT read status, as defined in Jni_C_Common
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Constant
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Common
*/
public int seekToTime(JniTime seekTime) {
// Ask Ltt to read the next event for this particular tracefile
- eventState = ltt_seekEvent(tracefilePtr.getLibraryId(), tracefilePtr.getPointer(), seekTime);
-
+ eventState = ltt_seekEvent(tracefilePtr.getPointer(), seekTime);
+
// If the event state is sane populate it
if (eventState == EOK) {
populateEventInformation();
*
* If the seek fails, we will seek back to the previous position, so the event will stay in a consistent state.<p>
*
- * @return LTT read status, as defined in Jni_C_Constant
+ * @return LTT read status, as defined in Jni_C_Common
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Constant
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Common
*/
public int seekOrFallBack(JniTime seekTime) {
// Save the old time
*
* A status different of EOK probably means there is no event associated to this tracefile.
*
- * @return LTT read status, as defined in Jni_C_Constant
+ * @return LTT read status, as defined in Jni_C_Common
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Constant
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Common
*/
public int positionToFirstEvent() {
- eventState = ltt_positionToFirstEvent(tracefilePtr.getLibraryId(), tracefilePtr.getPointer());
+ eventState = ltt_positionToFirstEvent(tracefilePtr.getPointer());
return eventState;
}
*
* @return Reference to the marker for this tracefile's event or null if none.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniMarker
*/
public JniMarker requestEventMarker() {
return markersMap.get(getEventMarkerId());
public byte[] requestEventContent() {
byte dataContent[] = new byte[(int) getEventDataSize()];
- ltt_getDataContent(thisEventPtr.getLibraryId(), thisEventPtr.getPointer(), getEventDataSize(), dataContent);
+ ltt_getDataContent(thisEventPtr.getPointer(), getEventDataSize(), dataContent);
return dataContent;
}
*
* @return Reference to the JniMarker object for this event or null if none.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniMarker
*/
public String requestEventSource() {
// *** TODO ***
*
* @return Object that contain the parsed payload
*
- * @see org.eclipse.linuxtools.lttng.jni.JniParser
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniParser
*/
public Object parseFieldById(int fieldId) {
return JniParser.parseField(this, fieldId);
*
* @return Object that contain the parsed payload
*
- * @see org.eclipse.linuxtools.lttng.jni.JniParser
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniParser
*/
public Object parseFieldByName(String fieldName) {
return JniParser.parseField(this, fieldName);
*
* @return HashMap<String, Object> which is the parsedContent objects and their name as key.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniParser
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniParser
*/
public HashMap<String, Object> parseAllFields() {
return JniParser.parseAllFields(this);
*/
private void populateEventInformation() {
// We need to save the time, as it is not a primitive (can't be dynamically called in getter)
- eventTime.setTime(ltt_getNanosencondsTime(thisEventPtr.getLibraryId(), thisEventPtr.getPointer()));
+ eventTime.setTime(ltt_getNanosencondsTime(thisEventPtr.getPointer() ));
}
public JniTime getEventTime() {
// *** To get better performance, all getter belows call LTT directly ****
// That way, we can avoid copying data into memory
public int getEventMarkerId() {
- return ltt_getEventMarkerId(thisEventPtr.getLibraryId(), thisEventPtr.getPointer());
+ return ltt_getEventMarkerId(thisEventPtr.getPointer());
}
public long getEventDataSize() {
- return ltt_getEventDataSize(thisEventPtr.getLibraryId(), thisEventPtr.getPointer());
+ return ltt_getEventDataSize(thisEventPtr.getPointer());
}
public HashMap<Integer, JniMarker> getMarkersMap() {
*
* @return The actual (long converted) pointer or NULL.
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public Jni_C_Pointer_And_Library_Id getTracefilePtr() {
- return new Jni_C_Pointer_And_Library_Id(thisEventPtr.getLibraryId(), ltt_getTracefilePtr(thisEventPtr.getLibraryId(), thisEventPtr.getPointer()) );
+ public Jni_C_Pointer getTracefilePtr() {
+ return new Jni_C_Pointer( ltt_getTracefilePtr(thisEventPtr.getPointer()) );
}
/**
*
* @return The actual (long converted) pointer or NULL.
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public Jni_C_Pointer_And_Library_Id getEventPtr() {
+ public Jni_C_Pointer getEventPtr() {
return thisEventPtr;
}
*
* @return The parent tracefile
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTracefile
*/
public JniTracefile getParentTracefile() {
return parentTracefile;
*
* This function will call Ltt to print, so information printed will be
* the one from the C structure, not the one populated in java.<p>
+ *
+ * This function will not throw but will complain loudly if pointer is NULL.
*/
public void printEventInformation() {
- ltt_printEvent(thisEventPtr.getLibraryId(), thisEventPtr.getPointer());
+
+ // If null pointer, print a warning!
+ if (thisEventPtr.getPointer() == NULL) {
+ printlnC("Pointer is NULL, cannot print. (printEventInformation)");
+ }
+ else {
+ ltt_printEvent(thisEventPtr.getPointer());
+ }
}
/**
return returnData;
}
-
}
* William Bourque (wbourque@gmail.com) - Initial API and implementation
*******************************************************************************/
+
import java.util.ArrayList;
import java.util.HashMap;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.exception.JniMarkerException;
* <li> an overview of the marker format (in C style printf format)
* <li> a reference to an ArrayList that contains MarkerFields object of this JniMarker
* </ul>
- *
- * <b>NOTE</b><p>
- * This class is ABSTRACT, you need to extends it to support your specific LTTng version.<br>
- * Please look at the abstract functions to override at the bottom of this file.<p>
- *
*/
public abstract class JniMarker extends Jni_C_Common
{
// Internal C pointer of the JniEvent used in LTT
- private Jni_C_Pointer_And_Library_Id thisMarkerPtr = new Jni_C_Pointer_And_Library_Id();
+ private Jni_C_Pointer thisMarkerPtr = new Jni_C_Pointer();
private String name = "";
private String formatOverview = "";
private ArrayList<JniMarkerField> markerFieldsArrayList = null;
// Native access method
- protected native String ltt_getName(int libId, long markerPtr);
- protected native String ltt_getFormatOverview(int libId, long markerPtr);
- protected native long ltt_getSize(int libId, long markerPtr);
- protected native short ltt_getLargestAlign(int libId, long markerPtr);
- protected native short ltt_getIntSize(int libId, long markerPtr);
- protected native short ltt_getLongSize(int libId, long markerPtr);
- protected native short ltt_getPointerSize(int libId, long markerPtr);
- protected native short ltt_getSize_tSize(int libId, long markerPtr);
- protected native void ltt_getAllMarkerFields(int libId, long tracePtr);
- protected native short ltt_getAlignement(int libId, long markerPtr);
- protected native long ltt_getNextMarkerPtr(int libId, long markerPtr);
+ protected native String ltt_getName(long markerPtr);
+ protected native String ltt_getFormatOverview(long markerPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getSize(long markerPtr);
+ @SuppressWarnings("unused")
+ protected native short ltt_getLargestAlign(long markerPtr);
+ @SuppressWarnings("unused")
+ protected native short ltt_getIntSize(long markerPtr);
+ @SuppressWarnings("unused")
+ protected native short ltt_getLongSize(long markerPtr);
+ @SuppressWarnings("unused")
+ protected native short ltt_getPointerSize(long markerPtr);
+ @SuppressWarnings("unused")
+ protected native short ltt_getSize_tSize(long markerPtr);
+ protected native void ltt_getAllMarkerFields(long tracePtr);
+ @SuppressWarnings("unused")
+ protected native short ltt_getAlignement(long markerPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getNextMarkerPtr(long markerPtr);
// Debug native function, ask LTT to print marker structure
- protected native void ltt_printMarker(int libId, long markerPtr);
+ protected native void ltt_printMarker(long markerPtr);
+
+ static {
+ System.loadLibrary("lttvtraceread_loader");
+ }
/*
* Default constructor is forbidden
*/
+ @SuppressWarnings("unused")
protected JniMarker() {
}
*
* @exception JniException
*/
- public JniMarker(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException {
+ public JniMarker(Jni_C_Pointer newMarkerPtr) throws JniException {
thisMarkerPtr = newMarkerPtr;
markerFieldsArrayList = new ArrayList<JniMarkerField>();
markerFieldsHashMap = new HashMap<String, JniMarkerField>();
if (thisMarkerPtr.getPointer() == NULL) {
throw new JniMarkerException("Pointer is NULL, trace closed? (populateMarkerInformatOverviewion)");
} else {
- name = ltt_getName(thisMarkerPtr.getLibraryId(), thisMarkerPtr.getPointer());
- formatOverview = ltt_getFormatOverview(thisMarkerPtr.getLibraryId(), thisMarkerPtr.getPointer());
+ name = ltt_getName( thisMarkerPtr.getPointer() );
+ formatOverview = ltt_getFormatOverview( thisMarkerPtr.getPointer() );
// To fill the markerFieldArray is a bit different
- ltt_getAllMarkerFields(thisMarkerPtr.getLibraryId(), thisMarkerPtr.getPointer());
+ ltt_getAllMarkerFields( thisMarkerPtr.getPointer() );
}
}
* @param markerName Name of the parent marker
* @param markerFieldPtr C Pointer (converted in long) to marker_field C Structure
*/
- private void addMarkerFieldFromC(String markerFieldName, long markerFieldPtr) {
- // Create a new Jni_markerField object and insert it in the map
+ @SuppressWarnings("unused")
+ private void addMarkerFieldFromC(String markerFieldName, long markerFieldPtr) {
+ // Create a new Jaf_markerField object and insert it in the map
// the maker field fill itself with LTT data while being constructed
try {
- JniMarkerField newMarkerField = allocateNewJniMarkerField( new Jni_C_Pointer_And_Library_Id(thisMarkerPtr.getLibraryId(), markerFieldPtr));
+ JniMarkerField newMarkerField = allocateNewJniMarkerField( new Jni_C_Pointer(markerFieldPtr) );
markerFieldsArrayList.add(newMarkerField);
markerFieldsHashMap.put(markerFieldName, newMarkerField);
} catch (JniException e) {
- printlnC(thisMarkerPtr.getLibraryId(), "Failed to add marker field " + markerFieldName + " to marker fields list!(addMarkerFieldFromC)\n\tException raised : " + e.toString() );
+ printlnC("Failed to add marker field " + markerFieldName + " to marker fields list!(addMarkerFieldFromC)\n\tException raised : " + e.toString() );
}
}
*
* @return The actual (long converted) pointer or NULL
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public Jni_C_Pointer_And_Library_Id getMarkerPtr() {
+ public Jni_C_Pointer getMarkerPtr() {
return thisMarkerPtr;
}
* This function will not throw but will complain loudly if pointer is NULL
*/
public void printMarkerInformation() {
- ltt_printMarker(thisMarkerPtr.getLibraryId(), thisMarkerPtr.getPointer());
+
+ // If null pointer, print a warning!
+ if (thisMarkerPtr.getPointer() == NULL) {
+ printlnC("Pointer is NULL, cannot print. (printMarkerInformation)");
+ } else {
+ ltt_printMarker(thisMarkerPtr.getPointer());
+ }
}
/**
Object[] allMarkersField = markerFieldsArrayList.toArray();
for (int pos = 0; pos < allMarkersField.length; pos++) {
- printlnC(thisMarkerPtr.getLibraryId(), allMarkersField[pos].toString());
+ printlnC(allMarkersField[pos].toString());
}
}
returnData += "name : " + name + "\n";
returnData += "formatOverview : " + formatOverview + "\n";
- returnData += "markerFieldArrayList : " + markerFieldsArrayList.hashCode() + " (size : " + markerFieldsArrayList.size() + " )" + "\n";
-
+ returnData += "markerFieldArrayList : " + markerFieldsArrayList.toArray() + "\n";
+
return returnData;
}
- // ****************************
- // **** ABSTRACT FUNCTIONS ****
- // You MUST override those in your version specific implementation
-
-
- /**
- * Function place holder to allocate a new JniMarkerField.<p>
- * <br>
- * JniMarkerField constructor is non overridable so we need another overridable function to return the correct version of JniMarkerField.<br>
- * Effect of this function should be the same (allocate a fresh new JniMarkerField).<br>
- * <br>
- * <b>!! Override this with you version specific implementation.</b><br>
- *
- * @param newMarkerFieldPtr The pointer and library id of an already opened marker_field C Structure
- *
- * @return The newly allocated JniMarkerField of the correct version
- *
- * @throws JniException The construction (allocation) failed.
- *
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
- * @see org.eclipse.linuxtools.lttng.jni.JniMarkerField
- */
- public abstract JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException;
+ public abstract JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer newMarkerFieldPtr) throws JniException;
}
package org.eclipse.linuxtools.lttng.jni;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.exception.JniMarkerFieldException;
* <li> the name (field) of in String
* <li> the marker field format (in C style printf format)
* </ul>
- *
- * <b>NOTE</b><p>
- * This class is ABSTRACT, you need to extends it to support your specific LTTng version.<p>
- *
*/
public abstract class JniMarkerField extends Jni_C_Common
{
// Internal C pointer of the JniEvent used in LTT
- private Jni_C_Pointer_And_Library_Id thisMarkerFieldPtr = new Jni_C_Pointer_And_Library_Id();
+ private Jni_C_Pointer thisMarkerFieldPtr = new Jni_C_Pointer();
private String field = "";
private String format = "";
// Native access method
- protected native String ltt_getField(int libId, long markerFieldPtr);
- protected native int ltt_getType(int libId, long markerFieldPtr);
- protected native long ltt_getOffset(int libId, long markerFieldPtr);
- protected native long ltt_getSize(int libId, long markerFieldPtr);
- protected native long ltt_getAlignment(int libId, long markerFieldPtr);
- protected native long ltt_getAttributes(int libId, long markerFieldPtr);
- protected native int ltt_getStatic_offset(int libId, long markerFieldPtr);
- protected native String ltt_getFormat(int libId, long markerFieldPtr);
+ protected native String ltt_getField(long markerFieldPtr);
+ @SuppressWarnings("unused")
+ protected native int ltt_getType(long markerFieldPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getOffset(long markerFieldPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getSize(long markerFieldPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getAlignment(long markerFieldPtr);
+ @SuppressWarnings("unused")
+ protected native long ltt_getAttributes(long markerFieldPtr);
+ @SuppressWarnings("unused")
+ protected native int ltt_getStatic_offset(long markerFieldPtr);
+ protected native String ltt_getFormat(long markerFieldPtr);
// Debug native function, ask LTT to print marker structure
- protected native void ltt_printMarkerField(int libId, long markerFieldPtr);
+ protected native void ltt_printMarkerField(long markerFieldPtr);
+
+ static {
+ System.loadLibrary("lttvtraceread_loader");
+ }
/*
* Default constructor is forbidden
*/
+ @SuppressWarnings("unused")
protected JniMarkerField() {
}
* @param newMarkerFieldPtr Pointer to a C marker_field structure
*
* @exception JniException
- *
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
*/
- public JniMarkerField(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException {
+ public JniMarkerField(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
thisMarkerFieldPtr = newMarkerFieldPtr;
// Populate the marker field
throw new JniMarkerFieldException(
"Pointer is NULL, trace closed? (populateMarkerInformation)");
} else {
- field = ltt_getField(thisMarkerFieldPtr.getLibraryId(), thisMarkerFieldPtr.getPointer());
- format = ltt_getFormat(thisMarkerFieldPtr.getLibraryId(), thisMarkerFieldPtr.getPointer());
+ field = ltt_getField(thisMarkerFieldPtr.getPointer());
+ format = ltt_getFormat(thisMarkerFieldPtr.getPointer());
}
}
*
* @return The actual (long converted) pointer or NULL
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public Jni_C_Pointer_And_Library_Id getMarkerFieldPtr() {
+ public Jni_C_Pointer getMarkerFieldPtr() {
return thisMarkerFieldPtr;
}
*
* This function will call Ltt to print, so information printed will be the one from
* the C structure, not the one populated in java.<p>
+ *
+ * This function will not throw but will complain loudly if pointer is NULL
*/
public void printMarkerFieldInformation() {
- ltt_printMarkerField(thisMarkerFieldPtr.getLibraryId(), thisMarkerFieldPtr.getPointer());
+
+ // If null pointer, print a warning!
+ if (thisMarkerFieldPtr.getPointer() == NULL) {
+ printlnC("Pointer is NULL, cannot print. (printMarkerFieldInformation)");
+ } else {
+ ltt_printMarkerField(thisMarkerFieldPtr.getPointer());
+ }
}
/**
return returnData;
}
-
}
* JniParser is used to parse an event payload into something usable.<p>
*
* All methods are static, the parser shouldn't be instantiated.
- *
- * <b>NOTE</b><p>
- * This class is ABSTRACT, you need to extends it to support your specific LTTng version.<p>
- *
*/
public abstract class JniParser extends Jni_C_Common
{
- protected static native void ltt_getParsedData(int libId, ParsedObjectContent parseddata, long eventPtr, long markerFieldPtr);
+ protected static native void ltt_getParsedData(ParsedObjectContent parseddata, long eventPtr, long markerFieldPtr);
+
+ static {
+ System.loadLibrary("lttvtraceread_loader");
+ }
// *** HACK ***
// We cannot use "Object" directly as java does not support swapping primitive value
*
* @return An Object that contain the JniEvent payload parsed by the C, or null, if if was impossible to parse (i.e., wrong position)
*
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
static public Object parseField(JniEvent eventToParse, int fieldPosition) {
JniMarkerField tmpField = eventToParse.requestEventMarker().getMarkerFieldsArrayList().get(fieldPosition);
// Call the parsing function in C. The result will be put in parsedData object
- ltt_getParsedData(eventToParse.getEventPtr().getLibraryId(), parsedData, eventToParse.getEventPtr().getPointer(), tmpField.getMarkerFieldPtr().getPointer());
+ ltt_getParsedData(parsedData, eventToParse.getEventPtr().getPointer(), tmpField.getMarkerFieldPtr().getPointer() );
return parsedData.getData();
}
*
* @return An Object that contain the JniEvent payload parsed by the C, or null, if if was impossible to parse (i.e., wrong position)
*
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
static public Object parseField(JniEvent eventToParse, String fieldName) {
return null;
}
- ltt_getParsedData(eventToParse.getEventPtr().getLibraryId(), parsedData, eventToParse.getEventPtr().getPointer(), tmpField.getMarkerFieldPtr().getPointer());
+ ltt_getParsedData(parsedData, eventToParse.getEventPtr().getPointer(), tmpField.getMarkerFieldPtr().getPointer() );
return parsedData.getData();
}
* @param eventToParse The jni event we want to parse.
* @return An HashMap of Object that contain the is the JniEvent's payload parsed by the C
*
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
static public HashMap<String, Object> parseAllFields(JniEvent eventToParse) {
HashMap<String,JniMarkerField> markerFieldData = eventToParse.requestEventMarker().getMarkerFieldsHashMap();
// HashMap<String, Object> parsedDataMap = (HashMap<String, Object>)markerFieldData.clone();
// Or even safer, use HashMap constructor to do so :
HashMap<String, Object> parsedDataMap = new HashMap<String, Object>(markerFieldData);
-
+
+ String newKey = null;
JniMarkerField newMarkerField = null;
Iterator<String> iterator = markerFieldData.keySet().iterator();
while ( iterator.hasNext() ) {
- newMarkerField = markerFieldData.get(iterator.next());
+ newKey = iterator.next();
+ newMarkerField = markerFieldData.get(newKey);
// Call the C to parse the data
- ltt_getParsedData(eventToParse.getEventPtr().getLibraryId(), parsedData, eventToParse.getEventPtr().getPointer(), newMarkerField.getMarkerFieldPtr().getPointer());
+ ltt_getParsedData(parsedData, eventToParse.getEventPtr().getPointer(), newMarkerField.getMarkerFieldPtr().getPointer() );
// Save the result into the HashMap
parsedDataMap.put(newMarkerField.getField(), parsedData.getData() );
}
* @param stringToAdd The parsed data to add
* @param formatToAdd The format of the raw data
*/
- static private void addStringToParsingFromC(Object contentHolder, String stringToAdd) {
+ @SuppressWarnings("unused")
+ static private void addStringToParsingFromC(Object contentHolder, String stringToAdd) {
((ParsedObjectContent)contentHolder).setData( stringToAdd);
}
* @param pointerToAdd The parsed data to add (in 64 bits long!)
* @param formatToAdd The format of the raw data
*/
- static private void addLongPointerToParsingFromC(Object contentHolder, long pointerToAdd) {
+ @SuppressWarnings("unused")
+ static private void addLongPointerToParsingFromC(Object contentHolder, long pointerToAdd) {
((ParsedObjectContent)contentHolder).setData( new Jni_C_Pointer((long) pointerToAdd));
}
* @param pointerToAdd The parsed data to add (converted in 64 bits long!)
* @param formatToAdd The format of the raw data
*/
- static private void addIntPointerToParsingFromC(Object contentHolder, long pointerToAdd) {
+ @SuppressWarnings("unused")
+ static private void addIntPointerToParsingFromC(Object contentHolder, long pointerToAdd) {
((ParsedObjectContent)contentHolder).setData( new Jni_C_Pointer((int) pointerToAdd));
}
* @param shortToAdd The parsed data to add
* @param formatToAdd The format of the raw data
*/
- static private void addShortToParsingFromC(Object contentHolder, short shortToAdd) {
- ((ParsedObjectContent)contentHolder).setData( Short.valueOf(shortToAdd));
+ @SuppressWarnings("unused")
+ static private void addShortToParsingFromC(Object contentHolder, short shortToAdd) {
+ ((ParsedObjectContent)contentHolder).setData( new Short(shortToAdd));
}
/*
* @param intToAdd The parsed data to add
* @param formatToAdd The format of the raw data
*/
- static private void addIntegerToParsingFromC(Object contentHolder, int intToAdd) {
- ((ParsedObjectContent)contentHolder).setData( Integer.valueOf(intToAdd));
+ @SuppressWarnings("unused")
+ static private void addIntegerToParsingFromC(Object contentHolder, int intToAdd) {
+ ((ParsedObjectContent)contentHolder).setData( new Integer(intToAdd));
}
/*
* @param longToAdd The parsed data to add
* @param formatToAdd The format of the raw data
*/
- static private void addLongToParsingFromC(Object contentHolder, long longToAdd) {
- ((ParsedObjectContent)contentHolder).setData( Long.valueOf(longToAdd));
+ @SuppressWarnings("unused")
+ static private void addLongToParsingFromC(Object contentHolder, long longToAdd) {
+ ((ParsedObjectContent)contentHolder).setData( new Long(longToAdd));
}
/*
* @param floatToAdd The parsed data to add
* @param formatToAdd The format of the raw data
*/
- static private void addFloatToParsingFromC(Object contentHolder, float floatToAdd) {
+ @SuppressWarnings("unused")
+ static private void addFloatToParsingFromC(Object contentHolder, float floatToAdd) {
((ParsedObjectContent)contentHolder).setData( new Float(floatToAdd));
}
* @param doubleToAdd The parsed data to add
* @param formatToAdd The format of the raw data
*/
- static private void addDoubleToParsingFromC(Object contentHolder, double doubleToAdd) {
+ @SuppressWarnings("unused")
+ static private void addDoubleToParsingFromC(Object contentHolder, double doubleToAdd) {
((ParsedObjectContent)contentHolder).setData( new Double(doubleToAdd));
}
}
-
/**
* <b><u>ParsedObjectContent</u></b><p>
*
public void setData(Object newData) {
parsedData = newData;
}
-}
+}
\ No newline at end of file
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni;
+/*******************************************************************************
+ * Copyright (c) 2009 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * William Bourque (wbourque@gmail.com) - Initial API and implementation
+ *******************************************************************************/
+
+
+/**
+ * <b><u>JniTime</u></b>
+ * <p>
+ * Used to store (event, trace, tracefile, ...) timestamp.
+ *
+ * Mimic the behavior of the LttTime C structure.
+ */
+public class JniTime extends Jni_C_Common implements Comparable<JniTime>
+{
+ private long time = 0;
+
+ /**
+ * Default constructor.<p>
+ *
+ * Note : Time will be set to 0.
+ *
+ */
+ public JniTime() {
+ time = 0;
+ }
+
+ /**
+ * Copy constructor.
+ *
+ * @param oldTime Reference to the JniTime you want to copy.
+ */
+ public JniTime(JniTime oldTime) {
+ time = oldTime.getTime();
+ }
+
+ /**
+ * Constructor with parameters.<p>
+ *
+ * "LTT style" constructor with Seconds et Nanoseconds
+ *
+ * @param newSec Seconds of the JniTime
+ * @param newNanoSec Nanoseconds of the JniTime
+ */
+ public JniTime(long newSec, long newNanoSec) {
+ time = (newSec * NANO) + newNanoSec;
+ }
+
+ /**
+ * Constructor with parameters.<p>
+ *
+ * Usual "nanosecond only" constructor.
+ *
+ * @param newNanoSecTime Time in nanoseconds
+ */
+ public JniTime(long newNanoSecTime) {
+ time = newNanoSecTime;
+ }
+
+ /**
+ * Second of the time.<p>
+ *
+ * Returns seconds, i.e. multiple of 1 000 000, of the stored nanoseconds time.
+ *
+ * @return Second of this time.
+ */
+ public long getSeconds() {
+ return (time / NANO);
+ }
+
+ /**
+ * Getter for the nanosecond of the time.<p>
+ *
+ * Returns nanoseconds part, i.e. modulo of 1 000 000, of the stored nanoseconds time.
+ *
+ * @return Nanoseconds of this time
+ */
+ public long getNanoSeconds() {
+ return time % NANO;
+ }
+
+ /**
+ * Full time, in nanoseconds.<p>
+ *
+ * @return Complete time in nanoseconds
+ */
+ public long getTime() {
+ return time;
+ }
+
+ /**
+ * Changes the current time for this object<p>
+ *
+ * @param newTime New time to set, in nanoseconds.
+ */
+ public void setTime(long newTime) {
+ time = newTime;
+ }
+
+ /*
+ * Populate this time object
+ *
+ * Note: This function is called from C side.
+ *
+ * @param newTime The time we want to populate
+ */
+ @SuppressWarnings("unused")
+ private void setTimeFromC(long newTime) {
+ time = newTime;
+ }
+
+ /**
+ * Comparaison operator smaller or equal than "<=" .<p>
+ *
+ * @param comparedTime The time we want to compare with this one
+ *
+ * @return true if compared time is smaller or equal, false otherwise
+ */
+ public boolean isSmallerOrEqual(JniTime comparedTime) {
+
+ // NOTE : We check <= instead of just <
+ // This mean the LEFT OPERAND (comparedTime) always prevails
+ if (this.getTime() <= comparedTime.getTime() ) {
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * compareTo operator.<p>
+ *
+ * @param right The time we want to compare with this one
+ *
+ * @return int of value -1, 0 or 1, as the pased argument is bigger, equal or smaller than this time
+ */
+ public int compareTo(JniTime right) {
+ long leftTime = this.getTime();
+ long rightTime = right.getTime();
+
+ if ( leftTime < rightTime ) {
+ return -1;
+ }
+ else if ( leftTime > rightTime ) {
+ return 1;
+ }
+ else {
+ return 0;
+ }
+ }
+
+ /**
+ * toString() method.
+ * <u>Intended to debug</u><p>
+ *
+ * NOTE : We output the time in the same format as LTT (seconds and nanosecond separatly)
+ *
+ * @return String Attributes of the object concatenated in String
+ */
+ @Override
+ public String toString() {
+ String returnData = "";
+
+ returnData += "seconds : " + this.getSeconds() + "\n";
+ returnData += "nanoSeconds : " + this.getNanoSeconds() + "\n";
+
+ return returnData;
+ }
+}
* William Bourque (wbourque@gmail.com) - Initial API and implementation
*******************************************************************************/
+
import java.util.HashMap;
import java.util.Iterator;
import java.util.PriorityQueue;
import org.eclipse.linuxtools.lttng.jni.common.JniTime;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.exception.JniOpenTraceFailedException;
import org.eclipse.linuxtools.lttng.jni.exception.JniTraceException;
* <li>a JniTrace path (a trace <b>directory</b>)
* <li>a HashMap of tracefiles that exists in this trace
* </ul>
- * <p>
- * <b>NOTE</b><p>
- * This class is ABSTRACT, you need to extends it to support your specific LTTng version.<br>
- * Please look at the abstract functions to override at the bottom of this file.<p>
*/
public abstract class JniTrace extends Jni_C_Common {
private final static boolean DEFAULT_LTT_DEBUG = false;
// Internal C pointer of the JniTrace used in LTT
- private Jni_C_Pointer_And_Library_Id thisTracePtr = new Jni_C_Pointer_And_Library_Id();
+ private Jni_C_Pointer thisTracePtr = new Jni_C_Pointer();
// Data we should populate from LTT
// Note that all type have been scaled up as there is no "unsigned" in java
// This might be a problem about "unsigned long" as there is no equivalent
// in java
-
+
private String tracepath = ""; // Path of the trace. Should be a directory (like : /tmp/traceX)
private int cpuNumber = 0;
private long archType = 0;
// Should we print debug in the C library or not?
private boolean printLttDebug = DEFAULT_LTT_DEBUG;
-
// This need to be called prior to any operation
- protected native int ltt_initializeHandle(String libname);
-
+ protected native boolean ltt_initializeHandle(String libname);
// This need to be called at the very end (destructor)
- protected native boolean ltt_freeHandle(int libId);
+ protected native boolean ltt_freeHandle();
// Open/close native functions
- protected native long ltt_openTrace(int libId, String pathname, boolean printDebug);
- protected native void ltt_closeTrace(int libId, long tracePtr);
+ protected native long ltt_openTrace(String pathname, boolean printDebug);
+ protected native void ltt_closeTrace(long tracePtr);
// Native access functions
- protected native String ltt_getTracepath(int libId, long tracePtr);
- protected native int ltt_getCpuNumber(int libId, long tracePtr);
- protected native long ltt_getArchType(int libId, long tracePtr);
- protected native long ltt_getArchVariant(int libId, long tracePtr);
- protected native short ltt_getArchSize(int libId, long tracePtr);
- protected native short ltt_getLttMajorVersion(int libId, long tracePtr);
- protected native short ltt_getLttMinorVersion(int libId, long tracePtr);
- protected native short ltt_getFlightRecorder(int libId, long tracePtr);
- protected native long ltt_getFreqScale(int libId, long tracePtr);
- protected native long ltt_getStartFreq(int libId, long tracePtr);
- protected native long ltt_getStartTimestampCurrentCounter(int libId, long tracePtr);
- protected native long ltt_getStartMonotonic(int libId, long tracePtr);
+ protected native String ltt_getTracepath(long tracePtr);
+ protected native int ltt_getCpuNumber(long tracePtr);
+ protected native long ltt_getArchType(long tracePtr);
+ protected native long ltt_getArchVariant(long tracePtr);
+ protected native short ltt_getArchSize(long tracePtr);
+ protected native short ltt_getLttMajorVersion(long tracePtr);
+ protected native short ltt_getLttMinorVersion(long tracePtr);
+ protected native short ltt_getFlightRecorder(long tracePtr);
+ protected native long ltt_getFreqScale(long tracePtr);
+ protected native long ltt_getStartFreq(long tracePtr);
+ protected native long ltt_getStartTimestampCurrentCounter(long tracePtr);
+ protected native long ltt_getStartMonotonic(long tracePtr);
// Native function to fill out startTime
- protected native void ltt_feedStartTime(int libId, long tracePtr, JniTime startTime);
+ protected native void ltt_feedStartTime(long tracePtr, JniTime startTime);
// Native function to fill out startTimeFromTimestampCurrentCounter
- protected native void ltt_feedStartTimeFromTimestampCurrentCounter(int libId, long tracePtr, JniTime startTime);
+ protected native void ltt_feedStartTimeFromTimestampCurrentCounter(long tracePtr, JniTime startTime);
// Native function to fill out tracefilesMap
- protected native void ltt_feedAllTracefiles(int libId, long tracePtr);
+ protected native void ltt_feedAllTracefiles(long tracePtr);
// Native function to fill out the start and end time of the trace
- protected native void ltt_feedTracefileTimeRange(int libId, long tracePtr, JniTime startTime, JniTime endTime);
+ protected native void ltt_feedTracefileTimeRange(long tracePtr, JniTime startTime, JniTime endTime);
// Debug native function, ask LTT to print trace structure
- protected native void ltt_printTrace(int libId, long tracePtr);
+ protected native void ltt_printTrace(long tracePtr);
+
+ static {
+ System.loadLibrary("lttvtraceread_loader");
+ }
/*
* Default constructor is forbidden
*/
public JniTrace(String newpath, boolean newPrintDebug) throws JniException {
tracepath = newpath;
- thisTracePtr = new Jni_C_Pointer_And_Library_Id();
+ thisTracePtr = new Jni_C_Pointer();
printLttDebug = newPrintDebug;
openTrace(newpath);
endTime = oldTrace.endTime;
tracefilesMap = new HashMap<String, JniTracefile>(oldTrace.tracefilesMap.size());
- ltt_feedAllTracefiles(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
+ tracefilesMap = oldTrace.tracefilesMap;
eventsHeap = new PriorityQueue<JniEvent>( oldTrace.eventsHeap.size());
- populateEventHeap();
+ eventsHeap = oldTrace.eventsHeap;
printLttDebug = oldTrace.printLttDebug;
}
*
* @exception JniException
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public JniTrace(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException {
+ public JniTrace(Jni_C_Pointer newPtr, boolean newPrintDebug) throws JniException {
thisTracePtr = newPtr;
printLttDebug = newPrintDebug;
}
- @Override
- public void finalize() {
+ public void finalize() {
// If the trace is open, close it
if (thisTracePtr.getPointer() != NULL) {
closeTrace();
}
- // Tell the C to free the allocated memory
freeLibrary();
}
* Open an existing trace.<p>
*
* The tracepath is a directory and needs to exist, otherwise
- * a JniOpenTraceFailedException is throwed.
+ * a JafOpenTraceFailedException is throwed.
*
* @param newPath The <b>directory</b> of the trace to be opened
*
closeTrace();
}
- // Initialization of the library is made here
- // It is very important that the id is kept!
- int newLibraryId = initializeLibrary();
- if ( newLibraryId != -1 ) {
+ if ( initializeLibrary() == true ) {
// Call the LTT to open the trace
- // Note that the libraryId is not yet and the pointer
- long newPtr = ltt_openTrace(newLibraryId, tracepath, printLttDebug);
+ long newPtr = ltt_openTrace(tracepath, printLttDebug);
if (newPtr == NULL) {
- thisTracePtr = new Jni_C_Pointer_And_Library_Id();
+ thisTracePtr = new Jni_C_Pointer(NULL);
throw new JniOpenTraceFailedException("Error while opening trace. Is the tracepath correct? (openTrace)");
}
// This is OUR pointer
- thisTracePtr = new Jni_C_Pointer_And_Library_Id(newLibraryId, newPtr);
+ thisTracePtr = new Jni_C_Pointer(newPtr);
// Populate the trace with LTT information
populateTraceInformation();
}
else {
- thisTracePtr = new Jni_C_Pointer_And_Library_Id();
- throw new JniTraceException("Failed to initialize library! Is the trace version supported?\n" +
- "Make sure you have the correct LTTv library compiled. (openTrace)");
+ thisTracePtr = new Jni_C_Pointer(NULL);
+ throw new JniTraceException("Failed to initialize library! Trace version not supported? (openTrace)");
}
}
public void closeTrace() {
if (thisTracePtr.getPointer() != NULL) {
- ltt_closeTrace(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
+ ltt_closeTrace(thisTracePtr.getPointer());
// Clear the tracefile map
tracefilesMap.clear();
eventsHeap = null;
// Nullify the pointer
- thisTracePtr = new Jni_C_Pointer_And_Library_Id();
+ thisTracePtr = new Jni_C_Pointer(NULL);
+
+ // Ask the garbage collector to make a little pass here, as we could
+ // be left with 100's of unreferenced objects
+ System.gc();
}
}
* Note : No call to the library will work after this until ltt_initializeHandle is called again
*/
public void freeLibrary() {
- ltt_freeHandle(thisTracePtr.getLibraryId());
+ ltt_freeHandle();
}
/*
}
// Populate from the LTT library
- tracepath = ltt_getTracepath(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- cpuNumber = ltt_getCpuNumber(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- archType = ltt_getArchType(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- archVariant = ltt_getArchVariant(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- archSize = ltt_getArchSize(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- lttMajorVersion = ltt_getLttMajorVersion(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- lttMinorVersion = ltt_getLttMinorVersion(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- flightRecorder = ltt_getFlightRecorder(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- freqScale = ltt_getFreqScale(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- startFreq = ltt_getStartFreq(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- startTimestampCurrentCounter = ltt_getStartTimestampCurrentCounter(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
- startMonotonic = ltt_getStartMonotonic(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
+ tracepath = ltt_getTracepath( thisTracePtr.getPointer() );
+ cpuNumber = ltt_getCpuNumber( thisTracePtr.getPointer() );
+ archType = ltt_getArchType( thisTracePtr.getPointer() );
+ archVariant = ltt_getArchVariant( thisTracePtr.getPointer() );
+ archSize = ltt_getArchSize( thisTracePtr.getPointer() );
+ lttMajorVersion = ltt_getLttMajorVersion( thisTracePtr.getPointer() );
+ lttMinorVersion = ltt_getLttMinorVersion( thisTracePtr.getPointer() );
+ flightRecorder = ltt_getFlightRecorder( thisTracePtr.getPointer() );
+ freqScale = ltt_getFreqScale( thisTracePtr.getPointer() );
+ startFreq = ltt_getStartFreq( thisTracePtr.getPointer() );
+ startTimestampCurrentCounter = ltt_getStartTimestampCurrentCounter( thisTracePtr.getPointer() );
+ startMonotonic = ltt_getStartMonotonic( thisTracePtr.getPointer() );
// Creation of time is a bit different, we need to pass the object reference to C
//
// So "startTimeNoAdjustement" is obtain throught "ltt_feedStartTime()" and
// "startTime" is obtained from ltt_feedStartTimeFromTimestampCurrentCounter()
startTimeNoAdjustement = new JniTime();
- ltt_feedStartTime(thisTracePtr.getLibraryId(), thisTracePtr.getPointer(), startTimeNoAdjustement);
+ ltt_feedStartTime( thisTracePtr.getPointer(), startTimeNoAdjustement );
startTime = new JniTime();
- ltt_feedStartTimeFromTimestampCurrentCounter(thisTracePtr.getLibraryId(), thisTracePtr.getPointer(), startTime);
+ ltt_feedStartTimeFromTimestampCurrentCounter( thisTracePtr.getPointer(), startTime );
// Call the fill up function for the tracefiles map
if ( tracefilesMap== null ) {
tracefilesMap = new HashMap<String, JniTracefile>();
}
- ltt_feedAllTracefiles(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
+ ltt_feedAllTracefiles( thisTracePtr.getPointer() );
// Now, obtain the trace "endTime"
// Note that we discard "startTime" right away, as we already have it
endTime = new JniTime();
- ltt_feedTracefileTimeRange(thisTracePtr.getLibraryId(), thisTracePtr.getPointer(), new JniTime(), endTime);
+ ltt_feedTracefileTimeRange(thisTracePtr.getPointer(), new JniTime(), endTime);
if (eventsHeap == null) {
eventsHeap = new PriorityQueue<JniEvent>(tracefilesMap.size());
// Create a new tracefile object and insert it in the map
// the tracefile fill itself with LTT data while being constructed
try {
- newTracefile = allocateNewJniTracefile(new Jni_C_Pointer_And_Library_Id(thisTracePtr.getLibraryId(), tracefilePtr), this);
+ newTracefile = allocateNewJniTracefile( new Jni_C_Pointer(tracefilePtr), this );
getTracefilesMap().put( (tracefileName + newTracefile.getCpuNumber()), newTracefile);
}
catch(JniTracefileWithoutEventException e) {
if ( printLttDebug == true ) {
- printlnC(thisTracePtr.getLibraryId(), "JniTracefile " + tracefileName + " has no event (addTracefileFromC). Ignoring.");
+ printlnC("JniTracefile " + tracefileName + " has no event (addTracefileFromC). Ignoring.");
}
}
catch(Exception e) {
if ( printLttDebug == true ) {
- printlnC(thisTracePtr.getLibraryId(), "Failed to add tracefile " + tracefileName + " to tracefilesMap!(addTracefileFromC)\n\tException raised : " + e.toString() );
+ printlnC("Failed to add tracefile " + tracefileName + " to tracefilesMap!(addTracefileFromC)\n\tException raised : " + e.toString() );
}
}
}
*
* @return The top event in the stack or null if no event is available.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
public JniEvent findNextEvent() {
return eventsHeap.peek();
*
* @return The next event in the trace or null if no event is available.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
public JniEvent readNextEvent() {
// Get the "next" event on the top of the heap but DO NOT remove it
*
* @return The next event in the tracefile or null if no event is available.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTracefile
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
public JniEvent readNextEvent(JniTracefile targetTracefile) {
JniEvent returnedEvent = null;
*
* @param seekTime The time where we want to seek to
*
- * @see org.eclipse.linuxtools.lttng.jni.common.JniTime
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.JniTime
*/
public void seekToTime(JniTime seekTime) {
* @param targetTracefile The tracefile object to read from
* @param seekTime The time where we want to seek to
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- * @see org.eclipse.linuxtools.lttng.jni.common.JniTime
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTracefile
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.JniTime
*/
public void seekToTime(JniTime seekTime, JniTracefile targetTracefile) {
// Invalidate the current read event
*
* @return The event just after the seeked time or null if none available.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
- * @see org.eclipse.linuxtools.lttng.jni.common.JniTime
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.JniTime
*/
public JniEvent seekAndRead(JniTime seekTime) {
JniEvent returnedEvent = null;
*
* Calling readNextEvent() after this function will consider this tracefile moved and is then consistent.<br>
*
- * @param targetTracefile The tracefile object to read from
+ * @param tracefileName The tracefile object to read from
* @param seekTime The time where we want to seek to
*
* @return The event just after the seeked time or null if none available.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- * @see org.eclipse.linuxtools.lttng.jni.common.JniTime
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTracefile
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.JniTime
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
public JniEvent seekAndRead(JniTime seekTime, JniTracefile targetTracefile) {
seekToTime(seekTime, targetTracefile);
*
* @return The tracefile found or null if none.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTracefile
*/
public JniTracefile requestTracefileByName(String tracefileName) {
return tracefilesMap.get(tracefileName);
*
* @return Event of the tracefile or null if none found.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniEvent
*/
public JniEvent requestEventByName(String tracefileName) {
JniEvent returnValue = null;
*
* @return Time of the last event read
*
- * @see org.eclipse.linuxtools.lttng.jni.common.JniTime
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.JniTime
*/
public JniTime getCurrentEventTimestamp() {
JniTime returnedTime = null;
*
* @return The actual (long converted) pointer or NULL.
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public Jni_C_Pointer_And_Library_Id getTracePtr() {
+ public Jni_C_Pointer getTracePtr() {
return thisTracePtr;
}
* This function will call Ltt to print, so information printed will be the
* one from the C structure, not the one populated in java.
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTracefile
*/
public void printAllTracefilesInformation() {
JniTracefile tracefile = null;
*
* This function will call Ltt to print, so information printed will be the
* one from the C structure, not the one populated in java.<p>
+ * <br>
+ * This function will not throw but will complain loudly if pointer is NULL
*/
public void printTraceInformation() {
- ltt_printTrace(thisTracePtr.getLibraryId(), thisTracePtr.getPointer());
+
+ // If null pointer, print a warning!
+ if (thisTracePtr.getPointer() == NULL) {
+ printlnC("Pointer is NULL, cannot print. (printTraceInformation)");
+ }
+ else {
+ ltt_printTrace( thisTracePtr.getPointer() );
+ }
}
/**
return returnData;
}
+ public abstract boolean initializeLibrary();
- // ****************************
- // **** ABSTRACT FUNCTIONS ****
- // You MUST override those in your version specific implementation
-
- /**
- * Function place holder to load the correct C library.<p>
- * <br>
- * Can be as simple as calling ltt_initializeHandle(LIBRARY_NAME) with the correct .so instead of LIBRARY_NAME.<br>
- * You may also want to perform some check or some additionnal validations.<br>
- * <br>
- * <b>!! Override this with you version specific implementation.</b><br>
- *
- * @return integer that is the library id, or -1 if the load was unsuccessful
- */
- public abstract int initializeLibrary();
-
-
- /**
- * Function place holder to allocate a new JniTracefile.<p>
- *
- * JniTracefile constructor is non overridable so we need another overridable function to return the correct version of JniTracefile.<br>
- * Effect of this function should be the same (allocate a fresh new JniTracefile)<br>
- * <br>
- * <b>!! Override this with you version specific implementation.</b><br>
- *
- * @param newPtr The pointer of an already opened LttTracefile C Structure
- * @param newParentTrace The JniTrace parent of this tracefile.
- *
- * @return The newly allocated JniTracefile of the correct version
- *
- * @throws JniException The construction (allocation) failed.
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
- * @see org.eclipse.linuxtools.lttng.jni.JniTrace
- */
- public abstract JniTracefile allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException;
+ public abstract JniTracefile allocateNewJniTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException;
-}
+}
\ No newline at end of file
import org.eclipse.linuxtools.lttng.jni.common.JniTime;
import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.exception.JniNoSuchEventException;
import org.eclipse.linuxtools.lttng.jni.exception.JniTracefileException;
* <li> a reference to a single event object
* <li> a HashMap of marker associated with this tracefile
* </ul>
- * <b>NOTE</b><p>
- * This class is ABSTRACT, you need to extends it to support your specific LTTng version.<br>
- * Please look at the abstract functions to override at the bottom of this file.<p>
- *
*/
-public abstract class JniTracefile extends Jni_C_Common
-{
+public abstract class JniTracefile extends Jni_C_Common {
+
// Internal C pointer of the JniTracefile used in LTT
- private Jni_C_Pointer_And_Library_Id thisTracefilePtr = new Jni_C_Pointer_And_Library_Id();
+ private Jni_C_Pointer thisTracefilePtr = new Jni_C_Pointer();
// Reference to the parent trace
private JniTrace parentTrace = null;
private long creation = 0;
// Internal C pointer for trace and marker
- // Note : These are real Jni_C_Pointer, not Jni_C_Pointer_And_Library_Id
private Jni_C_Pointer tracePtr = null;
private Jni_C_Pointer markerDataPtr = null;
private JniEvent currentEvent = null;
// Internal C pointer for trace and marker
- // Note : This one is a real Jni_C_Pointer, not Jni_C_Pointer_And_Library_Id
private Jni_C_Pointer bufferPtr = null;
private long bufferSize = 0;
private HashMap<Integer, JniMarker> tracefileMarkersMap = null;
// Native access functions
- protected native boolean ltt_getIsCpuOnline(int libId, long tracefilePtr);
- protected native String ltt_getTracefilepath(int libId, long tracefilePtr);
- protected native String ltt_getTracefilename(int libId, long tracefilePtr);
- protected native long ltt_getCpuNumber(int libId, long tracefilePtr);
- protected native long ltt_getTid(int libId, long tracefilePtr);
- protected native long ltt_getPgid(int libId, long tracefilePtr);
- protected native long ltt_getCreation(int libId, long tracefilePtr);
- protected native long ltt_getTracePtr(int libId, long tracefilePtr);
- protected native long ltt_getMarkerDataPtr(int libId, long tracefilePtr);
- protected native int ltt_getCFileDescriptor(int libId, long tracefilePtr);
- protected native long ltt_getFileSize(int libId, long tracefilePtr);
- protected native long ltt_getBlockNumber(int libId, long tracefilePtr);
- protected native boolean ltt_getIsBytesOrderReversed(int libId, long tracefilePtr);
- protected native boolean ltt_getIsFloatWordOrdered(int libId, long tracefilePtr);
- protected native long ltt_getAlignement(int libId, long tracefilePtr);
- protected native long ltt_getBufferHeaderSize(int libId, long tracefilePtr);
- protected native int ltt_getBitsOfCurrentTimestampCounter(int libId, long tracefilePtr);
- protected native int ltt_getBitsOfEvent(int libId, long tracefilePtr);
- protected native long ltt_getCurrentTimestampCounterMask(int libId, long tracefilePtr);
- protected native long ltt_getCurrentTimestampCounterMaskNextBit(int libId, long tracefilePtr);
- protected native long ltt_getEventsLost(int libId, long tracefilePtr);
- protected native long ltt_getSubBufferCorrupt(int libId, long tracefilePtr);
- protected native long ltt_getEventPtr(int libId, long tracefilePtr);
- protected native long ltt_getBufferPtr(int libId, long tracefilePtr);
- protected native long ltt_getBufferSize(int libId, long tracefilePtr);
-
+ protected native boolean ltt_getIsCpuOnline(long tracefilePtr);
+ protected native String ltt_getTracefilepath(long tracefilePtr);
+ protected native String ltt_getTracefilename(long tracefilePtr);
+ protected native long ltt_getCpuNumber(long tracefilePtr);
+ protected native long ltt_getTid(long tracefilePtr);
+ protected native long ltt_getPgid(long tracefilePtr);
+ protected native long ltt_getCreation(long tracefilePtr);
+ protected native long ltt_getTracePtr(long tracefilePtr);
+ protected native long ltt_getMarkerDataPtr(long tracefilePtr);
+ protected native int ltt_getCFileDescriptor(long tracefilePtr);
+ protected native long ltt_getFileSize(long tracefilePtr);
+ protected native long ltt_getBlockNumber(long tracefilePtr);
+ protected native boolean ltt_getIsBytesOrderReversed(long tracefilePtr);
+ protected native boolean ltt_getIsFloatWordOrdered(long tracefilePtr);
+ protected native long ltt_getAlignement(long tracefilePtr);
+ protected native long ltt_getBufferHeaderSize(long tracefilePtr);
+ protected native int ltt_getBitsOfCurrentTimestampCounter(long tracefilePtr);
+ protected native int ltt_getBitsOfEvent(long tracefilePtr);
+ protected native long ltt_getCurrentTimestampCounterMask(long tracefilePtr);
+ protected native long ltt_getCurrentTimestampCounterMaskNextBit(long tracefilePtr);
+ protected native long ltt_getEventsLost(long tracefilePtr);
+ protected native long ltt_getSubBufferCorrupt(long tracefilePtr);
+ protected native long ltt_getEventPtr(long tracefilePtr);
+ protected native long ltt_getBufferPtr(long tracefilePtr);
+ protected native long ltt_getBufferSize(long tracefilePtr);
+
// Method to fill a map with marker object
- protected native void ltt_feedAllMarkers(int libId, long tracefilePtr);
+ protected native void ltt_feedAllMarkers(long tracefilePtr);
// Debug native function, ask LTT to print tracefile structure
- protected native void ltt_printTracefile(int libId, long tracefilePtr);
+ protected native void ltt_printTracefile(long tracefilePtr);
+
+ static {
+ System.loadLibrary("lttvtraceread_loader");
+ }
/*
* Default constructor is forbidden
*/
+ @SuppressWarnings("unused")
protected JniTracefile() {
}
/**
* Constructor, using C pointer.<p>
*
- * @param newPtr The pointer of an already opened LttTracefile C Structure
- * @param newParentTrace The JniTrace parent of this tracefile.
+ * @param newPtr The pointer of an already opened LttTracefile C Structure
*
* @exception JniException
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTrace
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTrace
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public JniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
- thisTracefilePtr = newPtr;
+ public JniTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
+ thisTracefilePtr = newPtr;
parentTrace = newParentTrace;
tracefileMarkersMap = new HashMap<Integer, JniMarker>();
// Retrieve the trace file information and load the first event.
try {
populateTracefileInformation();
- }
- catch (JniNoSuchEventException e) {
- throw new JniTracefileWithoutEventException("JniEvent constructor reported that no event of this type are usable. (Jni_Tracefile)");
+ } catch (JniNoSuchEventException e) {
+ throw new JniTracefileWithoutEventException(
+ "JniEvent constructor reported that no event of this type are usable. (Jaf_Tracefile)");
}
}
*
* Note : If the read succeed, the event will be populated.<p>
*
- * @return LTT read status, as defined in Jni_C_Constant
+ * @return LTT read status, as defined in Jni_C_Common
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Constant
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Common
*/
public int readNextEvent() {
return currentEvent.readNextEvent();
*
* @param seekTime The timestamp where to seek.
*
- * @return LTT read status, as defined in Jni_C_Constant
+ * @return LTT read status, as defined in Jni_C_Common
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Constant
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Common
*/
public int seekToTime(JniTime seekTime) {
return currentEvent.seekToTime(seekTime);
*/
private void populateTracefileInformation() throws JniException {
if (thisTracefilePtr.getPointer() == NULL) {
- throw new JniTracefileException("Pointer is NULL, trace closed? (populateTracefileInformation)");
+ throw new JniTracefileException(
+ "Pointer is NULL, trace closed? (populateTracefileInformation)");
}
- isCpuOnline = ltt_getIsCpuOnline(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer());
- tracefilePath = ltt_getTracefilepath(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer());
- tracefileName = ltt_getTracefilename(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer());
- cpuNumber = ltt_getCpuNumber(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer());
- tid = ltt_getTid(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- pgid = ltt_getPgid(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- creation = ltt_getCreation(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- tracePtr = new Jni_C_Pointer(ltt_getTracePtr(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer()) );
- markerDataPtr = new Jni_C_Pointer(ltt_getMarkerDataPtr(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer()) );
- CFileDescriptor = ltt_getCFileDescriptor(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- fileSize = ltt_getFileSize(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- blocksNumber = ltt_getBlockNumber(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- isBytesOrderReversed = ltt_getIsBytesOrderReversed(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- isFloatWordOrdered = ltt_getIsFloatWordOrdered(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- alignement = ltt_getAlignement(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- bufferHeaderSize = ltt_getBufferHeaderSize(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- bitsOfCurrentTimestampCounter = ltt_getBitsOfCurrentTimestampCounter(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- bitsOfEvent = ltt_getBitsOfEvent(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- currentTimestampCounterMask = ltt_getCurrentTimestampCounterMask(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- currentTimestampCounterMaskNextBit = ltt_getCurrentTimestampCounterMaskNextBit(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- eventsLost = ltt_getEventsLost(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- subBufferCorrupt = ltt_getSubBufferCorrupt(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
- bufferPtr = new Jni_C_Pointer(ltt_getBufferPtr(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer()) );
- bufferSize = ltt_getBufferSize(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer());
+ isCpuOnline = ltt_getIsCpuOnline( thisTracefilePtr.getPointer() );
+ tracefilePath = ltt_getTracefilepath( thisTracefilePtr.getPointer() );
+ tracefileName = ltt_getTracefilename( thisTracefilePtr.getPointer() );
+ cpuNumber = ltt_getCpuNumber( thisTracefilePtr.getPointer() );
+ tid = ltt_getTid( thisTracefilePtr.getPointer() );
+ pgid = ltt_getPgid( thisTracefilePtr.getPointer() );
+ creation = ltt_getCreation( thisTracefilePtr.getPointer() );
+ tracePtr = new Jni_C_Pointer(ltt_getTracePtr( thisTracefilePtr.getPointer()) );
+ markerDataPtr = new Jni_C_Pointer(ltt_getMarkerDataPtr( thisTracefilePtr.getPointer()) );
+ CFileDescriptor = ltt_getCFileDescriptor( thisTracefilePtr.getPointer() );
+ fileSize = ltt_getFileSize( thisTracefilePtr.getPointer() );
+ blocksNumber = ltt_getBlockNumber( thisTracefilePtr.getPointer() );
+ isBytesOrderReversed = ltt_getIsBytesOrderReversed( thisTracefilePtr.getPointer() );
+ isFloatWordOrdered = ltt_getIsFloatWordOrdered( thisTracefilePtr.getPointer() );
+ alignement = ltt_getAlignement( thisTracefilePtr.getPointer() );
+ bufferHeaderSize = ltt_getBufferHeaderSize( thisTracefilePtr.getPointer() );
+ bitsOfCurrentTimestampCounter = ltt_getBitsOfCurrentTimestampCounter( thisTracefilePtr.getPointer() );
+ bitsOfEvent = ltt_getBitsOfEvent( thisTracefilePtr.getPointer() );
+ currentTimestampCounterMask = ltt_getCurrentTimestampCounterMask( thisTracefilePtr.getPointer() );
+ currentTimestampCounterMaskNextBit = ltt_getCurrentTimestampCounterMaskNextBit( thisTracefilePtr.getPointer() );
+ eventsLost = ltt_getEventsLost( thisTracefilePtr.getPointer() );
+ subBufferCorrupt = ltt_getSubBufferCorrupt( thisTracefilePtr.getPointer() );
+ bufferPtr = new Jni_C_Pointer(ltt_getBufferPtr( thisTracefilePtr.getPointer()) );
+ bufferSize = ltt_getBufferSize( thisTracefilePtr.getPointer() );
// To fill the map is a bit different
- ltt_feedAllMarkers(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
+ ltt_feedAllMarkers( thisTracefilePtr.getPointer() );
- Jni_C_Pointer_And_Library_Id tmpEventPointer = new Jni_C_Pointer_And_Library_Id(thisTracefilePtr.getLibraryId(), ltt_getEventPtr(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer()));
+ Jni_C_Pointer tmpEventPointer = new Jni_C_Pointer(ltt_getEventPtr(thisTracefilePtr.getPointer()));
currentEvent = allocateNewJniEvent(tmpEventPointer , tracefileMarkersMap, this);
}
* @param markerId Id of the marker (int)
* @param markerInfoPtr C Pointer to a marker_info C structure
*/
- private void addMarkersFromC(int markerId, long markerInfoPtr) {
+ @SuppressWarnings("unused")
+ private void addMarkersFromC(int markerId, long markerInfoPtr) {
// Create a new tracefile object and insert it in the map
// the tracefile fill itself with LTT data while being constructed
try {
- JniMarker newMarker = allocateNewJniMarker( new Jni_C_Pointer_And_Library_Id(thisTracefilePtr.getLibraryId(), markerInfoPtr) );
+ JniMarker newMarker = allocateNewJniMarker( new Jni_C_Pointer(markerInfoPtr) );
tracefileMarkersMap.put(markerId, newMarker);
} catch (Exception e) {
- printlnC(thisTracefilePtr.getLibraryId(), "Failed to add marker to tracefileMarkersMap!(addMarkersFromC)\n\tException raised : " + e.toString());
+ printlnC("Failed to add marker to tracefileMarkersMap!(addMarkersFromC)\n\tException raised : " + e.toString());
}
}
*
* @return The parent trace
*
- * @see org.eclipse.linuxtools.lttng.jni.JniTrace
+ * @see org.eclipse.linuxtools.lttng.jni.eclipse.linuxtools.lttng.jni.JniTrace
*/
public JniTrace getParentTrace() {
return parentTrace;
*
* @return The actual (long converted) pointer or NULL.
*
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
+ * @see org.eclipse.linuxtools.lttng.jni.common.eclipse.linuxtools.lttng.jni.Jni_C_Pointer
*/
- public Jni_C_Pointer_And_Library_Id getTracefilePtr() {
+ public Jni_C_Pointer getTracefilePtr() {
return thisTracefilePtr;
}
*
* This function will call Ltt to print, so information printed will be the
* one from the C structure, not the one populated in java.<p>
+ *
+ * This function will not throw but will complain loudly if pointer is NULL.
*/
public void printTracefileInformation() {
- ltt_printTracefile(thisTracefilePtr.getLibraryId(), thisTracefilePtr.getPointer() );
+
+ // If null pointer, print a warning!
+ if (thisTracefilePtr.getPointer() == NULL) {
+ printlnC("Pointer is NULL, cannot print. (printTracefileInformation)");
+ }
+ else {
+ ltt_printTracefile( thisTracefilePtr.getPointer() );
+ }
}
/**
}
- // ****************************
- // **** ABSTRACT FUNCTIONS ****
- // You MUST override those in your version specific implementation
-
-
- /**
- * Function place holder to allocate a new JniEvent.<p>
- * <br>
- * JniEvent constructor is non overridable so we need another overridable function to return the correct version of JniEvent.<br>
- * Effect of this function should be the same (allocate a fresh new JniEvent).<br>
- * <br>
- * <b>!! Override this with you version specific implementation.</b><br>
- *
- * @param newEventPtr The pointer of an already opened LttEvent C Structure
- * @param newMarkersMap An already populated HashMap of JniMarker objects for this new event
- * @param newParentTracefile The JniTrace parent of this tracefile.
- *
- * @return The newly allocated JniEvent of the correct version
- *
- * @throws JniException The construction (allocation) failed.
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniEvent
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- */
- public abstract JniEvent allocateNewJniEvent(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException;
-
-
- /**
- * Function place holder to allocate a new JniMarker.<p>
- * <br>
- * JniMarker constructor is non overridable so we need another overridable function to return the correct version of JniMarker.<br>
- * Effect of this function should be the same (allocate a fresh new JniMarker).<br>
- * <br>
- * <b>!! Override this with you version specific implementation.</b><br>
- *
- * @param newMarkerPtr The pointer of an already opened marker_info C Structure
- *
- * @return The newly allocated JniMarker of the correct version
- *
- * @throws JniException The construction (allocation) failed.
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
- * @see org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id
- */
- public abstract JniMarker allocateNewJniMarker(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException;
+ public abstract JniEvent allocateNewJniEvent(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException;
+ public abstract JniMarker allocateNewJniMarker(Jni_C_Pointer newMarkerPtr) throws JniException;
}
+
/**
* <b><u>Jni_C_Common</u></b>
* <p>
- * Common constants and methods that should be shared between JNI objects.
- *
- * <b>NOTE</b><p>
- * This class is ABSTRACT, and will be extended by each LTTng structure (Trac, Tracefile, Event, ...)
- *
+ * Common constants and methods that should be shared between JNI objects
*/
-public abstract class Jni_C_Common extends Jni_C_Constant
-{
- // Native console printing function
- protected native void ltt_printC(int libId, String string_to_print);
+public abstract class Jni_C_Common extends Jni_C_Constant {
+ // Native console printing function
+ protected native void ltt_printC(String string_to_print);
+
+ // Load LTTV library (order is important)
+ static {
+ System.loadLibrary("lttvtraceread_loader");
+ }
+
/**
* Java-side console printing function.<p>
*
*
* @param msg The string to print in C.
*/
- public void printC(int libId, String msg) {
+ public void printC(String msg) {
// Need to escape "%" for C printf
msg = msg.replaceAll("%", "%%");
- ltt_printC(libId, msg);
+ ltt_printC(msg);
}
/**
*
* @param msg The string to print in C.
*/
- public void printlnC(int libId, String msg) {
- printC(libId, msg + "\n");
+ public void printlnC(String msg) {
+ printC(msg + "\n");
}
-
-}
+}
\ No newline at end of file
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni;
+
+
+/**
+ * <b><u>Jni_C_Pointer</u></b>
+ * <p>
+ * Class pointer to handle properly "C pointer" <p>
+ *
+ * Can transparently handle pointer of 32 or 64 bits.
+ */
+public class Jni_C_Pointer extends Jni_C_Common {
+
+ private long ptr = NULL;
+ private boolean isLong = true;
+
+ /**
+ * Default constructor.<p>
+ *
+ * Note : Pointer will be set to a 64bits "NULL".
+ */
+ public Jni_C_Pointer() {
+ ptr = NULL;
+ }
+
+ /**
+ * Constructor with parameters for 64bits pointers.
+ *
+ * @param newPtr long-converted (64 bits) C pointer.
+ */
+ public Jni_C_Pointer(long newPtr) {
+ ptr = newPtr;
+ isLong = true;
+ }
+
+ /**
+ * Constructor with parameters for 32bits pointers.
+ *
+ * @param newPtr int-converted (32 bits) C pointer.
+ */
+ public Jni_C_Pointer(int newPtr) {
+ ptr = (long)newPtr;
+ isLong = false;
+ }
+
+ /**
+ * Get the current pointer.
+ *
+ * @return The current pointer, in long.
+ */
+ public long getPointer() {
+ return ptr;
+ }
+
+ /**
+ * Set the pointer, as a 64bits pointer.
+ *
+ * @param newPtr long-converted (64 bits) C pointer.
+ */
+ public void setPointer(long newPtr) {
+ ptr = newPtr;
+ isLong = true;
+ }
+
+ /**
+ * Set the pointer, as a 64bits pointer.
+ *
+ * @param newPtr int-converted (32 bits) C pointer.
+ */
+ public void setPointer(int newPtr) {
+ ptr = newPtr;
+ isLong = false;
+ }
+
+ /**
+ * toString() method. <p>
+ *
+ * Convert the pointer to a nice looking int/long hexadecimal format.
+ *
+ * @return Attributes of the object concatenated in String
+ */
+ @Override
+ public String toString() {
+ String returnData = "0x";
+
+ if (isLong == true) {
+ returnData += Long.toHexString(ptr);
+ }
+ else {
+ returnData += Integer.toHexString((int) ptr);
+ }
+
+ return returnData;
+ }
+}
package org.eclipse.linuxtools.lttng.jni.common;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
+
+
/**
* <b><u>JniTime</u></b>
}
}
- /**
- * Overrided equals for JniTime type
- *
- * @param The object we want to compare too
- *
- * @return true if the time is the same, false otherwise.
- */
- @Override
- public boolean equals(Object obj) {
- boolean returnedValue = false;
-
- if ( obj instanceof JniTime ) {
- if ( ((JniTime)obj).time == this.time ) {
- returnedValue = true;
- }
- }
-
- return returnedValue;
- }
-
- /**
- * Overridden hash code for JniTime type
- *
- */
- @Override
- public int hashCode() {
- return this.toString().hashCode();
- }
-
-
/**
* toString() method.
* <u>Intended to debug</u><p>
* William Bourque (wbourque@gmail.com) - Initial API and implementation
*******************************************************************************/
+
/**
* <b><u>Jni_C_Common</u></b>
* <p>
- * Common constants and methods that should be shared between JNI objects.<p>
- *
- * This class is abstract and is intended to be extended by LTTng modules that need the constants.
+ * Common constants and methods that should be shared between JNI objects
*/
public abstract class Jni_C_Constant {
// Timestamps are in nanoseconds, this const ease up the math
public static final long NANO = 1000000000;
- /**
- * Default constructor
- */
- public Jni_C_Constant() {
- }
-
/**
* "Alternate" .toString()<p>
*
package org.eclipse.linuxtools.lttng.jni.common;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
+
/**
* <b><u>Jni_C_Pointer</u></b>
*/
public class Jni_C_Pointer extends Jni_C_Constant {
- protected long ptr = NULL;
- protected boolean isLong = true;
+ private long ptr = NULL;
+ private boolean isLong = true;
/**
* Default constructor.<p>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniEventException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniEventOutOfRangeException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniMarkerException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniMarkerFieldException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniNoNextEventInTraceException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniNoSuchEventException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniOpenTraceFailedException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniTraceException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniTraceVersionException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniTracefileException</u></b>
package org.eclipse.linuxtools.lttng.jni.exception;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
/**
* <b><u>JniTracefileWithoutEventException</u></b>
package org.eclipse.linuxtools.lttng.jni.factory;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni_v2_5.JniTrace_v2_5;
import org.eclipse.linuxtools.lttng.jni_v2_6.JniTrace_v2_6;
-/**
- * <b><u>JniTraceFactory</u></b>
- * <p>
- * This class factory is responsible of returning the correct JniTrace implementation from a (valid) trace path.<p>
- *
- * The different version supported are listed below and the same version string are expected to be returned by JniTraceVersion.<br>
- * Each version need a different Lttv library so each need its liblttvtraceread-X.Y.so installed and available on the system.
- *
- */
public class JniTraceFactory {
- // ***
- // Version string of the supported library version
- // These will be used in the switch below to find the correct version
- // ***
static final String TraceVersion_v2_3 = "2.3";
static final String TraceVersion_v2_5 = "2.5";
static final String TraceVersion_v2_6 = "2.6";
- /*
- * Default constructor is forbidden
- */
private JniTraceFactory(){
+ // Default constructor is forbidden
}
- /**
- * Factory function : return the correct version of the JniTrace from a given path<p>
- * NOTE : The correct Lttv library (liblttvtraceread-X.Y.so) need to be installed and accessible otherwise this
- * function will return an Exception.
- *
- * If the path is wrong or if the library is not supported (bad version or missing library) an Exception will be throwed.
- *
- * @param path Path of the trace we want to open
- * @param show_debug Should JniTrace print debug or not?
- *
- * @return a newly allocated JniTrace of the correct version
- *
- * @throws JniException
- */
static public JniTrace getJniTrace(String path, boolean show_debug) throws JniException {
try {
JniTraceVersion traceVersion = new JniTraceVersion(path);
- if ( traceVersion.getVersionAsString().equals(TraceVersion_v2_6) ) {
- return new JniTrace_v2_6(path, show_debug);
+ if ( traceVersion.toString().equals(TraceVersion_v2_6) ) {
+ return new JniTrace_v2_6(path);
}
- else if ( traceVersion.getVersionAsString().equals(TraceVersion_v2_5) ) {
- return new JniTrace_v2_5(path, show_debug);
+ else if ( traceVersion.toString().equals(TraceVersion_v2_5) ) {
+ return new JniTrace_v2_5(path);
}
- else if ( traceVersion.getVersionAsString().equals(TraceVersion_v2_3) ) {
- return new JniTrace_v2_3(path, show_debug);
+ else if ( traceVersion.toString().equals(TraceVersion_v2_3) ) {
+ return new JniTrace_v2_3(path);
}
else {
- String errMsg = "\nERROR : Unrecognized/unsupported trace version." +
- "\nLibrary reported a trace version " + traceVersion.getVersionAsString() + "." +
- "\nMake sure you installed the Lttv library that support this version (look for liblttvtraceread-" + traceVersion.getVersionAsString() + ".so).\n";
- throw new JniException(errMsg);
+ throw new JniException("ERROR : Unrecognized/unsupported trace version.");
}
}
catch (JniTraceVersionException e) {
- String errMsg = "\nERROR : Call to JniTraceVersion() failed." +
- "\nThis usually means that the library (liblttvtraceread_loader.so) could not be found." +
- "\nMake sure the LTTv library is installed and that your LD_LIBRARY_PATH is set correctly (see help for more details)\n.";
- throw new JniException(errMsg);
+ // *** FIXME ***
+ // We should probably fail if the trace version can't be found, however unless
+ // the C library is ajusted, we will always ends up here.
+ // For now, we will default to the trace version 2.5 (what we use for unit tests) so it should still work.
+ // ***
+
+ //throw new JniException("ERROR : Call to JniTraceVersion() failed.");
+ System.out.println("WARNING : Call to JniTraceVersion() failed, defaulting to version 2.5.");
+ return new JniTrace_v2_5(path);
}
}
package org.eclipse.linuxtools.lttng.jni.factory;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
-import org.eclipse.linuxtools.lttng.jni.exception.JniException;
import org.eclipse.linuxtools.lttng.jni.exception.JniTraceVersionException;
-/**
- * <b><u>JniTraceVersion</u></b>
- * <p>
- * This class is responsible of returning the correct version number of a trace at a certain given path.<p>
- *
- * The class will call the C library to get the correct version number from the trace.<p>
- *
- * Lttv library loader (liblttvtraceread_loader.so) and the default Lttv library (liblttvtraceread.so) must be installed on system and available to java.
- *
- */
+// *** FIXME ***
+// THIS IS A SKELETON IMPLEMENTATION
+// Nothing here will work as the C library does not support any of those call YET
+// ***
+
public class JniTraceVersion {
- // Native access functions
protected native void ltt_getTraceVersion(String tracepath);
- // Variables to store version number
- private int majorNumber = 0;
- private int minorNumber = 0;
-
- // To store the given tracepath
- private String tracepath = "";
-
- // Was the trace read already?
- private boolean wasTraceRead = false;
-
- /**
- * Default constructor.<p>
- *
- * Do nothing, readVersionFromTrace(path) will need to be called by the user
- */
- public JniTraceVersion() {
- // Nothing to do
- }
-
- /**
- * Constructor that takes a tracepath parameter.<p>
- *
- * This constructor read the version number from the trace, so it might throw.
- *
- * @param newTracepath The <b>directory</b> of the trace to read.
- *
- * @exception JniException If the library can not be loaded,if the path is wrong or if something go wrong during the read.
- */
- public JniTraceVersion(String newTracepath) throws JniTraceVersionException {
- // Read the version number from the trace
- readVersionFromTrace(newTracepath);
+ static {
+ System.loadLibrary("lttvtraceread");
}
- /**
- * Copy constructor.
- *
- * @param oldVersion A reference to the JniTraceVersion to copy.
- */
- public JniTraceVersion(JniTraceVersion oldVersion) {
- majorNumber = oldVersion.majorNumber;
- minorNumber = oldVersion.minorNumber;
- }
+ private int majorNumber = 0;
+ private int minorNumber = 0;
- /*
- * Read the version from the (already set) tracepath.<p>
- *
- * This version is used internally and will silently dismiss any exceptions.
- *
- */
- private void readVersionNumberNofail() {
- try {
- readVersionFromTrace(tracepath);
- }
- catch(JniTraceVersionException e) {
- // Yes, we do ignore exception.
- }
+ @SuppressWarnings("unused")
+ private JniTraceVersion() {
}
- /**
- * Read the version from the (already set) tracepath.<p>
- *
- * This function throw if the library can not be loaded, if the path is wrong or if something go wrong during the read.
- *
- */
- public void readVersionNumber() throws JniTraceVersionException {
- readVersionFromTrace(tracepath);
+ public JniTraceVersion(int newMajor, int newMinor) {
+ majorNumber = newMajor;
+ minorNumber = newMinor;
}
- /**
- * Read the version from a given tracepath.<p>
- * MajorVersion and MinorVersion should be set after a successful execution of this function.<br>
- *
- * This function throw if the library can not be loaded,if the path is wrong or if something go wrong during the read.
- *
- */
- public void readVersionFromTrace(String newTracepath) throws JniTraceVersionException {
-
- // Verify that the tracepath isn't obliviously wrong (null or empty)
- if ( (newTracepath == null) || (newTracepath.equals("") ) ) {
- throw new JniTraceVersionException("ERROR : Tracepath is null or empty! (readVersionNumber)");
- }
- else {
- // Otherwise set the path in case it was changed
- tracepath = newTracepath;
- }
-
+ public JniTraceVersion(String tracepath) throws JniTraceVersionException {
try {
- // Load the C library here.
- // If LD_LIBRARY_PATH is not set correctly this will raise a java.lang.UnsatisfiedLinkError
- System.loadLibrary("lttvtraceread_loader");
-
- // Assuming the C library loaded correctly, call the JNI here.
ltt_getTraceVersion(tracepath);
-
- // We can now assume that the trace was read
- wasTraceRead = true;
}
- // The library was unable to load -> Lttv not installed or bad version of it?
catch (java.lang.UnsatisfiedLinkError e) {
- throw new JniTraceVersionException("\nERROR : Could not get trace version. Is the library missing?" +
- "\nMake sure your \"LD_LIBRARY_PATH\" is setted correctly (readVersionNumber)\n");
+ throw new JniTraceVersionException("ERROR : Could not get trace version. Is the library missing?");
}
- // Something else failed -> Possibly a bad tracepath was given
catch (Exception e) {
- throw new JniTraceVersionException("\nERROR : Call to ltt_getTraceVersion failed. (readVersionNumber)\n");
+ throw new JniTraceVersionException("ERROR : Call to ltt_getTraceVersion failed.");
}
}
- /**
- * Get major version number of the trace.<p>
- * Note : readVersionFromTrace() will be called if it wasn't done but exception will be silently ignored.
- *
- * @return major version
- */
+ public JniTraceVersion(JniTraceVersion oldVersion) {
+ majorNumber = oldVersion.majorNumber;
+ minorNumber = oldVersion.minorNumber;
+ }
+
public int getMajor() {
- if ( wasTraceRead == false ) {
- readVersionNumberNofail();
- }
-
return majorNumber;
}
- /**
- * Get minor version number of the trace.<p>
- * Note : readVersionFromTrace() will be called if it wasn't done but exception will be silently ignored.
- *
- * @return minor version
- */
public int getMinor() {
- if ( wasTraceRead == false ) {
- readVersionNumberNofail();
- }
-
return minorNumber;
}
- /**
- * Get full version number of the trace.<p>
- * Note : readVersionFromTrace() will be called if it wasn't done but exception will be silently ignored.
- *
- * @return Full Version as float
- */
- public float getVersionAsFloat() {
- if ( wasTraceRead == false ) {
- readVersionNumberNofail();
- }
-
- return ((float)majorNumber + ((float)minorNumber)/10);
- }
-
- /**
- * Get full version number of the trace.<p>
- * Note : readVersionFromTrace() will be called if it wasn't done but exception will be silently ignored.
- *
- * @return Full Version as string
- */
- public String getVersionAsString() {
- if ( wasTraceRead == false ) {
- readVersionNumberNofail();
- }
-
- return majorNumber + "." + minorNumber;
- }
-
- /**
- * Get for the current tracepath
- *
- * @return The tracepath was are currently using.
- */
- public String getTracepath() {
- return tracepath;
- }
-
- /**
- * Set for the tracepath.<p>
- * NOTE : Changing this will reset the version number currently loaded.
- * NOTE2 : readVersionFromTrace() will be called but exception will be silently ignored.
- *
- * @param newtracepath The net tracepath
- */
- public void setTracepath(String newtracepath) {
- majorNumber = 0;
- minorNumber = 0;
- wasTraceRead = false;
- tracepath = newtracepath;
-
- // Call the read function. This will fill up all the number if it goes well.
- readVersionNumberNofail();
- }
-
- /*
- * This function is be called from the C side to assign the version number the Java variable.
- */
- private void setTraceVersionFromC(int newMajor, int newMinor) {
+ @SuppressWarnings("unused")
+ private void setTraceVersionFromC(int newMajor, int newMinor) {
majorNumber = newMajor;
minorNumber = newMinor;
}
-
- @Override
public String toString() {
- return "JniTraceVersion [" + majorNumber + "." + minorNumber + "]";
+ return majorNumber + "." + minorNumber;
}
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+import java.util.HashMap;
+
+import org.eclipse.linuxtools.lttng.jni.JniMarker;
+import org.eclipse.linuxtools.lttng.jni.JniTracefile;
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniEvent extends org.eclipse.linuxtools.lttng.jni.JniEvent {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+ protected JniEvent() {
+ super();
+ }
+
+ public JniEvent(JniEvent oldEvent) {
+ super(oldEvent);
+ }
+
+
+
+ public JniEvent(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+ super(newEventPtr, newMarkersMap, newParentTracefile);
+ }
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_3;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import java.util.HashMap;
import org.eclipse.linuxtools.lttng.jni.JniEvent;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniEvent_v2_3</u></b>
- * <p>
- * JniEvent version to support Lttng traceformat of version 2.3<br>
- * This class extend abstract class JniEvent with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniEvent_v2_3 extends JniEvent {
+
- /*
- * Forbid access to the default constructor
- */
protected JniEvent_v2_3() {
super();
}
-
public JniEvent_v2_3(JniEvent_v2_3 oldEvent) {
super(oldEvent);
}
- public JniEvent_v2_3(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+
+
+ public JniEvent_v2_3(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
super(newEventPtr, newMarkersMap, newParentTracefile);
}
+
+
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniMarker extends org.eclipse.linuxtools.lttng.jni.JniMarker {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+ protected JniMarker() {
+ super();
+ }
+
+
+ public JniMarker(JniMarker oldMarker) {
+ super(oldMarker);
+ }
+
+
+ public JniMarker(Jni_C_Pointer newMarkerPtr) throws JniException {
+ super(newMarkerPtr);
+ }
+}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniMarkerField extends org.eclipse.linuxtools.lttng.jni.JniMarkerField {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+ protected JniMarkerField() {
+ super();
+ }
+
+
+ public JniMarkerField(JniMarkerField oldMarkerField) {
+ super(oldMarkerField);
+ }
+
+
+ public JniMarkerField(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
+ super(newMarkerFieldPtr);
+ }
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_3;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniMarkerField_v2_3</u></b>
- * <p>
- * JniMarkerField version to support Lttng traceformat of version 2.3<br>
- * This class extend abstract class JniMarkerField with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniMarkerField_v2_3 extends JniMarkerField {
- /*
- * Forbid access to the default constructor
- */
protected JniMarkerField_v2_3() {
super();
}
super(oldMarkerField);
}
- public JniMarkerField_v2_3(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException {
+
+ public JniMarkerField_v2_3(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
super(newMarkerFieldPtr);
}
+
}
package org.eclipse.linuxtools.lttng.jni_v2_3;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniMarker_v2_3</u></b>
- * <p>
- * JniMarker version to support Lttng traceformat of version 2.3<br>
- * This class extend abstract class JniMarker with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniMarker_v2_3 extends JniMarker {
-
- /*
- * Forbid access to the default constructor
- */
+
protected JniMarker_v2_3() {
super();
}
super(oldMarker);
}
- public JniMarker_v2_3(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException {
+
+ public JniMarker_v2_3(Jni_C_Pointer newMarkerPtr) throws JniException {
super(newMarkerPtr);
}
- /**
- * Allocate (call constructor for) a new JniMarkerField.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniMarker
- *
- * @return JniMarkerField a newly allocated JniMarkerField
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
- */
- @Override
- public JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException {
+ public JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
return new JniMarkerField_v2_3(newMarkerFieldPtr);
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+public class JniParser extends org.eclipse.linuxtools.lttng.jni.JniParser {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+ protected JniParser() {
+ super();
+ }
+}
package org.eclipse.linuxtools.lttng.jni_v2_3;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniParser;
-/**
- * <b><u>JniParser_v2_3</u></b>
- * <p>
- * JniParser version to support Lttng traceformat of version 2.3<br>
- * This class extend abstract class JniParser with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniParser_v2_3 extends JniParser {
-
- /*
- * Forbid access to the default constructor
- */
+
protected JniParser_v2_3() {
super();
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+
+public class JniTime extends org.eclipse.linuxtools.lttng.jni.JniTime {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+ public JniTime() {
+ super();
+ }
+
+ public JniTime(JniTime oldTime) {
+ super(oldTime);
+ }
+
+ public JniTime(long newSec, long newNanoSec) {
+ super(newNanoSec);
+ }
+
+ public JniTime(long newNanoSecTime) {
+ super(newNanoSecTime);
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.exception.JniTracefileWithoutEventException;
+import org.eclipse.linuxtools.lttng.jni_v2_3.JniTracefile;
+import org.eclipse.linuxtools.lttng.jni_v2_3.Jni_C_Pointer;
+
+public class JniTrace extends org.eclipse.linuxtools.lttng.jni.JniTrace {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+ protected JniTrace() {
+ super();
+ }
+
+ public JniTrace(String newpath, boolean newPrintDebug) throws JniException {
+ super(newpath, newPrintDebug);
+ }
+
+
+ public JniTrace(JniTrace oldTrace) {
+ super(oldTrace);
+ }
+
+ public JniTrace(Jni_C_Pointer newPtr, boolean newPrintDebug) throws JniException {
+ super(newPtr, newPrintDebug);
+ }
+
+ protected JniTracefile createNewTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
+ return new JniTracefile(newPtr, newParentTrace);
+ }
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_3;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniTrace_v2_3</u></b>
- * <p>
- * JniTrace version to support Lttng traceformat of version 2.3.<br>
- * This class extend abstract class JniTrace with (possibly) version specific implementation.<br>
- *
- * It also make sure the correct library is loaded by liblttvlibraryloader.so
- * <p>
- */
public class JniTrace_v2_3 extends JniTrace {
- // This is the dynamic library name that is passed to the library loader (liblttvlibraryloader.so) to load.
- // It needs to be a complete name, like "libXYZ.so", unlike java that would take "XYZ". It could also take a complete path.
- // The library need to be accessible, i.e. LD_LIBRARY_PATH need to be set correctly.
- private static final String LIBRARY_NAME = "liblttvtraceread-2.3.so";
+ // *** FIXME ***
+ // Eventually, it should be something like this :
+ // private static final String LIBRARY_NAME = "liblttvtraceread2.3.so";
+ // However, the C library is not ready yet, so we will keep the general one :
+ private static final String LIBRARY_NAME = "liblttvtraceread.so";
- /*
- * Forbid access to the default constructor
- */
protected JniTrace_v2_3() {
super();
}
-
public JniTrace_v2_3(String newpath) throws JniException {
super(newpath);
}
super(oldTrace);
}
- public JniTrace_v2_3(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException {
+ public JniTrace_v2_3(Jni_C_Pointer newPtr, boolean newPrintDebug) throws JniException {
super(newPtr, newPrintDebug);
}
- /**
- * Initialize the C library.<p>
- *
- * Call the library loader with the .so we wish to load.
- *
- * @return The library id if sucessful, -1 if something went wrong
- */
- @Override
- public int initializeLibrary() {
+ public boolean initializeLibrary() {
return ltt_initializeHandle(LIBRARY_NAME);
}
- /**
- * Allocate (call constructor for) a new JniTracefile.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTrace
- *
- * @return JniTracefile a newly allocated JniTracefile
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTrace
- */
- @Override
- public JniTracefile allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
+ public JniTracefile allocateNewJniTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
return new JniTracefile_v2_3(newPtr, newParentTrace);
}
+
+
+
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+import org.eclipse.linuxtools.lttng.jni.JniTrace;
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniTracefile extends org.eclipse.linuxtools.lttng.jni.JniTracefile {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+ protected JniTracefile() {
+ super();
+ }
+
+ public JniTracefile(JniTracefile oldTracefile) {
+ super(oldTracefile);
+ }
+
+ public JniTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
+ super(newPtr, newParentTrace);
+ }
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_3;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import java.util.HashMap;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniTracefile_v2_3</u></b>
- * <p>
- * JniTracefile version to support Lttng traceformat of version 2.3<br>
- * This class extend abstract class JniTracefile with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniTracefile_v2_3 extends JniTracefile {
- /*
- * Forbid access to the default constructor
- */
protected JniTracefile_v2_3() {
super();
}
-
public JniTracefile_v2_3(JniTracefile_v2_3 oldTracefile) {
super(oldTracefile);
}
- public JniTracefile_v2_3(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
+ public JniTracefile_v2_3(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
super(newPtr, newParentTrace);
}
- /**
- * Allocate (call constructor for) a new JniEvent.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTracefile
- *
- * @return JniEvent a newly allocated JniEvent
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- */
- @Override
- public JniEvent allocateNewJniEvent(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+ public JniEvent allocateNewJniEvent(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
return new JniEvent_v2_3(newEventPtr, newMarkersMap, newParentTracefile);
}
- /**
- * Allocate (call constructor for) a new JniMarker.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTracefile
- *
- * @return JniMarker a newly allocated JniMarker
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- */
- @Override
- public JniMarker allocateNewJniMarker(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException {
+ public JniMarker allocateNewJniMarker(Jni_C_Pointer newMarkerPtr) throws JniException {
return new JniMarker_v2_3(newMarkerPtr);
}
+
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+public class Jni_C_Common_v2_3 extends org.eclipse.linuxtools.lttng.jni.Jni_C_Common {
+
+ static {
+ System.loadLibrary("lttvtraceread2.3");
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_3;
+
+public class Jni_C_Pointer extends org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer {
+
+ public Jni_C_Pointer() {
+ super();
+ }
+
+ public Jni_C_Pointer(long newPtr) {
+ super(newPtr);
+ }
+
+ public Jni_C_Pointer(int newPtr) {
+ super(newPtr);
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+import java.util.HashMap;
+
+import org.eclipse.linuxtools.lttng.jni.JniMarker;
+import org.eclipse.linuxtools.lttng.jni.JniTracefile;
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniEvent extends org.eclipse.linuxtools.lttng.jni.JniEvent {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+ protected JniEvent() {
+ super();
+ }
+
+ public JniEvent(JniEvent oldEvent) {
+ super(oldEvent);
+ }
+
+
+
+ public JniEvent(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+ super(newEventPtr, newMarkersMap, newParentTracefile);
+ }
+
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_5;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import java.util.HashMap;
import org.eclipse.linuxtools.lttng.jni.JniEvent;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniEvent_v2_5</u></b>
- * <p>
- * JniEvent version to support Lttng traceformat of version 2.5<br>
- * This class extend abstract class JniEvent with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniEvent_v2_5 extends JniEvent {
+
- /*
- * Forbid access to the default constructor
- */
protected JniEvent_v2_5() {
super();
}
-
public JniEvent_v2_5(JniEvent_v2_5 oldEvent) {
super(oldEvent);
}
- public JniEvent_v2_5(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+
+
+ public JniEvent_v2_5(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
super(newEventPtr, newMarkersMap, newParentTracefile);
}
+
+
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniMarker extends org.eclipse.linuxtools.lttng.jni.JniMarker {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+ protected JniMarker() {
+ super();
+ }
+
+
+ public JniMarker(JniMarker oldMarker) {
+ super(oldMarker);
+ }
+
+
+ public JniMarker(Jni_C_Pointer newMarkerPtr) throws JniException {
+ super(newMarkerPtr);
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniMarkerField extends org.eclipse.linuxtools.lttng.jni.JniMarkerField {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+
+ protected JniMarkerField() {
+ super();
+ }
+
+
+ public JniMarkerField(JniMarkerField oldMarkerField) {
+ super(oldMarkerField);
+ }
+
+
+ public JniMarkerField(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
+ super(newMarkerFieldPtr);
+ }
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_5;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniMarkerField_v2_5</u></b>
- * <p>
- * JniMarkerField version to support Lttng traceformat of version 2.5<br>
- * This class extend abstract class JniMarkerField with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniMarkerField_v2_5 extends JniMarkerField {
- /*
- * Forbid access to the default constructor
- */
protected JniMarkerField_v2_5() {
super();
}
super(oldMarkerField);
}
- public JniMarkerField_v2_5(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException {
+
+ public JniMarkerField_v2_5(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
super(newMarkerFieldPtr);
}
+
}
package org.eclipse.linuxtools.lttng.jni_v2_5;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniMarker_v2_5</u></b>
- * <p>
- * JniMarker version to support Lttng traceformat of version 2.5<br>
- * This class extend abstract class JniMarker with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniMarker_v2_5 extends JniMarker {
- /*
- * Forbid access to the default constructor
- */
protected JniMarker_v2_5() {
super();
}
-
+
public JniMarker_v2_5(JniMarker_v2_5 oldMarker) {
super(oldMarker);
}
- public JniMarker_v2_5(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException {
+
+ public JniMarker_v2_5(Jni_C_Pointer newMarkerPtr) throws JniException {
super(newMarkerPtr);
}
- /**
- * Allocate (call constructor for) a new JniMarkerField.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniMarker
- *
- * @return JniMarkerField a newly allocated JniMarkerField
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
- */
- @Override
- public JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException {
+ public JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
return new JniMarkerField_v2_5(newMarkerFieldPtr);
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+public class JniParser extends org.eclipse.linuxtools.lttng.jni.JniParser {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+ protected JniParser() {
+ super();
+ }
+}
package org.eclipse.linuxtools.lttng.jni_v2_5;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniParser;
-/**
- * <b><u>JniParser_v2_5</u></b>
- * <p>
- * JniParser version to support Lttng traceformat of version 2.5<br>
- * This class extend abstract class JniParser with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniParser_v2_5 extends JniParser {
-
- /*
- * Forbid access to the default constructor
- */
+
protected JniParser_v2_5() {
super();
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+public class JniTime extends org.eclipse.linuxtools.lttng.jni.JniTime {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+ public JniTime() {
+ super();
+ }
+
+ public JniTime(JniTime oldTime) {
+ super(oldTime);
+ }
+
+ public JniTime(long newSec, long newNanoSec) {
+ super(newNanoSec);
+ }
+
+ public JniTime(long newNanoSecTime) {
+ super(newNanoSecTime);
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+import org.eclipse.linuxtools.lttng.jni.exception.JniTracefileWithoutEventException;
+import org.eclipse.linuxtools.lttng.jni_v2_3.JniTracefile;
+
+public class JniTrace extends org.eclipse.linuxtools.lttng.jni.JniTrace {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+ protected JniTrace() {
+ super();
+ }
+
+
+ public JniTrace(String newpath, boolean newPrintDebug) throws JniException {
+ super(newpath, newPrintDebug);
+ }
+
+
+ public JniTrace(JniTrace oldTrace) {
+ super(oldTrace);
+ }
+
+ public JniTrace(Jni_C_Pointer newPtr, boolean newPrintDebug) throws JniException {
+ super(newPtr, newPrintDebug);
+ }
+}
package org.eclipse.linuxtools.lttng.jni_v2_5;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniTrace_v2_5</u></b>
- * <p>
- * JniTrace version to support Lttng traceformat of version 2.5.<br>
- * This class extend abstract class JniTrace with (possibly) version specific implementation (none yet).<br>
- *
- * It also make sure the correct library is loaded by liblttvlibraryloader.so
- * <p>
- */
public class JniTrace_v2_5 extends JniTrace {
- // This is the dynamic library name that is passed to the library loader (liblttvlibraryloader.so) to load.
- // It needs to be a complete name, like "libXYZ.so", unlike java that would take "XYZ". It could also take a complete path.
- // The library need to be accessible, i.e. LD_LIBRARY_PATH need to be set correctly.
- private static final String LIBRARY_NAME = "liblttvtraceread-2.5.so";
+ // *** FIXME ***
+ // Eventually, it should be something like this :
+ // private static final String LIBRARY_NAME = "liblttvtraceread2.5.so";
+ // However, the C library is not ready yet, so we will keep the general one :
+ private static final String LIBRARY_NAME = "liblttvtraceread.so";
- /*
- * Forbid access to the default constructor
- */
protected JniTrace_v2_5() {
super();
}
-
public JniTrace_v2_5(String newpath) throws JniException {
super(newpath);
}
super(oldTrace);
}
- public JniTrace_v2_5(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException {
+ public JniTrace_v2_5(Jni_C_Pointer newPtr, boolean newPrintDebug) throws JniException {
super(newPtr, newPrintDebug);
}
- /**
- * Initialize the C library.<p>
- *
- * Call the library loader with the .so we wish to load.
- *
- * @return True if the load went successful, false otherwise.
- */
- @Override
- public int initializeLibrary() {
+ public boolean initializeLibrary() {
return ltt_initializeHandle(LIBRARY_NAME);
}
- /**
- * Allocate (call constructor for) a new JniTracefile.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTrace
- *
- * @return JniTracefile a newly allocated JniTracefile
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTrace
- */
- @Override
- public JniTracefile allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
+ public JniTracefile allocateNewJniTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
return new JniTracefile_v2_5(newPtr, newParentTrace);
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+import org.eclipse.linuxtools.lttng.jni.JniTrace;
+import org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer;
+import org.eclipse.linuxtools.lttng.jni.exception.JniException;
+
+public class JniTracefile extends org.eclipse.linuxtools.lttng.jni.JniTracefile {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+ protected JniTracefile() {
+ super();
+ }
+
+ public JniTracefile(JniTracefile oldTracefile) {
+ super(oldTracefile);
+ }
+
+ public JniTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
+ super(newPtr, newParentTrace);
+ }
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_5;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import java.util.HashMap;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniTracefile_v2_5</u></b>
- * <p>
- * JniTracefile version to support Lttng traceformat of version 2.5<br>
- * This class extend abstract class JniTracefile with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniTracefile_v2_5 extends JniTracefile {
- /*
- * Forbid access to the default constructor
- */
protected JniTracefile_v2_5() {
super();
}
-
public JniTracefile_v2_5(JniTracefile_v2_5 oldTracefile) {
super(oldTracefile);
}
- public JniTracefile_v2_5(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
+ public JniTracefile_v2_5(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
super(newPtr, newParentTrace);
}
- /**
- * Allocate (call constructor for) a new JniEvent.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTracefile
- *
- * @return JniEvent a newly allocated JniEvent
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- */
- @Override
- public JniEvent allocateNewJniEvent(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+ public JniEvent allocateNewJniEvent(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
return new JniEvent_v2_5(newEventPtr, newMarkersMap, newParentTracefile);
}
- /**
- * Allocate (call constructor for) a new JniMarker.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTracefile
- *
- * @return JniMarker a newly allocated JniMarker
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- */
- @Override
- public JniMarker allocateNewJniMarker(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException {
+ public JniMarker allocateNewJniMarker(Jni_C_Pointer newMarkerPtr) throws JniException {
return new JniMarker_v2_5(newMarkerPtr);
}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+public class Jni_C_Common extends org.eclipse.linuxtools.lttng.jni.Jni_C_Common {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+}
--- /dev/null
+package org.eclipse.linuxtools.lttng.jni_v2_5;
+
+public class Jni_C_Pointer extends org.eclipse.linuxtools.lttng.jni.Jni_C_Pointer {
+
+ static {
+ System.loadLibrary("lttvtraceread2.5");
+ }
+
+}
package org.eclipse.linuxtools.lttng.jni_v2_6;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import java.util.HashMap;
import org.eclipse.linuxtools.lttng.jni.JniEvent;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniEvent_v2_6</u></b>
- * <p>
- * JniEvent version to support Lttng traceformat of version 2.6<br>
- * This class extend abstract class JniEvent with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniEvent_v2_6 extends JniEvent {
+
- /*
- * Forbid access to the default constructor
- */
protected JniEvent_v2_6() {
super();
}
-
public JniEvent_v2_6(JniEvent_v2_6 oldEvent) {
super(oldEvent);
}
- public JniEvent_v2_6(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+
+
+ public JniEvent_v2_6(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
super(newEventPtr, newMarkersMap, newParentTracefile);
}
package org.eclipse.linuxtools.lttng.jni_v2_6;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniMarkerField_v2_6</u></b>
- * <p>
- * JniMarkerField version to support Lttng traceformat of version 2.6<br>
- * This class extend abstract class JniMarkerField with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniMarkerField_v2_6 extends JniMarkerField {
- /*
- * Forbid access to the default constructor
- */
protected JniMarkerField_v2_6() {
super();
}
super(oldMarkerField);
}
- public JniMarkerField_v2_6(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException {
+
+ public JniMarkerField_v2_6(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
super(newMarkerFieldPtr);
}
+
}
package org.eclipse.linuxtools.lttng.jni_v2_6;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniMarkerField;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniMarker_v2_6</u></b>
- * <p>
- * JniMarker version to support Lttng traceformat of version 2.6<br>
- * This class extend abstract class JniMarker with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniMarker_v2_6 extends JniMarker {
- /*
- * Forbid access to the default constructor
- */
protected JniMarker_v2_6() {
super();
}
-
+
public JniMarker_v2_6(JniMarker_v2_6 oldMarker) {
super(oldMarker);
}
- public JniMarker_v2_6(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException {
+
+ public JniMarker_v2_6(Jni_C_Pointer newMarkerPtr) throws JniException {
super(newMarkerPtr);
}
- /**
- * Allocate (call constructor for) a new JniMarkerField.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniMarker
- *
- * @return JniMarkerField a newly allocated JniMarkerField
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniMarker
- */
- @Override
- public JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer_And_Library_Id newMarkerFieldPtr) throws JniException {
+ public JniMarkerField allocateNewJniMarkerField(Jni_C_Pointer newMarkerFieldPtr) throws JniException {
return new JniMarkerField_v2_6(newMarkerFieldPtr);
}
+
}
package org.eclipse.linuxtools.lttng.jni_v2_6;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniParser;
-/**
- * <b><u>JniParser_v2_6</u></b>
- * <p>
- * JniParser version to support Lttng traceformat of version 2.6<br>
- * This class extend abstract class JniParser with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniParser_v2_6 extends JniParser {
-
- /*
- * Forbid access to the default constructor
- */
+
protected JniParser_v2_6() {
super();
}
package org.eclipse.linuxtools.lttng.jni_v2_6;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniTrace_v2_6</u></b>
- * <p>
- * JniTrace version to support Lttng traceformat of version 2.6.<br>
- * This class extend abstract class JniTrace with (possibly) version specific implementation (none yet).<br>
- *
- * It also make sure the correct library is loaded by liblttvlibraryloader.so
- * <p>
- */
public class JniTrace_v2_6 extends JniTrace {
- // This is the dynamic library name that is passed to the library loader (liblttvlibraryloader.so) to load.
- // It needs to be a complete name, like "libXYZ.so", unlike java that would take "XYZ". It could also take a complete path.
- // The library need to be accessible, i.e. LD_LIBRARY_PATH need to be set correctly.
- private static final String LIBRARY_NAME = "liblttvtraceread-2.6.so";
+ // *** FIXME ***
+ // Eventually, it should be something like this :
+ // private static final String LIBRARY_NAME = "liblttvtraceread2.6.so";
+ // However, the C library is not ready yet, so we will keep the general one :
+ private static final String LIBRARY_NAME = "liblttvtraceread.so";
- /*
- * Forbid access to the default constructor
- */
protected JniTrace_v2_6() {
super();
}
-
public JniTrace_v2_6(String newpath) throws JniException {
super(newpath);
}
super(newpath, newPrintDebug);
}
+
public JniTrace_v2_6(JniTrace_v2_6 oldTrace) {
super(oldTrace);
}
- public JniTrace_v2_6(Jni_C_Pointer_And_Library_Id newPtr, boolean newPrintDebug) throws JniException {
+ public JniTrace_v2_6(Jni_C_Pointer newPtr, boolean newPrintDebug) throws JniException {
super(newPtr, newPrintDebug);
}
- /**
- * Initialize the C library.<p>
- *
- * Call the library loader with the .so we wish to load.
- *
- * @return True if the load went successful, false otherwise.
- */
- @Override
- public int initializeLibrary() {
+ public boolean initializeLibrary() {
return ltt_initializeHandle(LIBRARY_NAME);
}
-
- /**
- * Allocate (call constructor for) a new JniTracefile.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTrace
- *
- * @return JniTracefile a newly allocated JniTracefile
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTrace
- */
- @Override
- public JniTracefile allocateNewJniTracefile(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
+ public JniTracefile allocateNewJniTracefile(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
return new JniTracefile_v2_6(newPtr, newParentTrace);
}
+
+
+
}
package org.eclipse.linuxtools.lttng.jni_v2_6;
-/*******************************************************************************
- * Copyright (c) 2009 Ericsson
- *
- * All rights reserved. This program and the accompanying materials are
- * made available under the terms of the Eclipse Public License v1.0 which
- * accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * William Bourque (wbourque@gmail.com) - Initial API and implementation
- *******************************************************************************/
import java.util.HashMap;
import org.eclipse.linuxtools.lttng.jni.JniMarker;
import org.eclipse.linuxtools.lttng.jni.JniTrace;
import org.eclipse.linuxtools.lttng.jni.JniTracefile;
-import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer_And_Library_Id;
+import org.eclipse.linuxtools.lttng.jni.common.Jni_C_Pointer;
import org.eclipse.linuxtools.lttng.jni.exception.JniException;
-/**
- * <b><u>JniTracefile_v2_6</u></b>
- * <p>
- * JniTracefile version to support Lttng traceformat of version 2.6<br>
- * This class extend abstract class JniTracefile with (possibly) version specific implementation.<br>
- * <p>
- */
public class JniTracefile_v2_6 extends JniTracefile {
- /*
- * Forbid access to the default constructor
- */
protected JniTracefile_v2_6() {
super();
}
-
public JniTracefile_v2_6(JniTracefile_v2_6 oldTracefile) {
super(oldTracefile);
}
- public JniTracefile_v2_6(Jni_C_Pointer_And_Library_Id newPtr, JniTrace newParentTrace) throws JniException {
+ public JniTracefile_v2_6(Jni_C_Pointer newPtr, JniTrace newParentTrace) throws JniException {
super(newPtr, newParentTrace);
}
- /**
- * Allocate (call constructor for) a new JniEvent.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTracefile
- *
- * @return JniEvent a newly allocated JniEvent
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- */
- @Override
- public JniEvent allocateNewJniEvent(Jni_C_Pointer_And_Library_Id newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
+ public JniEvent allocateNewJniEvent(Jni_C_Pointer newEventPtr, HashMap<Integer, JniMarker> newMarkersMap, JniTracefile newParentTracefile) throws JniException {
return new JniEvent_v2_6(newEventPtr, newMarkersMap, newParentTracefile);
}
- /**
- * Allocate (call constructor for) a new JniMarker.<p>
- *
- * This method is made to bypass limitation related to abstract class, see comment in JniTracefile
- *
- * @return JniMarker a newly allocated JniMarker
- *
- * @see org.eclipse.linuxtools.lttng.jni.JniTracefile
- */
- @Override
- public JniMarker allocateNewJniMarker(Jni_C_Pointer_And_Library_Id newMarkerPtr) throws JniException {
+ public JniMarker allocateNewJniMarker(Jni_C_Pointer newMarkerPtr) throws JniException {
return new JniMarker_v2_6(newMarkerPtr);
}