#include <string.h>
#include <inttypes.h>
-#include <ltt/time.h>
-#include <ltt/trace.h>
#include <glib.h>
#include <lttv/lttv.h>
#include <lttv/traceset.h>
#include <lttv/attribute.h>
-#include <lttv/tracecontext.h>
#include <lttvwindow/lttvwindowtraces.h>
#include <lttvwindow/lttvwindow.h> // for CHUNK_NUM_EVENTS
#include <lttvwindow/mainwindow-private.h> /* for main window structure */
gpointer owner;
LttvTrace *trace; /* trace */
LttTime notify_time;
- LttvTracesetContextPosition *notify_position;
+ LttvTracesetPosition *notify_position;
LttvHooks *notify; /* Hook to call when the notify is
passed, or at the end of trace */
} BackgroundNotify;
__EXPORT LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path)
{
+#ifdef BABEL_CLEANUP
guint i;
for(i=0;i<lttvwindowtraces_get_number();i++) {
return trace_v;
}
}
-
+#endif
return NULL;
}
void lttvwindowtraces_add_trace(LttvTrace *trace)
{
- LttvAttribute *g_attribute = lttv_global_attributes();
+
LttvAttribute *attribute;
- LttvAttributeValue value;
+#ifdef BABEL_CLEANUP
+
+ LttvAttribute *g_attribute = lttv_global_attributes();
struct stat buf;
gchar attribute_path[PATH_MAX];
int result;
gboolean result_b;
-
if(stat(g_quark_to_string(ltt_trace_name(lttv_trace(trace))), &buf)) {
g_warning("lttvwindowtraces_add_trace: Trace %s not found",
g_quark_to_string(ltt_trace_name(lttv_trace(trace))));
*(value.v_pointer) = tss;
lttv_context_init(LTTV_TRACESET_CONTEXT(tss), ts);
+#endif
#if 0
result_b = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
LTTV_COMPUTATION_SYNC_POSITION,
sync_position = lttv_traceset_context_position_new();
*(value.v_pointer) = sync_position;
#endif //0
- value = lttv_attribute_add(attribute,
+ lttv_attribute_add(attribute,
LTTV_REQUESTS_QUEUE,
LTTV_POINTER);
- value = lttv_attribute_add(attribute,
+ lttv_attribute_add(attribute,
LTTV_REQUESTS_CURRENT,
LTTV_POINTER);
- value = lttv_attribute_add(attribute,
+ lttv_attribute_add(attribute,
LTTV_NOTIFY_QUEUE,
LTTV_POINTER);
- value = lttv_attribute_add(attribute,
+ lttv_attribute_add(attribute,
LTTV_NOTIFY_CURRENT,
LTTV_POINTER);
}
/* destroy traceset and tracesetcontext */
LttvTraceset *ts;
- LttvTracesetStats *tss;
//LttvTracesetContextPosition *sync_position;
l_attribute = lttv_trace_attribute(trace);
LTTV_POINTER,
&value);
g_assert(result);
-
+#ifdef BABEL_CLEANUP
tss = (LttvTracesetStats*)*(value.v_pointer);
lttv_context_fini(LTTV_TRACESET_CONTEXT(tss));
g_object_unref(tss);
+#endif /* BABEL_CLEANUP */
lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
LTTV_COMPUTATION_TRACESET_CONTEXT);
lttv_iattribute_remove_by_name(LTTV_IATTRIBUTE(l_attribute),
GTK_MESSAGE_INFO, GTK_BUTTONS_OK,
"Background computation for %s started for trace %s",
module_name,
- g_quark_to_string(ltt_trace_name(lttv_trace(trace))));
+ trace->traceset->filename);
gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(widget));
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (destroy_dialog),
(gpointer owner,
LttvTrace *trace,
LttTime notify_time,
- const LttvTracesetContextPosition *notify_position,
+ const LttvTracesetPosition *notify_position,
const LttvHooks *notify)
{
+ #ifdef BABEL_CLEANUP
BackgroundNotify *bg_notify;
LttvAttribute *attribute = lttv_trace_attribute(trace);
LttvAttributeValue value;
&value);
g_assert(result);
- LttvTracesetContext *tsc = (LttvTracesetContext*)(value.v_pointer);
+ LttvTraceset *ts = (LttvTraceset)(value.v_pointer);
bg_notify = g_new(BackgroundNotify,1);
lttv_hooks_add_list(bg_notify->notify, notify);
*slist = g_slist_append(*slist, bg_notify);
+#endif /* BABEL_CLEANUP*/
}
/**
(gpointer owner,
LttvTrace *trace,
LttTime notify_time,
- const LttvTracesetContextPosition *notify_position,
+ const LttvTracesetPosition *notify_position,
const LttvHooks *notify)
{
+ #ifdef BABEL_CLEANUP
BackgroundNotify *bg_notify;
LttvAttribute *attribute = lttv_trace_attribute(trace);
LttvAttributeValue value;
lttv_hooks_add_list(bg_notify->notify, notify);
*slist = g_slist_append(*slist, bg_notify);
+ #endif /* BABEL_CLEANUP */
}
static void notify_request_free(BackgroundNotify *notify_req)
{
+ #ifdef BABEL_CLEANUP
if(notify_req == NULL) return;
if(notify_req->notify_position != NULL)
if(notify_req->notify != NULL)
lttv_hooks_destroy(notify_req->notify);
g_free(notify_req);
+ #endif /* BABEL_CLEANUP */
}
/**
/* Background processing helper functions */
void lttvwindowtraces_add_computation_hooks(LttvAttributeName module_name,
- LttvTracesetContext *tsc,
+ LttvTraceset *ts,
LttvHooks *hook_adder)
{
+ #ifdef BABEL_CLEANUP
LttvAttribute *g_attribute = lttv_global_attributes();
LttvAttribute *module_attribute;
LttvAttributeType type;
if(hook_adder != NULL)
lttv_hooks_add_list(hook_adder, (LttvHooks*)*(value.v_pointer));
}
+#endif /* BABEL_CLEANUP */
}
void lttvwindowtraces_remove_computation_hooks(LttvAttributeName module_name,
- LttvTracesetContext *tsc,
+ LttvTraceset *ts,
LttvHooks *hook_remover)
{
+ #ifdef BABEL_CLEANUP
LttvAttribute *g_attribute = lttv_global_attributes();
LttvAttribute *module_attribute;
LttvAttributeType type;
if(hook_remover != NULL)
lttv_hooks_add_list(hook_remover, (LttvHooks*)*(value.v_pointer));
}
+ #endif /* BABEL_CLEANUP */
}
void lttvwindowtraces_call_before_chunk(LttvAttributeName module_name,
- LttvTracesetContext *tsc)
+ LttvTraceset *ts)
{
+ #ifdef BABEL_CLEANUP
LttvAttribute *g_attribute = lttv_global_attributes();
LttvAttribute *module_attribute;
LttvAttributeType type;
before_chunk_tracefile,
event_hook,
event_hook_by_id_channel);
+#endif /* BABEL_CLEANUP */
}
void lttvwindowtraces_call_after_chunk(LttvAttributeName module_name,
- LttvTracesetContext *tsc)
+ LttvTraceset *ts)
{
LttvAttribute *g_attribute = lttv_global_attributes();
LttvAttribute *module_attribute;
LttvHooks *after_chunk_trace=NULL;
LttvHooks *after_chunk_tracefile=NULL;
LttvHooks *event_hook=NULL;
- LttvHooksByIdChannelArray *event_hook_by_id_channel=NULL;
module_attribute =
LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(module_attribute),
LTTV_EVENT_HOOK_BY_ID_CHANNEL,
&value);
- if(type == LTTV_POINTER) {
- event_hook_by_id_channel = (LttvHooksByIdChannelArray*)*(value.v_pointer);
- }
-
+#ifdef BABEL_CLEANUP
lttv_process_traceset_end(tsc,
after_chunk_traceset,
after_chunk_trace,
after_chunk_tracefile,
- event_hook,
- event_hook_by_id_channel);
+ event_hook);
+#endif /* BABEL_CLEANUP*/
}
else
return TRUE;
}
-
+#ifdef BABEL_CLEANUP
static gint find_window_widget(MainWindow *a, GtkWidget *b)
{
if(a->mwindow == b) return 0;
else return -1;
}
-
+#endif
/* lttvwindowtraces_process_pending_requests
*
gboolean lttvwindowtraces_process_pending_requests(LttvTrace *trace)
{
- LttvTracesetContext *tsc;
- LttvTracesetStats *tss;
- LttvTraceset *ts;
- //LttvTracesetContextPosition *sync_position;
LttvAttribute *attribute;
LttvAttribute *g_attribute = lttv_global_attributes();
GSList **list_out, **list_in, **notify_in, **notify_out;
LTTV_COMPUTATION_TRACESET,
&value);
g_assert(type == LTTV_POINTER);
+#ifdef BABEL_CLEANUP
ts = (LttvTraceset*)*(value.v_pointer);
-
- type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
- LTTV_COMPUTATION_TRACESET_CONTEXT,
- &value);
- g_assert(type == LTTV_POINTER);
- tsc = (LttvTracesetContext*)*(value.v_pointer);
- tss = (LttvTracesetStats*)*(value.v_pointer);
- g_assert(LTTV_IS_TRACESET_CONTEXT(tsc));
- g_assert(LTTV_IS_TRACESET_STATS(tss));
+#endif
#if 0
type = lttv_iattribute_get_by_name(LTTV_IATTRIBUTE(attribute),
LTTV_COMPUTATION_SYNC_POSITION,
g_assert(type == LTTV_POINTER);
sync_position = (LttvTracesetContextPosition*)*(value.v_pointer);
#endif //0
+#ifdef BABEL_CLEANUP
/* There is no events requests pending : we should never have been called! */
g_assert(g_slist_length(*list_out) != 0 || g_slist_length(*list_in) != 0);
/* 0.1 Lock traces */
guint iter_trace=0;
for(iter_trace=0;
- iter_trace<lttv_traceset_number(tsc->ts);
+ iter_trace<lttv_traceset_number(ts->ts);
iter_trace++) {
- LttvTrace *trace_v = lttv_traceset_get(tsc->ts,iter_trace);
+ LttvTrace *trace_v = lttv_traceset_get(ts->ts,iter_trace);
if(lttvwindowtraces_lock(trace_v) != 0)
return TRUE; /* Cannot get trace lock, try later */
lttvwindowtraces_unlock(trace_v);
}
}
+ #endif /* BABEL_CLEANUP */
return ret_val;
}
LttvHooks *before_request,
LttvHooks *after_request,
LttvHooks *event_hook,
- LttvHooksById *event_hook_by_id_channel,
LttvHooks *hook_adder,
LttvHooks *hook_remover)
{
g_assert(result);
*(value.v_pointer) = event_hook;
- result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
- LTTV_EVENT_HOOK_BY_ID_CHANNEL,
- LTTV_POINTER,
- &value);
- g_assert(result);
- *(value.v_pointer) = event_hook_by_id_channel;
-
result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
LTTV_HOOK_ADDER,
LTTV_POINTER,
&value);
g_assert(result);
- LttvHooksByIdChannelArray *event_hook_by_id_channel = (LttvHooksByIdChannelArray*)*(value.v_pointer);
- if(event_hook_by_id_channel != NULL)
- lttv_hooks_by_id_channel_destroy(event_hook_by_id_channel);
-
result = lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
LTTV_HOOK_ADDER,
LTTV_POINTER,