gtkdirsel.c\
gtkmultivpaned.c\
lttvwindow.c \
+ lttvwindowtraces.c \
init_module.c \
support.c \
interface.c \
gtkdirsel.h\
gtkmultivpaned.h\
lttvwindow.h\
+ lttvwindowtraces.h\
lttvfilter.h\
mainwindow.h\
menu.h\
# include <config.h>
#endif
+#include <limits.h> // for PATH_MAX
+#include <stdlib.h>
+
#include <gtk/gtk.h>
#include "callbacks.h"
#include <lttvwindow/menu.h>
#include <lttvwindow/toolbar.h>
#include <lttvwindow/lttvwindow.h>
+#include <lttvwindow/lttvwindowtraces.h>
#include <lttvwindow/gtkdirsel.h>
#include <lttvwindow/lttvfilter.h>
-#define PATH_LENGTH 256
+
#define DEFAULT_TIME_WIDTH_S 1
extern LttvTrace *g_init_trace ;
extern GSList * g_main_window_list;
/** MD : keep old directory. */
-static char remember_plugins_dir[PATH_LENGTH] = "";
-static char remember_trace_dir[PATH_LENGTH] = "";
+static char remember_plugins_dir[PATH_MAX] = "";
+static char remember_trace_dir[PATH_MAX] = "";
MainWindow * get_window_data_struct(GtkWidget * widget);
EventsRequest *events_request = (EventsRequest *)iter->data;
/* 1.1. Use current postition as start position */
- g_free(events_request->start_position);
+ if(events_request->start_position != NULL)
+ lttv_traceset_context_position_destroy(events_request->start_position);
+ events_request->start_position = ltt_traceset_context_position_new();
lttv_traceset_context_position_save(tsc, events_request->start_position);
/* 1.2. Remove start time */
LttvTraceset *traceset = tab->traceset_info->traceset;
guint i;
+ //Verify if trace is already present.
+ for(i=0; i<lttv_traceset_number(traceset); i++)
+ {
+ LttvTrace * trace = lttv_traceset_get(traceset, i);
+ if(trace == trace_v)
+ return;
+ }
+
//Keep a reference to the traces so they are not freed.
for(i=0; i<lttv_traceset_number(traceset); i++)
{
g_object_unref(tab->traceset_info->traceset_context);
lttv_traceset_add(traceset, trace_v);
+ lttv_trace_ref(trace_v); /* local ref */
/* Create new context */
tab->traceset_info->traceset_context =
LttvTrace * trace_v;
LttvTraceset * traceset;
const char * dir;
+ char abs_path[PATH_MAX];
gint id;
gint i;
MainWindow * mw_data = get_window_data_struct(widget);
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
dir = gtk_dir_selection_get_dir (file_selector);
- strncpy(remember_trace_dir, dir, PATH_LENGTH);
+ strncpy(remember_trace_dir, dir, PATH_MAX);
if(!dir || strlen(dir) == 0){
gtk_widget_destroy((GtkWidget*)file_selector);
break;
}
- trace = ltt_trace_open(dir);
- if(trace == NULL) g_critical("cannot open trace %s", dir);
- trace_v = lttv_trace_new(trace);
+ get_absolute_pathname(dir, abs_path);
+ trace_v = lttvwindowtraces_get_trace_by_name(abs_path);
+ if(trace_v == NULL) {
+ trace = ltt_trace_open(abs_path);
+ if(trace == NULL) g_critical("cannot open trace %s", abs_path);
+ trace_v = lttv_trace_new(trace);
+ lttvwindowtraces_add_trace(trace_v);
+ }
lttvwindow_add_trace(tab, trace_v);
trace_v = lttv_traceset_get(traceset, i);
- if(lttv_trace_get_ref_number(trace_v) <= 1)
+ if(lttv_trace_get_ref_number(trace_v) <= 2) {
+ /* ref 2 : traceset, local */
+ lttvwindowtraces_remove_trace(trace_v);
ltt_trace_close(lttv_trace(trace_v));
+ }
lttv_traceset_remove(traceset, i);
lttv_trace_unref(trace_v); // Remove local reference
}else{
if(tab){
while(tab->multi_vpaned->num_children){
- gtk_multi_vpaned_widget_delete(tab->multi_vpaned);
+ gtk_multi_vpaned_widget_delete(tab->multi_vpaned);
}
}
}
*/
Tab *create_new_tab(GtkWidget* widget, gpointer user_data){
- gchar label[PATH_LENGTH];
+ gchar label[PATH_MAX];
MainWindow * mw_data = get_window_data_struct(widget);
GtkNotebook * notebook = (GtkNotebook *)lookup_widget(widget, "MNotebook");
{
char ** dir;
gint id;
- char str[PATH_LENGTH], *str1;
+ char str[PATH_MAX], *str1;
MainWindow * mw_data = get_window_data_struct((GtkWidget*)menuitem);
GtkFileSelection * file_selector = (GtkFileSelection *)gtk_file_selection_new("Select a module");
if(remember_plugins_dir[0] != '\0')
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
dir = gtk_file_selection_get_selections (file_selector);
- strncpy(str,dir[0],PATH_LENGTH);
- strncpy(remember_plugins_dir,dir[0],PATH_LENGTH);
+ strncpy(str,dir[0],PATH_MAX);
+ strncpy(remember_plugins_dir,dir[0],PATH_MAX);
str1 = strrchr(str,'/');
if(str1)str1++;
else{
case GTK_RESPONSE_ACCEPT:
case GTK_RESPONSE_OK:
dir = gtk_dir_selection_get_dir (file_selector);
- strncpy(remember_plugins_dir,dir,PATH_LENGTH);
- strncat(remember_plugins_dir,"/",PATH_LENGTH);
+ strncpy(remember_plugins_dir,dir,PATH_MAX);
+ strncat(remember_plugins_dir,"/",PATH_MAX);
lttv_library_path_add(dir);
case GTK_RESPONSE_REJECT:
case GTK_RESPONSE_CANCEL:
trace = lttv_traceset_get(tab_instance->traceset_info->traceset, i);
ref_count = lttv_trace_get_ref_number(trace);
if(ref_count <= 1){
- ltt_trace_close(lttv_trace(trace));
- lttv_trace_destroy(trace);
+ ltt_trace_close(lttv_trace(trace));
}
- // lttv_trace_destroy(trace);
}
}
lttv_traceset_destroy(tab_instance->traceset_info->traceset);
#endif
#include <gtk/gtk.h>
+#include <glib.h>
#include <lttv/lttv.h>
#include <lttv/attribute.h>
#include <lttv/stats.h>
#include <lttvwindow/menu.h>
#include <lttvwindow/toolbar.h>
+#include <lttvwindow/lttvwindowtraces.h>
#include "interface.h"
#include "support.h"
#include <ltt/trace.h>
-GQuark LTTV_TRACES;
+LttvTraceInfo LTTV_TRACES,
+ LTTV_COMPUTATION,
+ LTTV_REQUESTS_QUEUE,
+ LTTV_REQUESTS_CURRENT,
+ LTTV_NOTIFY_QUEUE,
+ LTTV_NOTIFY_CURRENT;
/** Array containing instanced objects. */
GSList * g_main_window_list = NULL ;
void lttv_trace_option(void *hook_data)
{
LttTrace *trace;
- gchar *path;
-
- trace = ltt_trace_open(a_trace);
- if(trace == NULL) g_critical("cannot open trace %s", a_trace);
- g_init_trace = lttv_trace_new(trace);
-
+ gchar *abs_path;
+
+ get_absolute_pathname(a_trace, abs_path);
+ g_init_trace = lttvwindowtraces_get_trace_by_name(abs_path);
+ if(g_init_trace == NULL) {
+ trace = ltt_trace_open(abs_path);
+ if(trace == NULL) g_critical("cannot open trace %s", abs_path);
+ g_init_trace = lttv_trace_new(trace);
+ lttvwindowtraces_add_trace(g_init_trace);
+ }
}
/*****************************************************************************
// Global attributes only used for interaction with main() here.
LttvIAttribute *attributes = LTTV_IATTRIBUTE(lttv_global_attributes());
- LTTV_TRACES = g_quark_from_string("traces/");
+ LTTV_TRACES = g_quark_from_string("traces");
+ LTTV_COMPUTATION = g_quark_from_string("computation");
+ LTTV_REQUESTS_QUEUE = g_quark_from_string("requests_queue");
+ LTTV_REQUESTS_CURRENT = g_quark_from_string("requests_current");
+ LTTV_NOTIFY_QUEUE = g_quark_from_string("notify_queue");
+ LTTV_NOTIFY_CURRENT = g_quark_from_string("notify_current");
g_debug("GUI init()");
gconstpointer viewer);
-typedef struct _BackgroundRequest {
- gchar *hook_path; /* Hook path in global attributes, where all standard hooks
- are : i.e. /TraceState/Statistics/ModuleName */
- gchar *trace_path; /* path_to_trace */
-} BackgroundRequest;
-
-typedef struct _BackgroundNotify {
- gchar *trace_path; /* path_to_trace */
- LttTime notify_time;
- LttvTracesetContextPosition *notify_position;
- LttvHooks *notify; /* Hook to call when the notify is
- passed, or at the end of trace */
-} BackgroundNotify;
-
-/**
- * Function to request data from a specific trace
- *
- * @param bg_request Request specification
- */
-
-void lttvwindow_background_request_queue(const BackgroundRequest *bg_request);
-
-/**
- * Register a callback to be called when requested data is passed in the next
- * queued background processing.
- *
- * @param bg_request Request specification
- */
-
-void lttvwindow_background_notify_queue(const BackgroundNotify *bg_notify);
-
-
-/**
- * Register a callback to be called when requested data is passed in the current
- * background processing.
- *
- * @param bg_request Request specification
- */
-
-void lttvwindow_background_notify_current(const BackgroundNotify *bg_notify);
-
-
/**
* Function to get the current time window of the current tab.
*
--- /dev/null
+/* This file is part of the Linux Trace Toolkit Graphic User Interface
+ * Copyright (C) 2003-2004 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+/* This file is the API used to launch any background computation on a trace */
+
+/* Here is the implementation of the API */
+
+#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>
+
+
+typedef struct _BackgroundRequest {
+ LttvAttributeName module_name; /* Hook path in global attributes,
+ where all standard hooks under computation/.
+ i.e. modulename */
+ LttvTrace *trace; /* trace concerned */
+} BackgroundRequest;
+
+typedef struct _BackgroundNotify {
+ gpointer owner;
+ LttvTrace *trace; /* trace */
+ LttTime notify_time;
+ LttvTracesetContextPosition *notify_position;
+ LttvHooks *notify; /* Hook to call when the notify is
+ passed, or at the end of trace */
+} BackgroundNotify;
+
+
+
+/* Get a trace by its path name.
+ *
+ * @param path path of the trace on the virtual file system.
+ * @return Pointer to trace if found
+ * NULL is returned if the trace is not present
+ */
+
+LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path)
+{
+ LttvAttribute *attribute = lttv_global_attributes();
+ guint i;
+
+ for(i=0;i<lttvwindowtraces_get_number();i++) {
+ LttvTrace *trace_v = lttvwindowtraces_get_trace(i);
+ LttTrace *trace;
+ gchar *name;
+
+ g_assert(trace_v != NULL);
+
+ trace = lttv_trace(trace_v);
+ g_assert(trace != NULL);
+ name = ltt_trace_name(trace);
+
+ if(strcmp(name, path) == 0) {
+ /* Found */
+ return trace_v;
+ }
+ }
+
+ return NULL;
+}
+
+/* Get a trace by its number identifier */
+
+LttvTrace *lttvwindowtraces_get_trace(guint num)
+{
+ LttvAttribute *g_attribute = lttv_global_attributes();
+ LttvAttribute *attribute;
+ LttvAttributeType type;
+ LttvAttributeName name;
+ LttvAttributeValue value;
+
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
+ LTTV_TRACES)));
+
+ type = lttv_iattribute_get(LTTV_IATTRIBUTE(attribute), num, &name, &value);
+
+ if(type == LTTV_POINTER) {
+ return (LttvTrace *)*(value.v_pointer);
+ }
+
+ return NULL;
+}
+
+/* Total number of traces */
+
+guint lttvwindowtraces_get_number()
+{
+ LttvAttribute *g_attribute = lttv_global_attributes();
+ LttvAttribute *attribute;
+ LttvAttributeValue value;
+
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
+ LTTV_TRACES)));
+
+ return ( lttv_iattribute_get_number(LTTV_IATTRIBUTE(attribute)) );
+}
+
+/* Add a trace to the global attributes */
+
+void lttvwindowtraces_add_trace(LttvTrace *trace)
+{
+ LttvAttribute *g_attribute = lttv_global_attributes();
+ LttvAttribute *attribute;
+ LttvAttributeValue value;
+ guint num;
+
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
+ LTTV_TRACES)));
+ num = lttv_attribute_get_number(attribute);
+
+ value = lttv_attribute_add(attribute,
+ num,
+ LTTV_POINTER);
+
+ *(value.v_pointer) = (gpointer)trace;
+}
+
+/* Remove a trace from the global attributes */
+
+void lttvwindowtraces_remove_trace(LttvTrace *trace)
+{
+ LttvAttribute *g_attribute = lttv_global_attributes();
+ LttvAttribute *attribute;
+ LttvAttributeValue value;
+ guint i;
+
+ g_assert(attribute =
+ LTTV_ATTRIBUTE(lttv_iattribute_find_subdir(LTTV_IATTRIBUTE(g_attribute),
+ LTTV_TRACES)));
+
+ for(i=0;i<lttvwindowtraces_get_number();i++) {
+ LttvTrace *trace_v = lttvwindowtraces_get_trace(i);
+
+ g_assert(trace_v != NULL);
+
+ if(trace_v == trace) {
+ /* Found */
+ lttv_attribute_remove(attribute, i);
+ return;
+ }
+ }
+}
+
+
+/**
+ * Function to request data from a specific trace
+ *
+ * The memory allocated for the request will be managed by the API.
+ *
+ * @param trace the trace to compute
+ * @param module_name the name of the module which registered global computation
+ * hooks.
+ */
+
+void lttvwindowtraces_background_request_queue
+ (LttvTrace *trace, gchar *module_name)
+{
+ BackgroundRequest *bg_req;
+ LttvAttribute *attribute = lttv_trace_attribute(trace);
+ LttvAttributeValue value;
+ GSList **slist;
+ guint num;
+
+ g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
+ LTTV_REQUESTS_QUEUE,
+ LTTV_POINTER,
+ &value));
+ slist = (GSList**)(value.v_pointer);
+
+ bg_req = g_new(BackgroundRequest,1);
+ bg_req->module_name = g_quark_from_string(module_name);
+ bg_req->trace = trace;
+
+ *slist = g_slist_append(*slist, bg_req);
+}
+
+/**
+ * Remove a background request from a trace.
+ *
+ * This should ONLY be used by the modules which registered the global hooks
+ * (module_name). If this is called by the viewers, it may lead to incomplete
+ * and incoherent background processing information.
+ *
+ * Even if the module which deals with the hooks removes the background
+ * requests, it may cause a problem if the module gets loaded again in the
+ * session : the data will be partially calculated. The calculation function
+ * must deal with this case correctly.
+ *
+ * @param trace the trace to compute
+ * @param module_name the name of the module which registered global computation
+ * hooks.
+ */
+
+void lttvwindowtraces_background_request_remove
+ (LttvTrace *trace, gchar *module_name)
+{
+ LttvAttribute *attribute = lttv_trace_attribute(trace);
+ LttvAttributeValue value;
+ GSList *iter = NULL;
+ GSList **slist;
+
+ g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
+ LTTV_REQUESTS_QUEUE,
+ LTTV_POINTER,
+ &value));
+ slist = (GSList**)(value.v_pointer);
+
+ for(iter=*slist;iter!=NULL;) {
+ BackgroundRequest *bg_req =
+ (BackgroundRequest *)iter->data;
+
+ if(bg_req->module_name == g_quark_from_string(module_name)) {
+ GSList *rem_iter = iter;
+ iter=g_slist_next(iter);
+ g_free(bg_req);
+ *slist = g_slist_delete_link(*slist, rem_iter);
+ } else {
+ iter=g_slist_next(iter);
+ }
+ }
+}
+
+
+/**
+ * Register a callback to be called when requested data is passed in the next
+ * queued background processing.
+ *
+ * @param owner owner of the background notification
+ * @param trace the trace computed
+ * @param notify_time time when notification hooks must be called
+ * @param notify_position position when notification hooks must be called
+ * @param notify Hook to call when the notify position is passed
+ */
+
+void lttvwindowtraces_background_notify_queue
+ (gpointer owner,
+ LttvTrace *trace,
+ LttTime notify_time,
+ const LttvTracesetContextPosition *notify_position,
+ const LttvHooks *notify)
+{
+ BackgroundNotify *bg_notify;
+ LttvAttribute *attribute = lttv_trace_attribute(trace);
+ LttvAttributeValue value;
+ GSList **slist;
+
+ g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
+ LTTV_NOTIFY_QUEUE,
+ LTTV_POINTER,
+ &value));
+ slist = (GSList**)(value.v_pointer);
+
+
+ bg_notify = g_new(BackgroundNotify,1);
+
+ bg_notify->owner = owner;
+ bg_notify->trace = trace;
+ bg_notify->notify_time = notify_time;
+ bg_notify->notify_position = ltt_traceset_context_position_new();
+ lttv_traceset_context_position_copy(bg_notify->notify_position,
+ notify_position);
+ bg_notify->notify = lttv_hooks_new();
+ lttv_hooks_add_list(bg_notify->notify, notify);
+
+ *slist = g_slist_append(*slist, bg_notify);
+}
+
+/**
+ * Register a callback to be called when requested data is passed in the current
+ * background processing.
+ *
+ * @param owner owner of the background notification
+ * @param trace the trace computed
+ * @param notify_time time when notification hooks must be called
+ * @param notify_position position when notification hooks must be called
+ * @param notify Hook to call when the notify position is passed
+ */
+
+void lttvwindowtraces_background_notify_current
+ (gpointer owner,
+ LttvTrace *trace,
+ LttTime notify_time,
+ const LttvTracesetContextPosition *notify_position,
+ const LttvHooks *notify)
+{
+ BackgroundNotify *bg_notify;
+ LttvAttribute *attribute = lttv_trace_attribute(trace);
+ LttvAttributeValue value;
+ GSList **slist;
+
+ g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
+ LTTV_NOTIFY_CURRENT,
+ LTTV_POINTER,
+ &value));
+ slist = (GSList**)(value.v_pointer);
+
+ bg_notify = g_new(BackgroundNotify,1);
+
+ bg_notify->owner = owner;
+ bg_notify->trace = trace;
+ bg_notify->notify_time = notify_time;
+ bg_notify->notify_position = ltt_traceset_context_position_new();
+ lttv_traceset_context_position_copy(bg_notify->notify_position,
+ notify_position);
+ bg_notify->notify = lttv_hooks_new();
+ lttv_hooks_add_list(bg_notify->notify, notify);
+
+ *slist = g_slist_append(*slist, bg_notify);
+}
+
+/**
+ * Removes all the notifications requests from a specific viewer.
+ *
+ * @param owner owner of the background notification
+ */
+
+void lttvwindowtraces_background_notify_remove(gpointer owner)
+{
+ guint i;
+
+ for(i=0;i<lttvwindowtraces_get_number();i++) {
+ LttvAttribute *attribute;
+ LttvAttributeValue value;
+ LttvTrace *trace_v = lttvwindowtraces_get_trace(i);
+ GSList **slist;
+ GSList *iter = NULL;
+
+ g_assert(trace_v != NULL);
+
+ LttvAttribute *t_a = lttv_trace_attribute(trace_v);
+
+ g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
+ LTTV_NOTIFY_QUEUE,
+ LTTV_POINTER,
+ &value));
+ slist = (GSList**)(value.v_pointer);
+
+ for(iter=*slist;iter!=NULL;) {
+
+ BackgroundNotify *bg_notify = (BackgroundNotify*)iter->data;
+
+ if(bg_notify->owner == owner) {
+ GSList *rem_iter = iter;
+ iter=g_slist_next(iter);
+ lttv_traceset_context_position_destroy(
+ bg_notify->notify_position);
+ lttv_hooks_destroy(bg_notify->notify);
+ g_free(bg_notify);
+ g_slist_remove_link(*slist, rem_iter);
+ } else {
+ iter=g_slist_next(iter);
+ }
+ }
+
+ g_assert(lttv_iattribute_find(LTTV_IATTRIBUTE(attribute),
+ LTTV_NOTIFY_CURRENT,
+ LTTV_POINTER,
+ &value));
+ slist = (GSList**)(value.v_pointer);
+
+ for(iter=*slist;iter!=NULL;) {
+
+ BackgroundNotify *bg_notify = (BackgroundNotify*)iter->data;
+
+ if(bg_notify->owner == owner) {
+ GSList *rem_iter = iter;
+ iter=g_slist_next(iter);
+ lttv_traceset_context_position_destroy(
+ bg_notify->notify_position);
+ lttv_hooks_destroy(bg_notify->notify);
+ g_free(bg_notify);
+ g_slist_remove_link(*slist, rem_iter);
+ } else {
+ iter=g_slist_next(iter);
+ }
+ }
+ }
+}
+
--- /dev/null
+/* This file is part of the Linux Trace Toolkit Graphic User Interface
+ * Copyright (C) 2003-2004 Mathieu Desnoyers
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License Version 2 as
+ * published by the Free Software Foundation;
+ *
+ * This program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
+ */
+
+/* This file is the API used to launch any background computation on a trace */
+
+#ifndef LTTVWINDOWTRACES_H
+#define LTTVWINDOWTRACES_H
+
+#include <ltt/time.h>
+#include <glib.h>
+
+typedef GQuark LttvTraceInfo;
+
+extern LttvTraceInfo LTTV_TRACES,
+ LTTV_COMPUTATION,
+ LTTV_REQUESTS_QUEUE,
+ LTTV_REQUESTS_CURRENT,
+ LTTV_NOTIFY_QUEUE,
+ LTTV_NOTIFY_CURRENT;
+
+/* Get a trace by its path name.
+ *
+ * @param path path of the trace on the virtual file system.
+ * @return Pointer to trace if found
+ * NULL is returned if the trace is not present
+ */
+
+LttvTrace *lttvwindowtraces_get_trace_by_name(gchar *path);
+
+/* Get a trace by its number identifier */
+
+LttvTrace *lttvwindowtraces_get_trace(guint num);
+
+/* Total number of traces */
+
+guint lttvwindowtraces_get_number();
+
+/* Add a trace to the global attributes */
+
+void lttvwindowtraces_add_trace(LttvTrace *trace);
+
+/* Remove a trace from the global attributes */
+
+void lttvwindowtraces_remove_trace(LttvTrace *trace);
+
+
+/**
+ * Function to request data from a specific trace
+ *
+ * The memory allocated for the request will be managed by the API.
+ *
+ * @param trace the trace to compute
+ * @param module_name the name of the module which registered global computation
+ * hooks.
+ */
+
+void lttvwindowtraces_background_request_queue
+ (LttvTrace *trace, gchar *module_name);
+
+/**
+ * Remove a background request from a trace.
+ *
+ * This should ONLY be used by the modules which registered the global hooks
+ * (module_name). If this is called by the viewers, it may lead to incomplete
+ * and incoherent background processing information.
+ *
+ * Even if the module which deals with the hooks removes the background
+ * requests, it may cause a problem if the module gets loaded again in the
+ * session : the data will be partially calculated. The calculation function
+ * must deal with this case correctly.
+ *
+ * @param trace the trace to compute
+ * @param module_name the name of the module which registered global computation
+ * hooks.
+ */
+
+void lttvwindowtraces_background_request_remove
+ (LttvTrace *trace, gchar *module_name);
+
+/**
+ * Register a callback to be called when requested data is passed in the next
+ * queued background processing.
+ *
+ * @param owner owner of the background notification
+ * @param trace the trace computed
+ * @param notify_time time when notification hooks must be called
+ * @param notify_position position when notification hooks must be called
+ * @param notify Hook to call when the notify position is passed
+ */
+
+void lttvwindowtraces_background_notify_queue
+ (gpointer owner,
+ LttvTrace *trace,
+ LttTime notify_time,
+ const LttvTracesetContextPosition *notify_position,
+ const LttvHooks *notify);
+
+/**
+ * Register a callback to be called when requested data is passed in the current
+ * background processing.
+ *
+ * @param owner owner of the background notification
+ * @param trace the trace computed
+ * @param notify_time time when notification hooks must be called
+ * @param notify_position position when notification hooks must be called
+ * @param notify Hook to call when the notify position is passed
+ */
+
+void lttvwindowtraces_background_notify_current
+ (gpointer owner,
+ LttvTrace *trace,
+ LttTime notify_time,
+ const LttvTracesetContextPosition *notify_position,
+ const LttvHooks *notify);
+
+/**
+ * Removes all the notifications requests from a specific viewer.
+ *
+ * @param owner owner of the background notification
+ */
+
+void lttvwindowtraces_background_notify_remove(gpointer owner);
+
+
+#endif //LTTVWINDOWTRACES_H
#include <glib.h>
#include <ltt/time.h>
-extern GQuark LTTV_TRACES;
-
typedef struct _MainWindow MainWindow;
typedef struct _TimeWindow TimeWindow;
typedef struct _Tab Tab;