+/* Request background computation. Verify if it is in progress or ready first.
+ *
+ * Right now, for all loaded traces.
+ *
+ * Later : must be only for each trace in the tab's traceset.
+ */
+static void request_background_data(StatisticViewerData *svd)
+{
+ gint num_traces = lttvwindowtraces_get_number();
+ gint i;
+ LttvTrace *trace;
+ GtkTextBuffer* buf;
+
+ LttvHooks *background_ready_hook =
+ lttv_hooks_new();
+ lttv_hooks_add(background_ready_hook, background_ready, svd,
+ LTTV_PRIO_DEFAULT);
+ svd->background_info_waiting = num_traces;
+ buf = gtk_text_view_get_buffer((GtkTextView*)svd->text_v);
+ gtk_text_buffer_set_text(buf,"", -1);
+
+ for(i=0;i<num_traces;i++) {
+ trace = lttvwindowtraces_get_trace(i);
+
+ if(lttvwindowtraces_get_ready(g_quark_from_string("stats"),trace)==FALSE) {
+
+ if(lttvwindowtraces_get_in_progress(g_quark_from_string("stats"),
+ trace) == FALSE) {
+ /* We first remove requests that could have been done for the same
+ * information. Happens when two viewers ask for it before servicing
+ * starts.
+ */
+ if(!lttvwindowtraces_background_request_find(trace, "stats"))
+ lttvwindowtraces_background_request_queue(
+ main_window_get_widget(svd->tab), trace, "stats");
+ lttvwindowtraces_background_notify_queue(svd,
+ trace,
+ ltt_time_infinite,
+ NULL,
+ background_ready_hook);
+ } else { /* in progress */
+ lttvwindowtraces_background_notify_current(svd,
+ trace,
+ ltt_time_infinite,
+ NULL,
+ background_ready_hook);
+
+ }
+ } else {
+ /* ready */
+ lttv_hooks_call(background_ready_hook, NULL);
+ }
+ }
+
+ if(num_traces == 0) {
+ svd->background_info_waiting = 1;
+ lttv_hooks_call(background_ready_hook, NULL);
+ }
+ lttv_hooks_destroy(background_ready_hook);
+}
+
+
+GtkWidget *guistatistic_get_widget(StatisticViewerData *svd)
+{
+ return svd->hpaned_v;
+}
+
+