+/* This file is part of the Linux Trace Toolkit viewer
+ * Copyright (C) 2003-2004 Mathieu Desnoyers and XangXiu Yang
+ *
+ * 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.
+ */
+
+
//*! \defgroup GuiEvents libGuiEvents: The GUI Events display plugin */
/*\@{*/
#include <math.h>
#include <glib.h>
-#include <gmodule.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <lttv/module.h>
#include <lttv/hook.h>
-#include <lttv/gtkTraceSet.h>
-#include <lttv/processTrace.h>
+#include <lttvwindow/gtktraceset.h>
+#include <lttv/tracecontext.h>
#include <lttv/state.h>
#include <ltt/ltt.h>
#include <ltt/event.h>
//#include "mw_api.h"
#include "gtktreeprivate.h"
-#include "../icons/hGuiEventsInsert.xpm"
+#include "hGuiEventsInsert.xpm"
static LttvHooks *before_event;
static LttvModule *main_win_module;
-/**
- * plugin's init function
- *
- * This function initializes the Event Viewer functionnality through the
- * gtkTraceSet API.
- */
-G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) {
-
- main_win_module = lttv_module_require(self, "mainwin", argc, argv);
-
- if(main_win_module == NULL){
- g_critical("Can't load Control Flow Viewer : missing mainwin\n");
- return;
- }
-
- /* Register the toolbar insert button */
- toolbar_item_reg(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
-
- /* Register the menu item insert entry */
- menu_item_reg("/", "Insert Event Viewer", h_gui_events);
-
-}
-
-void event_destroy_walk(gpointer data, gpointer user_data)
-{
- gui_events_destructor((EventViewerData*)data);
-}
-
-/**
- * plugin's destroy function
- *
- * This function releases the memory reserved by the module and unregisters
- * everything that has been registered in the gtkTraceSet API.
- */
-G_MODULE_EXPORT void destroy() {
- int i;
-
- EventViewerData *event_viewer_data;
-
- if(g_event_viewer_data_list){
- g_slist_foreach(g_event_viewer_data_list, event_destroy_walk, NULL );
- g_slist_free(g_event_viewer_data_list);
- }
-
- /* Unregister the toolbar insert button */
- toolbar_item_unreg(h_gui_events);
-
- /* Unregister the menu item insert entry */
- menu_item_unreg(h_gui_events);
-}
-
/* Enumeration of the columns */
enum
{
G_OBJECT(event_viewer_data->hbox_v),
MAX_NUMBER_EVENT,
&event_viewer_data->size);
-
+/*
g_object_set_data(
G_OBJECT(event_viewer_data->hbox_v),
TRACESET_TIME_SPAN,
&event_viewer_data->time_span);
-
+*/
event_viewer_data->filter_key = g_strdup(key);
g_object_set_data(
G_OBJECT(event_viewer_data->hbox_v),
EventViewerData *event_viewer_data = (EventViewerData*) hook_data;
LttvTracesetContext * tsc = get_traceset_context(event_viewer_data->mw);
+ if(event_viewer_data->raw_trace_data_queue_tmp->length == 0 &&
+ event_viewer_data->raw_trace_data_queue->length == 0){
+ event_viewer_data->shown = FALSE;
+ return FALSE;
+ }
+
if(event_viewer_data->shown == FALSE){
event_viewer_data->shown = TRUE;
update_raw_data_array(event_viewer_data,
unreg_show_viewer(show_event_detail,event_viewer_data, event_viewer_data->mw);
unreg_update_traceset(traceset_changed,event_viewer_data, event_viewer_data->mw);
+ g_free(event_viewer_data->filter_key);
g_event_viewer_data_list = g_slist_remove(g_event_viewer_data_list, event_viewer_data);
g_free(event_viewer_data);
}
/* May already been done by GTK window closing */
if(GTK_IS_WIDGET(event_viewer_data->hbox_v)){
+ gui_events_free(event_viewer_data);
gtk_widget_destroy(event_viewer_data->hbox_v);
- g_free(event_viewer_data->filter_key);
event_viewer_data = NULL;
}
LttvTracesetContext * tsc)
{
gint i, j, k, m,n, nbi, id;
- gint nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
+ gint nb_tracefile, nb_facility, nb_event;
LttTrace *trace;
LttvTraceContext *tc;
LttvTracefileContext *tfc;
trace = tc->t;
//if there are hooks for trace, add them here
- nb_control = ltt_trace_control_tracefile_number(trace);
- nb_per_cpu = ltt_trace_per_cpu_tracefile_number(trace);
- nb_tracefile = nb_control + nb_per_cpu;
+ nb_tracefile = ltt_trace_control_tracefile_number(trace) +
+ ltt_trace_per_cpu_tracefile_number(trace);
for(j = 0 ; j < nb_tracefile ; j++) {
tf_s = lttv_trace_selector_tracefile_get(t_s,j);
selected = lttv_tracefile_selector_get_selected(tf_s);
if(!selected) continue;
-
- if(j < nb_control)
- tfc = tc->control_tracefiles[j];
- else
- tfc = tc->per_cpu_tracefiles[j - nb_control];
+ tfc = tc->tracefiles[j];
//if there are hooks for tracefile, add them here
// lttv_tracefile_context_add_hooks(tfc, NULL,NULL,NULL,NULL,
LttvTracesetContext * tsc)
{
gint i, j, k, m, nbi, n, id;
- gint nb_tracefile, nb_control, nb_per_cpu, nb_facility, nb_event;
+ gint nb_tracefile, nb_facility, nb_event;
LttTrace *trace;
LttvTraceContext *tc;
LttvTracefileContext *tfc;
trace = tc->t;
//if there are hooks for trace, remove them here
- nb_control = ltt_trace_control_tracefile_number(trace);
- nb_per_cpu = ltt_trace_per_cpu_tracefile_number(trace);
- nb_tracefile = nb_control + nb_per_cpu;
+ nb_tracefile = ltt_trace_control_tracefile_number(trace) +
+ ltt_trace_per_cpu_tracefile_number(trace);
for(j = 0 ; j < nb_tracefile ; j++) {
tf_s = lttv_trace_selector_tracefile_get(t_s,j);
selected = lttv_tracefile_selector_get_selected(tf_s);
if(!selected) continue;
-
- if(j < nb_control)
- tfc = tc->control_tracefiles[j];
- else
- tfc = tc->per_cpu_tracefiles[j - nb_control];
+ tfc = tc->tracefiles[j];
//if there are hooks for tracefile, remove them here
// lttv_tracefile_context_remove_hooks(tfc, NULL,NULL,NULL,NULL,
int i, j;
LttTime t;
+ if(!event_viewer_data->raw_trace_data_queue->head) return FALSE;
+
if(event_viewer_data->current_time_updated ){
event_viewer_data->current_time_updated = FALSE;
return FALSE;
}
+/**
+ * plugin's init function
+ *
+ * This function initializes the Event Viewer functionnality through the
+ * gtkTraceSet API.
+ */
+static void init() {
+
+ /* Register the toolbar insert button */
+ toolbar_item_reg(hGuiEventsInsert_xpm, "Insert Event Viewer", h_gui_events);
+
+ /* Register the menu item insert entry */
+ menu_item_reg("/", "Insert Event Viewer", h_gui_events);
+
+}
+
+void event_destroy_walk(gpointer data, gpointer user_data)
+{
+ gui_events_destructor((EventViewerData*)data);
+}
+
+/**
+ * plugin's destroy function
+ *
+ * This function releases the memory reserved by the module and unregisters
+ * everything that has been registered in the gtkTraceSet API.
+ */
+static void destroy() {
+ int i;
+
+ EventViewerData *event_viewer_data;
+
+ if(g_event_viewer_data_list){
+ g_slist_foreach(g_event_viewer_data_list, event_destroy_walk, NULL );
+ g_slist_free(g_event_viewer_data_list);
+ }
+
+ /* Unregister the toolbar insert button */
+ toolbar_item_unreg(h_gui_events);
+
+ /* Unregister the menu item insert entry */
+ menu_item_unreg(h_gui_events);
+}
+
+
+LTTV_MODULE("guievents", "Detailed events view", \
+ "Graphical module to display a detailed event list", \
+ init, destroy, "lttvwindow")