From: William Bourque Date: Thu, 11 Mar 2010 22:33:30 +0000 (-0500) Subject: Added functions to ease support of multiple version of traces X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=dd69719a1431648e397b6a6bd3448abf35f4117c;p=lttv.git Added functions to ease support of multiple version of traces --- diff --git a/ltt/Makefile.am b/ltt/Makefile.am index f503e633..0561067d 100644 --- a/ltt/Makefile.am +++ b/ltt/Makefile.am @@ -12,10 +12,13 @@ lib_LTLIBRARIES = liblttvtraceread.la if BUILD_JNI_INTERFACE liblttvtraceread_la_SOURCES = jni_interface.c tracefile.c marker.c event.c +liblttvtraceread_loader_la_SOURCES= lttvtraceread_loader.c else liblttvtraceread_la_SOURCES = tracefile.c marker.c event.c endif +liblttvtraceread_la_LDFLAGS = -release 2.3 + noinst_HEADERS = ltt-private.h lttinclude_HEADERS = \ @@ -28,3 +31,4 @@ lttinclude_HEADERS = \ event.h\ marker-desc.h\ ltt-types.h + diff --git a/ltt/jni_interface.c b/ltt/jni_interface.c index d61f39a0..c6182b12 100644 --- a/ltt/jni_interface.c +++ b/ltt/jni_interface.c @@ -1,5 +1,22 @@ - -// !! Important to get consistent size_t type +/* This file is part of the Linux Trace Toolkit viewer + * Copyright (C) 2010 William Bourque + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License Version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* Important to get consistent size_t type */ #define _FILE_OFFSET_BITS 64 #include @@ -14,171 +31,222 @@ #include #include -// *** FIXME *** -// *** HACK *** -// We've got hell of a problem passing "unsigned int64" to java, as there is no equivalent type -// The closer we can use is "long" which is signed, so only 32 (or 63?) bits are valid -// Plus, even if we are within the "32 bits" capacity, java sometime screw itself trying to convert "unsigned 64 -> signed 64" -// This happen especially often when RETURNING a jlong -// So when returning a jlong, we should convert it like this : "unsigned 64"->"signed 64"->jlong +/* +***FIXME*** +***HACK*** + We've got hell of a problem passing "unsigned int64" to java, as there is no equivalent type + The closer we can use is "long" which is signed, so only 32 (or 63?) bits are valid + Plus, even if we are within the "32 bits" capacity, java sometime screw itself trying to convert "unsigned 64 -> signed 64" + This happen especially often when RETURNING a jlong + So when returning a jlong, we should convert it like this : "unsigned 64"->"signed 64"->jlong +*/ #define CONVERT_UINT64_TO_JLONG(n) (jlong)(gint64)(n) #define CONVERT_INT64_TO_JLONG(n) (jlong)(gint64)(n) -// To ease calcul involving nano +/* To ease calcul involving nano */ #define BILLION 1000000000 #if __WORDSIZE == 64 #define CONVERT_JLONG_TO_PTR(p) (p) #define CONVERT_PTR_TO_JLONG(p) (jlong)(p) - // Define the "gint" type we should use for pointer. + /* Define the "gint" type we should use for pointer. */ #define GINT_TYPE_FOR_PTR gint64 #else - // Conversion to int first to save warning + /* Conversion to int first to save warning */ #define CONVERT_JLONG_TO_PTR(p) (int)(p) #define CONVERT_PTR_TO_JLONG(p) (jlong)(int)(p) - // Define the "gint" type we should use for pointer. + /* Define the "gint" type we should use for pointer. */ #define GINT_TYPE_FOR_PTR gint32 #endif -// Structure to encapsulate java_data to pass as arguments +/* Structure to encapsulate java_data to pass as arguments */ struct java_calling_data { - JNIEnv* env; + JNIEnv *env; jobject jobj; }; -// *** TODO ** -// Find a better way! This is ugly! +/* ***TODO*** + All these struct are used to call g_datalist_foreach() + Find a better way! This is ugly! +*/ struct addMarkersArgs { - struct java_calling_data* java_args; - struct marker_data* mdata; + struct java_calling_data *java_args; + struct marker_data *mdata; }; +struct saveTimeArgs +{ + GArray *saveTimeArray; +}; -// ### COMMON Methods ### -// # -// JNI method to call printf from the java side -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_1printC(JNIEnv* env, jobject jobj, jstring new_string) +struct saveTimeAndTracefile { - printf("%s", (*env)->GetStringUTFChars(env, new_string, 0) ); + LttTime time; + LttTracefile *tracefile; +}; + +/* +### COMMON Methods ### +# +Empty method to turn off the debug (debug waste time while printing) */ +void ignore_and_drop_message(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { } -// # -// #### + +/* JNI method to call printf from the java side */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_1printC(JNIEnv *env, jobject jobj, jstring new_string) { + const char *c_msg = (*env)->GetStringUTFChars(env, new_string, 0); + + printf("%s", c_msg ); + + (*env)->ReleaseStringUTFChars(env, new_string, c_msg); +} +/* +# +#### */ -// ### TRACE methods ### -// # -// JNI mapping of < LttTrace *ltt_trace_open(const gchar *pathname) > (trace.h) -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1openTrace(JNIEnv* env, jobject jobj, jstring pathname) { - const char* c_pathname = (*env)->GetStringUTFChars(env, pathname, 0); - LttTrace* newPtr = ltt_trace_open( c_pathname ); +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_factory_JniTraceVersion_ltt_1getTraceVersion(JNIEnv *env, jobject jobj, jstring tracepath) { + + const gchar *c_pathname = (*env)->GetStringUTFChars(env, tracepath, 0); + jint tmpMajorNumber = 0; + jint tmpMinorNumber = 0; + + jclass accessClass = (*env)->GetObjectClass(env, jobj); + jmethodID accessFunction = (*env)->GetMethodID(env, accessClass, "setTraceVersionFromC", "(II)V"); + + struct LttTraceVersion version_number; + + if ( get_version(c_pathname, &version_number) >= 0) { + tmpMajorNumber = version_number.ltt_major_version; + tmpMinorNumber = version_number.ltt_minor_version; + } + + (*env)->CallVoidMethod(env, jobj, accessFunction, tmpMajorNumber, tmpMinorNumber ); +} + + +/* +### TRACE methods ### +# +JNI mapping of < LttTrace *ltt_trace_open(const gchar *pathname) > (trace.h) */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1openTrace(JNIEnv *env, jobject jobj, jstring pathname, jboolean show_debug) { + + if ( !show_debug) { + /* Make sure we don't use any debug (speed up the read) */ + g_log_set_handler(NULL, G_LOG_LEVEL_INFO, ignore_and_drop_message, NULL); + g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, ignore_and_drop_message, NULL); + } + + const char *c_pathname = (*env)->GetStringUTFChars(env, pathname, 0); + LttTrace *newPtr = ltt_trace_open( c_pathname ); (*env)->ReleaseStringUTFChars(env, pathname, c_pathname); return CONVERT_PTR_TO_JLONG(newPtr); } -// JNI mapping of < void ltt_trace_close(LttTrace *t) > (trace.h) -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1closeTrace(JNIEnv* env, jobject jobj, jlong trace_ptr){ +/* JNI mapping of < void ltt_trace_close(LttTrace *t) > (trace.h) */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1closeTrace(JNIEnv *env, jobject jobj, jlong trace_ptr){ - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); ltt_trace_close(newPtr); } -// Get the tracepath -JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getTracepath(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get the tracepath */ +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getTracepath(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (*env)->NewStringUTF(env, g_quark_to_string( newPtr->pathname) ); } -// Get of num_cpu -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getCpuNumber(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of num_cpu */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getCpuNumber(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jint)newPtr->num_cpu; } -// Get of arch_type -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchType(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of arch_type */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchType(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jlong)newPtr->arch_type; } -// Get of arch_variant -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchVariant(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of arch_variant */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchVariant(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jlong)newPtr->arch_variant; } -// Get of arch_size -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchSize(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of arch_size */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchSize(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jshort)newPtr->arch_size; } -// Get of ltt_major_version -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMajorVersion(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of ltt_major_version */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMajorVersion(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jshort)newPtr->ltt_major_version; } -// Get of ltt_minor_version -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMinorVersion(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of ltt_minor_version */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMinorVersion(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jshort)newPtr->ltt_minor_version; } -// Get of flight_recorder -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFlightRecorder(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of flight_recorder */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFlightRecorder(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jshort)newPtr->flight_recorder; } -// Get of freq_scale -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFreqScale(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of freq_scale */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFreqScale(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return (jlong)newPtr->freq_scale; } -// Get of start_freq -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartFreq(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of start_freq */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartFreq(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->start_freq); } -// Get of start_tsc -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartTimestampCurrentCounter(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of start_tsc */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartTimestampCurrentCounter(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->start_tsc); } -// Get of start_monotonic -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartMonotonic(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Get of start_monotonic */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartMonotonic(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->start_monotonic); } -// Access to start_time -// Note that we are calling the setTimeFromC function in Jaf_Time from here -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTime(JNIEnv* env, jobject jobj, jlong trace_ptr, jobject time_jobj) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Access to start_time */ +/* Note that we are calling the setTimeFromC function in Jaf_Time from here */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTime(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject time_jobj) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); jclass accessClass = (*env)->GetObjectClass(env, time_jobj); jmethodID accessFunction = (*env)->GetMethodID(env, accessClass, "setTimeFromC", "(J)V"); @@ -188,10 +256,10 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedS (*env)->CallVoidMethod(env, time_jobj, accessFunction, fullTime ); } -// Access to start_time_from_tsc -// Note that we are calling the setTimeFromC function in Jaf_Time from here -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTimeFromTimestampCurrentCounter(JNIEnv* env, jobject jobj, jlong trace_ptr, jobject time_jobj) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Access to start_time_from_tsc */ +/* Note that we are calling the setTimeFromC function in Jaf_Time from here */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTimeFromTimestampCurrentCounter(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject time_jobj) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); jclass accessClass = (*env)->GetObjectClass(env, time_jobj); jmethodID accessFunction = (*env)->GetMethodID(env, accessClass, "setTimeFromC", "(J)V"); @@ -202,20 +270,20 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedS } -// g_list_data function for the "for_each" call in Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getAllTracefiles +/* g_list_data function for the "for_each" call in Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getAllTracefiles */ void g_datalist_foreach_addTracefilesOfTrace(GQuark name, gpointer data, gpointer user_data) { - struct java_calling_data* args = (struct java_calling_data*)user_data; + struct java_calling_data *args = (struct java_calling_data*)user_data; jclass accessClass = (*args->env)->GetObjectClass(args->env, args->jobj); jmethodID accessFunction = (*args->env)->GetMethodID(args->env, accessClass, "addTracefileFromC", "(Ljava/lang/String;J)V"); - GArray* group = (GArray*)data; - LttTracefile* tracefile; + GArray *tracefile_array = (GArray*)data; + LttTracefile *tracefile; jlong newPtr; unsigned int i; - for (i=0; ilen; i++) { - tracefile = &g_array_index(group, LttTracefile, i); + for (i=0; ilen; i++) { + tracefile = &g_array_index(tracefile_array, LttTracefile, i); newPtr = CONVERT_PTR_TO_JLONG(tracefile); @@ -223,9 +291,9 @@ void g_datalist_foreach_addTracefilesOfTrace(GQuark name, gpointer data, gpointe } } -// Function to fill up the java map with the event type found in tracefile (the name) -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getAllTracefiles(JNIEnv* env, jobject jobj, jlong trace_ptr) { - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); +/* Function to fill up the java map with the event type found in tracefile (the name) */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedAllTracefiles(JNIEnv *env, jobject jobj, jlong trace_ptr) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); struct java_calling_data args = { env, jobj }; @@ -233,10 +301,83 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getAl } -// Function to print the content of a tracefile -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1printTrace(JNIEnv* env, jobject jobj, jlong trace_ptr) { +/* g_list_data function for the "for_each" call in Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange */ +/* used to save the current timestamp for each tracefile */ +void g_datalist_foreach_saveTracefilesTime(GQuark name, gpointer data, gpointer user_data) { + struct saveTimeArgs *args = (struct saveTimeArgs*)user_data; + + GArray *tracefile_array = (GArray*)data; + GArray *save_array = args->saveTimeArray; + + LttTracefile *tracefile; + struct saveTimeAndTracefile *savedData; + + unsigned int i; + for (i=0; ilen; i++) { + tracefile = &g_array_index(tracefile_array, LttTracefile, i); + + /* Allocate a new LttTime for each tracefile (so it won't change if the tracefile seek somewhere else) */ + savedData = (struct saveTimeAndTracefile*)malloc( sizeof(struct saveTimeAndTracefile) ); + savedData->time.tv_sec = tracefile->event.event_time.tv_sec; + savedData->time.tv_nsec = tracefile->event.event_time.tv_nsec; + savedData->tracefile = tracefile; + /* Append the saved data to the array */ + g_array_append_val(save_array, savedData); + } +} + + +/* Obtain the range of the trace (i.e. "start time" and "end time") */ +/* Note : This function, unlike ltt_trace_time_span_get, is assured to return all tracefiles to their correct position after operation */ +/* NOTE : this method is quite heavy to use!!! */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject jstart_time, jobject jend_time) { + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); + + /* Allocate ourself a new array to save the data in */ + GArray *savedDataArray = g_array_new(FALSE, FALSE, sizeof(struct saveTimeAndTracefile*) ); + struct saveTimeArgs args = { savedDataArray }; + /* Call g_datalist_foreach_saveTracefilesTime for each element in the GData to save the time */ + g_datalist_foreach(&newPtr->tracefiles, &g_datalist_foreach_saveTracefilesTime, &args); - LttTrace* newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); + /* Call to ltt_trace_time_span_get to find the current start and end time */ + /* NOTE : This WILL change the current block of the tracefile (i.e. its timestamp) */ + LttTime tmpStartTime = { 0, 0 }; + LttTime tmpEndTime = { 0, 0 }; + ltt_trace_time_span_get(newPtr, &tmpStartTime, &tmpEndTime); + + /* Seek back to the correct time for each tracefile and free the allocated memory */ + struct saveTimeAndTracefile *savedData; + unsigned int i; + for (i=0; ilen; i++) { + savedData = g_array_index(savedDataArray, struct saveTimeAndTracefile*, i); + /* Seek back to the correct time */ + /* Some time will not be consistent here (i.e. unitialized data) */ + /* but the seek should work just fine with that */ + ltt_tracefile_seek_time(savedData->tracefile, savedData->time); + + /* Free the memory allocated for this saveTimeAndTracefile entry */ + free( savedData ); + } + /* Free the memory allocated for the GArray */ + g_array_free(savedDataArray, TRUE); + + /* Send the start and end time back to the java */ + /* We do it last to make sure a problem won't leave us with unfred memory */ + jclass startAccessClass = (*env)->GetObjectClass(env, jstart_time); + jmethodID startAccessFunction = (*env)->GetMethodID(env, startAccessClass, "setTimeFromC", "(J)V"); + jlong startTime = (CONVERT_UINT64_TO_JLONG(tmpStartTime.tv_sec)*BILLION) + CONVERT_UINT64_TO_JLONG(tmpStartTime.tv_nsec); + (*env)->CallVoidMethod(env, jstart_time, startAccessFunction, startTime); + + jclass endAccessClass = (*env)->GetObjectClass(env, jend_time); + jmethodID endAccessFunction = (*env)->GetMethodID(env, endAccessClass, "setTimeFromC", "(J)V"); + jlong endTime = (CONVERT_UINT64_TO_JLONG(tmpEndTime.tv_sec)*BILLION) + CONVERT_UINT64_TO_JLONG(tmpEndTime.tv_nsec); + (*env)->CallVoidMethod(env, jend_time, endAccessFunction, endTime); +} + +/* Function to print the content of a trace */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1printTrace(JNIEnv *env, jobject jobj, jlong trace_ptr) { + + LttTrace *newPtr = (LttTrace*)CONVERT_JLONG_TO_PTR(trace_ptr); printf("pathname : %s\n" ,g_quark_to_string(newPtr->pathname) ); printf("num_cpu : %u\n" ,(unsigned int)(newPtr->num_cpu) ); @@ -259,213 +400,216 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1print printf("tracefiles ptr : %p\n" ,newPtr->tracefiles); printf("\n"); } -// # -// ### +/* +# +### */ -// ### TRACEFILE methods ### -// # -// Get of cpu_online -JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsCpuOnline(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* +### TRACEFILE methods ### +# */ + +/* Get of cpu_online */ +JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsCpuOnline(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jboolean)newPtr->cpu_online; } -// Get of long_name -JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilepath(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of long_name */ +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilepath(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (*env)->NewStringUTF(env, g_quark_to_string(newPtr->long_name) ); } -// Get of name -JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilename(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of name */ +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilename(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (*env)->NewStringUTF(env, g_quark_to_string(newPtr->name) ); } -// Get of cpu_num -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCpuNumber(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of cpu_num */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCpuNumber(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jlong)newPtr->cpu_num; } -// Get of tid -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTid(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of tid */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTid(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jlong)newPtr->tid; } -// Get of pgid -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getPgid(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of pgid */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getPgid(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jlong)newPtr->pgid; } -// Get of creation -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCreation(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of creation */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCreation(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->creation); } -// Get of trace -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracePtr(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of trace */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracePtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_PTR_TO_JLONG(newPtr->trace); } -// Get of mdata -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getMarkerDataPtr(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of mdata */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getMarkerDataPtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_PTR_TO_JLONG(newPtr->mdata); } -// Get of fd -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCFileDescriptor(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of fd */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCFileDescriptor(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jint)newPtr->fd; } -// Get of file_size -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getFileSize(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of file_size */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getFileSize(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->file_size); } -// Get of num_blocks -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBlockNumber(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of num_blocks */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBlockNumber(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jlong)newPtr->num_blocks; } -// Get of reverse_bo -JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsBytesOrderReversed(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of reverse_bo */ +JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsBytesOrderReversed(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jboolean)newPtr->reverse_bo; } -// Get of float_word_order -JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsFloatWordOrdered(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of float_word_order */ +JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsFloatWordOrdered(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jboolean)newPtr->float_word_order; } -// Get of alignment -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAlignement(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of alignment */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAlignement(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->alignment); } -// Get of buffer_header_size -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferHeaderSize(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of buffer_header_size */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferHeaderSize(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->buffer_header_size); } -// Get of tscbits -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfCurrentTimestampCounter(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of tscbits */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfCurrentTimestampCounter(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jint)newPtr->tscbits; } -// Get of eventbits -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfEvent(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of eventbits */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jint)newPtr->eventbits; } -// Get of tsc_mask -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMask(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of tsc_mask */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMask(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->tsc_mask); } -// Get of tsc_mask_next_bit -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMaskNextBit(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of tsc_mask_next_bit */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMaskNextBit(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->tsc_mask_next_bit); } -// Get of events_lost -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventsLost(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of events_lost */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventsLost(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jlong)newPtr->events_lost; } -// Get of subbuf_corrupt -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getSubBufferCorrupt(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of subbuf_corrupt */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getSubBufferCorrupt(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jlong)newPtr->subbuf_corrupt; } -// Get of event -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventPtr(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of event */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventPtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_PTR_TO_JLONG(&newPtr->event); } -// Get of buffer -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferPtr(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of buffer */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferPtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return CONVERT_PTR_TO_JLONG(&newPtr->buffer); } -// Get of buf_size -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferSize(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Get of buffer size */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferSize(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); return (jlong)newPtr->buf_size; } -// g_list_data function for the "for_each" call in Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAllMarkers +/* g_list_data function for the "for_each" call in Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAllMarkers */ void g_hash_table_foreach_addMarkersOfTracefile(gpointer key, gpointer data, gpointer user_data) { - struct addMarkersArgs* args = (struct addMarkersArgs*)user_data; - struct java_calling_data* jargs = (struct java_calling_data*)args->java_args; + struct addMarkersArgs *args = (struct addMarkersArgs*)user_data; + struct java_calling_data *jargs = (struct java_calling_data*)args->java_args; jclass accessClass = (*jargs->env)->GetObjectClass(jargs->env, jargs->jobj); jmethodID accessFunction = (*jargs->env)->GetMethodID(jargs->env, accessClass, "addMarkersFromC", "(IJ)V"); unsigned long marker_id = (unsigned long)data; - // The hash table store an ID... we will use the ID to access the array. - GArray* marker = args->mdata->markers; - struct marker_info* newPtr = &g_array_index(marker, struct marker_info, marker_id); + /* The hash table store an ID... we will use the ID to access the array. */ + GArray *marker = args->mdata->markers; + struct marker_info *newPtr = &g_array_index(marker, struct marker_info, marker_id); (*jargs->env)->CallVoidMethod(jargs->env, jargs->jobj, accessFunction, marker_id, CONVERT_PTR_TO_JLONG(newPtr) ); } -// Function to fill up the java map with the event type found in tracefile (the name) -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAllMarkers(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Function to fill up the java map with the event type found in tracefile (the name) */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1feedAllMarkers(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); - // *** TODO *** - // Find a better way! This is ugly! + /* ***TODO*** + Find a better way! This is ugly! */ struct java_calling_data java_args = { env, jobj }; struct addMarkersArgs args = { &java_args, newPtr->mdata }; @@ -473,10 +617,10 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1g } -// Function to print the content of a tracefile -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1printTracefile(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { +/* Function to print the content of a tracefile */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1printTracefile(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); printf("cpu_online : %i\n" ,(int)newPtr->cpu_online); printf("long_name : %s\n" ,g_quark_to_string(newPtr->long_name)); printf("name : %s\n" ,g_quark_to_string(newPtr->name)); @@ -501,60 +645,61 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1p printf("subbuf_corrupt : %u\n" ,(unsigned int)newPtr->subbuf_corrupt); printf("event ptr : %p\n" ,&newPtr->event); printf("buffer ptr : %p\n" ,&newPtr->buffer); - printf("buf_size : %i\n" ,(unsigned int)newPtr->buf_size); printf("\n"); } -// # -// ### +/* +# +### */ -// ### EVENT methods ### -// # +/* +### EVENT methods ### +# */ -// Method to get the read status -// This method will read the next event and then seek back its initial position -// Lttv assume that every tracefile have at least 1 event, but we have not guarantee after this one. -// We will read the next event and return the status of that read -// We will then seek back to our initial position -// Note : this method is expensive and should not be used too often -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* tracefilePtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Method to get the read status */ +/* This method will read the next event and then seek back its initial position */ +/* Lttv assume that every tracefile have at least 1 event, but we have not guarantee after this one. */ +/* We will read the next event and return the status of that read */ +/* We will then seek back to our initial position */ +/* Note : this method is expensive and should not be used too often */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *tracefilePtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); - // Ask ltt to read the next events on the given tracefiles - // Returned value can be : - // 0 if everything went fine (EOK) - // ERANGE = 34 out of range, back to last event (might be system dependent?) - // EPERM = 1 error while reading (might be system dependent?) + /* Ask ltt to read the next events on the given tracefiles + Returned value can be : + 0 if everything went fine (EOK) + ERANGE = 34 out of range, back to last event (might be system dependent?) + EPERM = 1 error while reading (might be system dependent?) */ - // Seek to the start time... this will also read the first event, as we want. + /* Seek to the start time... this will also read the first event, as we want. */ int returnedValue = ltt_tracefile_seek_time(tracefilePtr, ((struct LttTrace)*(tracefilePtr->trace)).start_time_from_tsc); return (jint)returnedValue; } -// Method to read next event -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readNextEvent(JNIEnv* env, jobject jobj, jlong tracefile_ptr) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Method to read next event */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readNextEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); + + /* Ask ltt to read the next events on the given tracefiles + Returned value can be : + 0 if everything went fine (EOK) + ERANGE = 34 out of range, back to last event (might be system dependent?) + EPERM = 1 error while reading (might be system dependent?) */ - // Ask ltt to read the next events on the given tracefiles - // Returned value can be : - // 0 if everything went fine (EOK) - // ERANGE = 34 out of range, back to last event (might be system dependent?) - // EPERM = 1 error while reading (might be system dependent?) + /* ***FIXME*** + This might fail on the FIRST event, as the timestamp before the first read is uninitialized + However, LTT make the assumption that all tracefile have AT LEAST one event, so we got to run with it */ - // *** FIXME *** - // This might fail on the FIRST event, as the timestamp before the first read is uninitialized - // However, LTT make the assumption that all tracefile have AT LEAST one event, so we got to run with it - // - // Save "last time" before moving, to be able to get back if needed + /* Save "last time" before moving, to be able to get back if needed */ LttTime lastTime = newPtr->event.event_time; int returnedValue = ltt_tracefile_read(newPtr); - // According to Ltt documentation, we need to get back to beginning after an error + /* We need to get back to previous after an error to keep a sane state */ if ( returnedValue != 0 ) { ltt_tracefile_seek_time(newPtr, lastTime); } @@ -562,9 +707,9 @@ JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readN return (jint)returnedValue; } -// Method to seek to a certain event -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekEvent(JNIEnv* env, jobject jobj, jlong tracefile_ptr, jobject time_jobj) { - LttTracefile* newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); +/* Method to seek to a certain event */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr, jobject time_jobj) { + LttTracefile *newPtr = (LttTracefile*)CONVERT_JLONG_TO_PTR(tracefile_ptr); guint64 fullTime = 0; @@ -572,71 +717,78 @@ JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekE jmethodID getTimeFunction = (*env)->GetMethodID(env, accessClass, "getTime", "()J"); fullTime = (*env)->CallLongMethod(env, time_jobj, getTimeFunction); - // *** HACK *** - // Conversion from jlong -> C long seems to be particularly sloppy - // Depending how and where (inlined a function or as a single operation) we do this, we might end up with wrong number - // The following asignation of guint64 seems to work well. - // MAKE SURE TO PERFORM SEVERAL TESTS IF YOU CHANGE THIS. + /* ***HACK*** + Conversion from jlong -> C long seems to be particularly sloppy + Depending how and where (inlined a function or as a single operation) we do this, we might end up with wrong number + The following asignation of guint64 seems to work well. + MAKE SURE TO PERFORM SEVERAL TESTS IF YOU CHANGE THIS. */ guint64 seconds = fullTime/BILLION; guint64 nanoSeconds = fullTime%BILLION; LttTime seekTime = { (unsigned long)seconds, (unsigned long)nanoSeconds }; - // Ask ltt to read the next events on the given tracefiles - // Returned value can be : - // 0 if everything went fine (EOK) - // ERANGE = 34 out of range, back to last event (might be system dependent?) - // EPERM = 1 error while reading (might be system dependent?) + /* Ask ltt to read the next events on the given tracefiles + Returned value can be : + 0 if everything went fine (EOK) + ERANGE = 34 out of range, back to last event (might be system dependent?) + EPERM = 1 error while reading (might be system dependent?) */ int returnedValue = ltt_tracefile_seek_time(newPtr, seekTime); return (jint)returnedValue; } -// Get of tracefile -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTracefilePtr(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of tracefile */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTracefilePtr(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return CONVERT_PTR_TO_JLONG(newPtr->tracefile); } -// Get of block -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getBlock(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of block */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getBlock(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return (jlong)newPtr->block; } -// Get of offset -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOffset(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of offset */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOffset(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return (jlong)newPtr->offset; } -// Get of tsc -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCurrentTimestampCounter(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of tsc */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCurrentTimestampCounter(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->tsc); } -// Get of timestamp -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTimestamp(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of timestamp */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTimestamp(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return (jlong)newPtr->timestamp; } -// Get of event_id -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventMarkerId(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of event_id */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventMarkerId(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return (jint)newPtr->event_id; } -// Get of event_time -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedEventTime(JNIEnv* env, jobject jobj, jlong event_ptr, jobject time_jobj) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get time in nanoseconds */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getNanosencondsTime(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); + + return (CONVERT_UINT64_TO_JLONG(newPtr->event_time.tv_sec)*BILLION) + CONVERT_UINT64_TO_JLONG(newPtr->event_time.tv_nsec); +} + +/* Fill event_time into an object */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedEventTime(JNIEnv *env, jobject jobj, jlong event_ptr, jobject time_jobj) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); jclass accessClass = (*env)->GetObjectClass(env, time_jobj); jmethodID accessFunction = (*env)->GetMethodID(env, accessClass, "setTimeFromC", "(J)V"); @@ -646,46 +798,46 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedE (*env)->CallVoidMethod(env, time_jobj, accessFunction, fullTime); } -// Access method to the data -// The data are in "byte" form -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getDataContent(JNIEnv* env, jobject jobj, jlong event_ptr, jlong data_size, jbyteArray dataArray) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Access method to the data */ +/* The data are in "byte" form */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getDataContent(JNIEnv *env, jobject jobj, jlong event_ptr, jlong data_size, jbyteArray dataArray) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); (*env)->SetByteArrayRegion(env, dataArray, 0, (jsize)data_size, newPtr->data); } -// Get of data_size -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventDataSize(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of data_size */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventDataSize(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return (jlong)newPtr->data_size; } -// Get of event_size -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventSize(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of event_size */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventSize(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return (jlong)newPtr->event_size; } -// Get of count -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCount(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of count */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCount(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return (jint)newPtr->count; } -// Get of overflow_nsec -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOverflowNanoSeconds(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Get of overflow_nsec */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOverflowNanoSeconds(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->overflow_nsec); } -// Function to print the content of a event -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1printEvent(JNIEnv* env, jobject jobj, jlong event_ptr) { - LttEvent* newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); +/* Function to print the content of a event */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1printEvent(JNIEnv *env, jobject jobj, jlong event_ptr) { + LttEvent *newPtr = (LttEvent*)CONVERT_JLONG_TO_PTR(event_ptr); printf("tracefile : %p\n" ,(void*)newPtr->tracefile ); printf("block : %u\n" ,(unsigned int)newPtr->block ); @@ -703,43 +855,45 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1print printf("overflow_nsec : %ld\n" ,(long)newPtr->overflow_nsec ); printf("\n"); } -// # -// ### +/* +# +### */ -// ### MARKER method ### -// # +/* +### MARKER method ### +# */ -// Get of name -JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getName(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of name */ +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getName(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (*env)->NewStringUTF(env, g_quark_to_string(newPtr->name)); } -// Get of format -JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getFormatOverview(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of format */ +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getFormatOverview(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (*env)->NewStringUTF(env, newPtr->format); } -// Get of size -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of size */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (jlong)newPtr->size; } -// Method to get all markerField pointers -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAllMarkerFields(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Method to get all markerField pointers */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAllMarkerFields(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); jclass accessClass = (*env)->GetObjectClass(env, jobj); jmethodID accessFunction = (*env)->GetMethodID(env, accessClass, "addMarkerFieldFromC", "(Ljava/lang/String;J)V"); - GArray* field_array = (GArray*)newPtr->fields; - struct marker_field* field; + GArray *field_array = (GArray*)newPtr->fields; + struct marker_field *field; jlong marker_field_ptr; unsigned int i; @@ -754,59 +908,59 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getA -// Get of largest_align -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLargestAlign(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of largest_align */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLargestAlign(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (jshort)newPtr->largest_align; } -// Get of int_size -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getIntSize(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of int_size */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getIntSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (jshort)newPtr->int_size; } -// Get of long_size -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLongSize(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of long_size */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLongSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (jshort)newPtr->long_size; } -// Get of pointer_size -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getPointerSize(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of pointer_size */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getPointerSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (jshort)newPtr->pointer_size; } -// Get of size_t_size -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize_1tSize(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of size_t_size */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize_1tSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (jshort)newPtr->size_t_size; } -// Get of alignment -JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAlignement(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of alignment */ +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAlignement(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return (jshort)newPtr->alignment; } -// Get of next -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getNextMarkerPtr(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Get of next */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getNextMarkerPtr(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); return CONVERT_PTR_TO_JLONG(newPtr->next); } -// Function to print the content of a marker -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1printMarker(JNIEnv* env, jobject jobj, jlong marker_info_ptr) { - struct marker_info* newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); +/* Function to print the content of a marker */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1printMarker(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + struct marker_info *newPtr = (struct marker_info*)CONVERT_JLONG_TO_PTR(marker_info_ptr); printf("name : %s\n" ,g_quark_to_string(newPtr->name) ); printf("format : %s\n" ,newPtr->format ); @@ -821,74 +975,75 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1prin printf("next : %p\n" ,newPtr->next ); printf("\n"); } - -// # -// ### +/* +# +### */ -// ### MARKERFIELD Method -// # +/* +### MARKERFIELD Method +# */ -// Get of name -JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getField(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of name */ +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getField(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return (*env)->NewStringUTF(env, g_quark_to_string(newPtr->name)); } -// Get of type -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getType(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of type */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getType(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return (jint)newPtr->type; } -// Get of offset -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getOffset(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of offset */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getOffset(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->offset); } -// Get of size -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getSize(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of size */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getSize(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->size); } -// Get of alignment -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAlignment(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of alignment */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAlignment(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->alignment); } -// Get of attributes -JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAttributes(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of attributes */ +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAttributes(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return CONVERT_UINT64_TO_JLONG(newPtr->attributes); } -// Get of static_offset -JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getStatic_1offset(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of static_offset */ +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getStatic_1offset(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return (jint)newPtr->static_offset; } -// Get of fmt -JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getFormat(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Get of fmt */ +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getFormat(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); return (*env)->NewStringUTF(env, newPtr->fmt->str); } -// Function to print the content of a marker_field -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1printMarkerField(JNIEnv* env, jobject jobj, jlong marker_field_ptr) { - struct marker_field* newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); +/* Function to print the content of a marker_field */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1printMarkerField(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + struct marker_field *newPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); printf("name : %s\n" ,g_quark_to_string(newPtr->name) ); printf("type : %i\n" ,(int)newPtr->type ); @@ -900,114 +1055,105 @@ JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_ printf("fmt : %s\n" ,newPtr->fmt->str ); printf("\n"); } +/* +# +### */ -// # -// ### +/* +### PARSER Method +# */ -// ### PARSER Method -// # - -// This function will do the actual parsing -// It will then call java to assign the parsed data to the object "javaObj" -JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData(JNIEnv* env, jclass accessClass, jobject javaObj, jlong event_ptr, jlong marker_field_ptr) { +/* This function will do the actual parsing */ +/* It will then call java to assign the parsed data to the object "javaObj" */ +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData(JNIEnv *env, jclass accessClass, jobject javaObj, jlong event_ptr, jlong marker_field_ptr) { LttEvent newEventPtr = *(LttEvent*)(CONVERT_JLONG_TO_PTR(event_ptr)); - struct marker_field* newMarkerFieldPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); + struct marker_field *newMarkerFieldPtr = (struct marker_field*)CONVERT_JLONG_TO_PTR(marker_field_ptr); jmethodID accessFunction = NULL; - // There is a very limited number of type in LTT - // We will switch on the type for this field and act accordingly - // NOTE : We will save all integer into "long" type, as there is no signed/unsigned in java + /* + There is a very limited number of type in LTT + We will switch on the type for this field and act accordingly + NOTE : We will save all integer into "long" type, as there is no signed/unsigned in java */ - // *** HACK *** - // It seems the marker_field->type is absolutely not consistent, especially about pointer! - // Sometime pointer are saved in String, sometime as Int, sometime as pointer... - // We will do an extra check on type "LTT_TYPE_UNSIGNED_INT" to check if the marker_field->format is hint of a pointer + /* ***HACK*** + It seems the marker_field->type is absolutely not consistent, especially about pointer! + Sometime pointer are saved in String, sometime as Int, sometime as pointer... + We will do an extra check on type "LTT_TYPE_UNSIGNED_INT" to check if the marker_field->format is hint of a pointer */ switch ( newMarkerFieldPtr->type ) { case LTT_TYPE_SIGNED_INT : - accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;J)V"); + accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongToParsingFromC", "(Ljava/lang/Object;J)V"); (*env)->CallStaticVoidMethod( env, accessClass, accessFunction, javaObj, - (*env)->NewStringUTF(env, g_quark_to_string(newMarkerFieldPtr->name) ), - ltt_event_get_long_int(&newEventPtr, newMarkerFieldPtr), - (*env)->NewStringUTF(env, newMarkerFieldPtr->fmt->str ) + ltt_event_get_long_int(&newEventPtr, newMarkerFieldPtr) ); break; case LTT_TYPE_UNSIGNED_INT : - - // If the format seems to be a pointer, add it as a pointer + /* If the format seems to be a pointer, add it as a pointer */ if ( (strncmp(newMarkerFieldPtr->fmt->str, "0x%llX", newMarkerFieldPtr->fmt->len) == 0 ) || (strncmp(newMarkerFieldPtr->fmt->str, "%llX", newMarkerFieldPtr->fmt->len) == 0 ) ) { - #if ARCHITECTURE_IS_64BITS == 0 - accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addIntPointerToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;J)V"); + #if __WORDSIZE == 64 + accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongPointerToParsingFromC", "(Ljava/lang/Object;J)V"); #else - accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongPointerToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;J)V"); + accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addIntPointerToParsingFromC", "(Ljava/lang/Object;J)V"); #endif (*env)->CallStaticVoidMethod( env, accessClass, accessFunction, javaObj, - (*env)->NewStringUTF(env, g_quark_to_string(newMarkerFieldPtr->name) ), - CONVERT_PTR_TO_JLONG(ltt_event_get_long_unsigned(&newEventPtr, newMarkerFieldPtr) ), - (*env)->NewStringUTF(env, newMarkerFieldPtr->fmt->str ) + CONVERT_PTR_TO_JLONG(ltt_event_get_long_unsigned(&newEventPtr, newMarkerFieldPtr) ) ); } - // Otherwise, add it as a number + /* Otherwise, add it as a number */ else { - accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;J)V"); + accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongToParsingFromC", "(Ljava/lang/Object;J)V"); (*env)->CallStaticVoidMethod( env, accessClass, accessFunction, javaObj, - (*env)->NewStringUTF(env, g_quark_to_string(newMarkerFieldPtr->name) ), - ltt_event_get_long_unsigned(&newEventPtr, newMarkerFieldPtr), - (*env)->NewStringUTF(env, newMarkerFieldPtr->fmt->str ) + ltt_event_get_long_unsigned(&newEventPtr, newMarkerFieldPtr) ); } break; case LTT_TYPE_POINTER : - #if ARCHITECTURE_IS_64BITS == 0 - accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addIntPointerToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;J)V"); + #if __WORDSIZE == 64 + accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongPointerToParsingFromC", "(Ljava/lang/Object;J)V"); #else - accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addLongPointerToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;J)V"); + accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addIntPointerToParsingFromC", "(Ljava/lang/Object;J)V"); #endif (*env)->CallStaticVoidMethod( env, accessClass, accessFunction, javaObj, - (*env)->NewStringUTF(env, g_quark_to_string(newMarkerFieldPtr->name) ), - CONVERT_PTR_TO_JLONG(*(GINT_TYPE_FOR_PTR*)(newEventPtr.data + newMarkerFieldPtr->offset)), - (*env)->NewStringUTF(env, newMarkerFieldPtr->fmt->str ) + CONVERT_PTR_TO_JLONG(*(GINT_TYPE_FOR_PTR*)(newEventPtr.data + newMarkerFieldPtr->offset)) ); break; case LTT_TYPE_STRING : - accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addStringToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V"); + accessFunction = (*env)->GetStaticMethodID(env, accessClass, "addStringToParsingFromC", "(Ljava/lang/Object;Ljava/lang/String;)V"); (*env)->CallStaticVoidMethod( env, accessClass, accessFunction, javaObj, - (*env)->NewStringUTF(env, g_quark_to_string(newMarkerFieldPtr->name) ), - (*env)->NewStringUTF(env, ltt_event_get_string(&newEventPtr, newMarkerFieldPtr) ), - (*env)->NewStringUTF(env, newMarkerFieldPtr->fmt->str ) + (*env)->NewStringUTF(env, ltt_event_get_string(&newEventPtr, newMarkerFieldPtr) ) ); break; case LTT_TYPE_COMPACT : case LTT_TYPE_NONE : default : - printf("Warning : Unrecognized format type! Skipping! (Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1fillParseArray)"); + printf("Warning : Unrecognized format type! Skipping! (Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData)"); break; } } - -// # -// ### +/* +# +### */ diff --git a/ltt/lttvtraceread_loader.c b/ltt/lttvtraceread_loader.c new file mode 100644 index 00000000..31afa0e5 --- /dev/null +++ b/ltt/lttvtraceread_loader.c @@ -0,0 +1,683 @@ + +/* Important to get consistent size_t type */ +#define _FILE_OFFSET_BITS 64 + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +/* Static handle need to initialized before use */ +void *static_handle = NULL; + +struct function_tables { + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_1printC)(JNIEnv *env, jobject jobj, jstring new_string) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1openTrace)(JNIEnv *env, jobject jobj, jstring pathname, jboolean show_debug) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1closeTrace)(JNIEnv *env, jobject jobj, jlong trace_ptr); + JNIEXPORT jstring JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getTracepath)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getCpuNumber)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchType)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchVariant)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchSize)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMajorVersion)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMinorVersion)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFlightRecorder)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFreqScale)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartFreq)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartTimestampCurrentCounter)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartMonotonic)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTime)(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject time_jobj) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTimeFromTimestampCurrentCounter)(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject time_jobj) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedAllTracefiles)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange)(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject jstart_time, jobject jend_time) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1printTrace)(JNIEnv *env, jobject jobj, jlong trace_ptr) ; + JNIEXPORT jboolean JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsCpuOnline)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jstring JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilepath)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jstring JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilename)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCpuNumber)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTid)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getPgid)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCreation)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracePtr)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getMarkerDataPtr)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCFileDescriptor)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getFileSize)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBlockNumber)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jboolean JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsBytesOrderReversed)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jboolean JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsFloatWordOrdered)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAlignement)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferHeaderSize)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfCurrentTimestampCounter)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfEvent)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMask)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMaskNextBit)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventsLost)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getSubBufferCorrupt)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventPtr)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferPtr)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferSize)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1feedAllMarkers)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1printTracefile)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readNextEvent)(JNIEnv *env, jobject jobj, jlong tracefile_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekEvent)(JNIEnv *env, jobject jobj, jlong tracefile_ptr, jobject time_jobj) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTracefilePtr)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getBlock)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOffset)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCurrentTimestampCounter)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTimestamp)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventMarkerId)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getNanosencondsTime)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedEventTime)(JNIEnv *env, jobject jobj, jlong event_ptr, jobject time_jobj) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getDataContent)(JNIEnv *env, jobject jobj, jlong event_ptr, jlong data_size, jbyteArray dataArray) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventDataSize)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventSize)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCount)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOverflowNanoSeconds)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1printEvent)(JNIEnv *env, jobject jobj, jlong event_ptr) ; + JNIEXPORT jstring JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getName)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jstring JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getFormatOverview)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAllMarkerFields)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLargestAlign)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getIntSize)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLongSize)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getPointerSize)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize_1tSize)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jshort JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAlignement)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getNextMarkerPtr)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1printMarker)(JNIEnv *env, jobject jobj, jlong marker_info_ptr) ; + JNIEXPORT jstring JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getField)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getType)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getOffset)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getSize)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAlignment)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT jlong JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAttributes)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT jint JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getStatic_1offset)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT jstring JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getFormat)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1printMarkerField)(JNIEnv *env, jobject jobj, jlong marker_field_ptr) ; + JNIEXPORT void JNICALL (*Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData)(JNIEnv *env, jclass accessClass, jobject javaObj, jlong event_ptr, jlong marker_field_ptr) ; +}; + +struct function_tables allFunctions; + +void ignore_and_drop_message(const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) { +} + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_factory_JniTraceVersion_ltt_1getTraceVersion(JNIEnv *env, jobject jobj, jstring tracepath) { + + void *handle = dlopen("liblttvtraceread.so", RTLD_LAZY ); + + if (!handle ) { + printf ("WARNING : Failed to initialize library handle from %s!\n", "liblttvtraceread.so"); + } + JNIEXPORT void JNICALL (*functor)(JNIEnv *env, jobject jobj, jstring tracepath); + functor=dlsym(handle, "Java_org_eclipse_linuxtools_lttng_jni_factory_JniTraceVersion_ltt_1getTraceVersion"); + + char *error = dlerror(); + if ( error != NULL) { + printf ("Call failed with : %s\n", error); + } + else { + (*functor)(env, jobj, tracepath); + } +} + +void freeHandle() { + if (static_handle != NULL) { + /* Memory will be freed by dlclose as well */ + dlclose(static_handle); + static_handle = NULL; + } +} + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1freeHandle(JNIEnv *env, jobject jobj) { + // Call function to free the memory + freeHandle(); +} + +JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1initializeHandle(JNIEnv *env, jobject jobj, jstring libname) { + + jboolean result = TRUE; + const char* c_path = (*env)->GetStringUTFChars(env, libname, 0); + + /* ***FIXME *** */ + /* If we free the memory here, we might crash if java is multithreading its call */ + /* We will trust java to call the free by itself (hope!)*/ + //freeHandle(); + + static_handle = dlopen(c_path, RTLD_LAZY ); + + if (!static_handle ) { + printf ("WARNING : Failed to initialize library handle from %s!\n", c_path); + result = FALSE; + } + else { + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_1printC = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_1printC"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1openTrace = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1openTrace"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1closeTrace = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1closeTrace"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getTracepath = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getTracepath"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getCpuNumber = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getCpuNumber"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchType = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchType"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchVariant = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchVariant"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMajorVersion = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMajorVersion"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMinorVersion = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMinorVersion"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFlightRecorder = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFlightRecorder"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFreqScale = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFreqScale"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartFreq = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartFreq"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartTimestampCurrentCounter = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartTimestampCurrentCounter"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartMonotonic = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartMonotonic"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTime = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTime"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTimeFromTimestampCurrentCounter = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTimeFromTimestampCurrentCounter"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedAllTracefiles = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedAllTracefiles"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1printTrace = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1printTrace"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsCpuOnline = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsCpuOnline"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilepath = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilepath"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilename = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilename"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCpuNumber = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCpuNumber"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTid = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTid"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getPgid = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getPgid"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCreation = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCreation"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracePtr = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracePtr"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getMarkerDataPtr = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getMarkerDataPtr"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCFileDescriptor = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCFileDescriptor"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getFileSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getFileSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBlockNumber = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBlockNumber"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsBytesOrderReversed = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsBytesOrderReversed"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsFloatWordOrdered = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsFloatWordOrdered"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAlignement = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAlignement"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferHeaderSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferHeaderSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfCurrentTimestampCounter = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfCurrentTimestampCounter"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfEvent = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfEvent"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMask = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMask"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMaskNextBit = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMaskNextBit"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventsLost = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventsLost"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getSubBufferCorrupt = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getSubBufferCorrupt"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventPtr = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventPtr"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferPtr = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferPtr"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1feedAllMarkers = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1feedAllMarkers"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1printTracefile = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1printTracefile"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readNextEvent = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readNextEvent"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekEvent = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekEvent"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTracefilePtr = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTracefilePtr"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getBlock = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getBlock"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOffset = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOffset"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCurrentTimestampCounter = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCurrentTimestampCounter"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTimestamp = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTimestamp"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventMarkerId = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventMarkerId"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getNanosencondsTime = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getNanosencondsTime"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedEventTime = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedEventTime"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getDataContent = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getDataContent"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventDataSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventDataSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCount = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCount"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOverflowNanoSeconds = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOverflowNanoSeconds"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1printEvent = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1printEvent"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getName = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getName"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getFormatOverview = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getFormatOverview"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAllMarkerFields = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAllMarkerFields"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLargestAlign = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLargestAlign"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getIntSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getIntSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLongSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLongSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getPointerSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getPointerSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize_1tSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize_1tSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAlignement = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAlignement"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getNextMarkerPtr = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getNextMarkerPtr"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1printMarker = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1printMarker"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getField = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getField"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getType = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getType"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getOffset = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getOffset"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getSize = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getSize"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAlignment = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAlignment"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAttributes = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAttributes"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getStatic_1offset = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getStatic_1offset"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getFormat = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getFormat"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1printMarkerField = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1printMarkerField"); + allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData = dlsym(static_handle, "Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData"); + } + + return result; +} + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_1printC(JNIEnv *env, jobject jobj, jstring new_string) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_Jni_1C_1Common_ltt_1printC)(env, jobj, new_string) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1openTrace(JNIEnv *env, jobject jobj, jstring pathname, jboolean show_debug) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1openTrace)(env, jobj, pathname, show_debug) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1closeTrace(JNIEnv *env, jobject jobj, jlong trace_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1closeTrace)(env, jobj, trace_ptr); +} + + +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getTracepath(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getTracepath)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getCpuNumber(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getCpuNumber)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchType(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchType)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchVariant(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchVariant)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchSize(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getArchSize)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMajorVersion(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMajorVersion)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMinorVersion(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getLttMinorVersion)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFlightRecorder(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFlightRecorder)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFreqScale(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getFreqScale)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartFreq(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartFreq)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartTimestampCurrentCounter(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartTimestampCurrentCounter)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartMonotonic(JNIEnv *env, jobject jobj, jlong trace_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1getStartMonotonic)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTime(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject time_jobj) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTime)(env, jobj, trace_ptr, time_jobj) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTimeFromTimestampCurrentCounter(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject time_jobj) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedStartTimeFromTimestampCurrentCounter)(env, jobj, trace_ptr, time_jobj) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedAllTracefiles(JNIEnv *env, jobject jobj, jlong trace_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedAllTracefiles)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange(JNIEnv *env, jobject jobj, jlong trace_ptr, jobject jstart_time, jobject jend_time) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1feedTracefileTimeRange)(env, jobj, trace_ptr, jstart_time, jend_time) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1printTrace(JNIEnv *env, jobject jobj, jlong trace_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTrace_ltt_1printTrace)(env, jobj, trace_ptr) ; +} + + +JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsCpuOnline(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsCpuOnline)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilepath(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilepath)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilename(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracefilename)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCpuNumber(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCpuNumber)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTid(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTid)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getPgid(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getPgid)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCreation(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCreation)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracePtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getTracePtr)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getMarkerDataPtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getMarkerDataPtr)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCFileDescriptor(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCFileDescriptor)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getFileSize(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getFileSize)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBlockNumber(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBlockNumber)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsBytesOrderReversed(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsBytesOrderReversed)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jboolean JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsFloatWordOrdered(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getIsFloatWordOrdered)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAlignement(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getAlignement)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferHeaderSize(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferHeaderSize)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfCurrentTimestampCounter(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfCurrentTimestampCounter)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBitsOfEvent)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMask(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMask)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMaskNextBit(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getCurrentTimestampCounterMaskNextBit)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventsLost(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventsLost)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getSubBufferCorrupt(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getSubBufferCorrupt)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventPtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getEventPtr)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferPtr(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferPtr)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferSize(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1getBufferSize)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1feedAllMarkers(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1feedAllMarkers)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1printTracefile(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniTracefile_ltt_1printTracefile)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1positionToFirstEvent)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readNextEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1readNextEvent)(env, jobj, tracefile_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekEvent(JNIEnv *env, jobject jobj, jlong tracefile_ptr, jobject time_jobj) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1seekEvent)(env, jobj, tracefile_ptr, time_jobj) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTracefilePtr(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTracefilePtr)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getBlock(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getBlock)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOffset(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOffset)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCurrentTimestampCounter(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCurrentTimestampCounter)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTimestamp(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getTimestamp)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventMarkerId(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventMarkerId)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getNanosencondsTime(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getNanosencondsTime)(env, jobj, event_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedEventTime(JNIEnv *env, jobject jobj, jlong event_ptr, jobject time_jobj) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1feedEventTime)(env, jobj, event_ptr, time_jobj) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getDataContent(JNIEnv *env, jobject jobj, jlong event_ptr, jlong data_size, jbyteArray dataArray) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getDataContent)(env, jobj, event_ptr, data_size, dataArray) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventDataSize(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventDataSize)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventSize(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getEventSize)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCount(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getCount)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOverflowNanoSeconds(JNIEnv *env, jobject jobj, jlong event_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1getOverflowNanoSeconds)(env, jobj, event_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1printEvent(JNIEnv *env, jobject jobj, jlong event_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniEvent_ltt_1printEvent)(env, jobj, event_ptr) ; +} + + +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getName(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getName)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getFormatOverview(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getFormatOverview)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAllMarkerFields(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAllMarkerFields)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLargestAlign(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLargestAlign)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getIntSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getIntSize)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLongSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getLongSize)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getPointerSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getPointerSize)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize_1tSize(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getSize_1tSize)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jshort JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAlignement(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getAlignement)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getNextMarkerPtr(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1getNextMarkerPtr)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1printMarker(JNIEnv *env, jobject jobj, jlong marker_info_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarker_ltt_1printMarker)(env, jobj, marker_info_ptr) ; +} + + +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getField(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getField)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getType(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getType)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getOffset(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getOffset)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getSize(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getSize)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAlignment(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAlignment)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT jlong JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAttributes(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getAttributes)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT jint JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getStatic_1offset(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getStatic_1offset)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT jstring JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getFormat(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + return (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1getFormat)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1printMarkerField(JNIEnv *env, jobject jobj, jlong marker_field_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniMarkerField_ltt_1printMarkerField)(env, jobj, marker_field_ptr) ; +} + + +JNIEXPORT void JNICALL Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData(JNIEnv *env, jclass accessClass, jobject javaObj, jlong event_ptr, jlong marker_field_ptr) { + (*allFunctions.Java_org_eclipse_linuxtools_lttng_jni_JniParser_ltt_1getParsedData)(env, accessClass, javaObj, event_ptr, marker_field_ptr) ; +} + + diff --git a/ltt/trace.h b/ltt/trace.h index 202def10..455c1190 100644 --- a/ltt/trace.h +++ b/ltt/trace.h @@ -212,4 +212,13 @@ LttTime ltt_interpolate_time_from_tsc(LttTracefile *tf, guint64 tsc); /* Set to enable event debugging output */ void ltt_event_debug(int state); +/* A structure representing the version number of the trace */ +struct LttTraceVersion { + guint8 ltt_major_version; + guint8 ltt_minor_version; +}; + +/* To get the version number of a trace */ +int get_version(const gchar *pathname, struct LttTraceVersion * version_number); + #endif // TRACE_H diff --git a/ltt/tracefile.c b/ltt/tracefile.c index efb2ca93..3d69ddf7 100644 --- a/ltt/tracefile.c +++ b/ltt/tracefile.c @@ -1729,3 +1729,147 @@ static __attribute__((constructor)) void init(void) { LTT_TRACEFILE_NAME_METADATA = g_quark_from_string("metadata"); } + +/***************************************************************************** + *Function name + * ltt_tracefile_open_header : based on ltt_tracefile_open but it stops + * when it gets the header + *Input params + * fileName : path to the tracefile + * tf : the tracefile (metadata_0) where the header will be read + *Return value + * ltt_subbuffer_header_t : the header containing the version number + ****************************************************************************/ +static ltt_subbuffer_header_t * ltt_tracefile_open_header(gchar * fileName, LttTracefile *tf) +{ + struct stat lTDFStat; /* Trace data file status */ + ltt_subbuffer_header_t *header; + int page_size = getpagesize(); + + //open the file + tf->long_name = g_quark_from_string(fileName); + tf->fd = open(fileName, O_RDONLY); + if(tf->fd < 0){ + g_warning("Unable to open input data file %s\n", fileName); + goto end; + } + + // Get the file's status + if(fstat(tf->fd, &lTDFStat) < 0){ + g_warning("Unable to get the status of the input data file %s\n", fileName); + goto close_file; + } + + // Is the file large enough to contain a trace + if(lTDFStat.st_size < + (off_t)(ltt_subbuffer_header_size())){ + g_print("The input data file %s does not contain a trace\n", fileName); + goto close_file; + } + + /* Temporarily map the buffer start header to get trace information */ + /* Multiple of pages aligned head */ + tf->buffer.head = mmap(0, + PAGE_ALIGN(ltt_subbuffer_header_size()), PROT_READ, + MAP_PRIVATE, tf->fd, 0); + if(tf->buffer.head == MAP_FAILED) { + perror("Error in allocating memory for buffer of tracefile"); + goto close_file; + } + g_assert( ( (gulong)tf->buffer.head&(8-1) ) == 0); // make sure it's aligned. + + header = (ltt_subbuffer_header_t *)tf->buffer.head; + + + return header; + + /* Error */ + +close_file: + close(tf->fd); +end: + return 0; +} + + +/***************************************************************************** + *Function name + * get_version : get the trace version from a metadata_0 trace file + *Input params + * pathname : path to the trace + * version_number : the struct that will get the version number + *Return value + * int : 1 if succeed, -1 if error + ****************************************************************************/ + +int get_version(const gchar *pathname, struct LttTraceVersion * version_number) +{ + gchar abs_path[PATH_MAX]; + int ret = 0; + DIR *dir; + struct dirent *entry; + struct stat stat_buf; + gchar path[PATH_MAX]; + + LttTracefile tmp_tf; + LttTrace * t; + ltt_subbuffer_header_t *header; + + t = g_new(LttTrace, 1); + + get_absolute_pathname(pathname, abs_path); + + /* Test to see if it looks like a trace */ + dir = opendir(abs_path); + + if(dir == NULL) { + perror(abs_path); + goto open_error; + } + + while((entry = readdir(dir)) != NULL) { + strcpy(path, abs_path); + strcat(path, "/"); + strcat(path, entry->d_name); + ret = stat(path, &stat_buf); + if(ret == -1) { + perror(path); + continue; + } + } + + closedir(dir); + dir = opendir(abs_path); + + while((entry = readdir(dir)) != NULL) { + + if(entry->d_name[0] == '.') continue; + if(g_strcmp0(entry->d_name, "metadata_0") != 0) continue; + + strcpy(path, abs_path); + strcat(path, "/"); + strcat(path, entry->d_name); + if(ret == -1) { + perror(path); + continue; + } + + header = ltt_tracefile_open_header(path, &tmp_tf); + + if(header == NULL) { + g_info("Error getting the header %s", path); + + continue; /* error opening the tracefile : bad magic number ? */ + } + + version_number->ltt_major_version = header->major_version; + version_number->ltt_minor_version = header->minor_version; + + } + + return 0; + + open_error: + g_free(t); + return -1; +} diff --git a/specs/lttv.spec b/specs/lttv.spec index 31852770..f6d8df84 100644 --- a/specs/lttv.spec +++ b/specs/lttv.spec @@ -48,8 +48,7 @@ echo "Running ldconfig (might take a while)" ldconfig %files -%{libdir}/liblttvtraceread.so.0.0.0 -%{libdir}/liblttvtraceread.so.0 +%{libdir}/liblttvtraceread-2.3.so %{libdir}/liblttvtraceread.so %{libdir}/liblttvtraceread.la %{libdir}/liblttvtraceread.a