X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=ltt%2Fbranches%2Fpoly%2Flttv%2Fmodules%2Fgui%2Fstatistics%2Fstatistics.c;h=d1726c0003639e6b05d34864badadb320d0217ad;hb=0c56e138e63986d8a8c0d7fc3e2c7230a020289e;hp=fefaa3076aa27b88f0983b9f1c0194031639d86a;hpb=912be9a5bd895c20a2721f7d9799917c4517e0e4;p=lttv.git diff --git a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c index fefaa307..d1726c00 100644 --- a/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c +++ b/ltt/branches/poly/lttv/modules/gui/statistics/statistics.c @@ -17,15 +17,15 @@ */ #include -#include #include #include +#include #include -#include -#include +#include +#include #include -#include +#include #include #include @@ -36,12 +36,9 @@ #include -#include "../icons/hGuiStatisticInsert.xpm" +#include "hGuiStatisticInsert.xpm" -#define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) -#define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) - -#define PATH_LENGTH 256 +#define PATH_LENGTH 256 /* CHECK */ static LttvModule *statistic_main_win_module; static GPtrArray * statistic_traceset; @@ -118,59 +115,6 @@ struct _StatisticViewerData{ }; -/** - * plugin's init function - * - * This function initializes the Statistic Viewer functionnality through the - * gtkTraceSet API. - */ -G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) { - - statistic_main_win_module = lttv_module_require(self, "mainwin", argc, argv); - - if(statistic_main_win_module == NULL){ - g_critical("Can't load Statistic Viewer : missing mainwin\n"); - return; - } - - statistic_traceset = g_ptr_array_new (); - - /* Register the toolbar insert button */ - toolbar_item_reg(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic); - - /* Register the menu item insert entry */ - menu_item_reg("/", "Insert Statistic Viewer", h_gui_statistic); - -} - -void statistic_destroy_walk(gpointer data, gpointer user_data) -{ - gui_statistic_destructor((StatisticViewerData*)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; - - if(g_statistic_viewer_data_list){ - g_slist_foreach(g_statistic_viewer_data_list, statistic_destroy_walk, NULL ); - g_slist_free(g_statistic_viewer_data_list); - } - g_ptr_array_free (statistic_traceset, TRUE); - - /* Unregister the toolbar insert button */ - toolbar_item_unreg(h_gui_statistic); - - /* Unregister the menu item insert entry */ - menu_item_unreg(h_gui_statistic); -} - - void gui_statistic_free(StatisticViewerData *statistic_viewer_data) { @@ -333,8 +277,8 @@ gui_statistic(MainWindow *parent_window, LttvTracesetSelector * s, char* key) &statistic_viewer_data->time_span); if(statistic_viewer_data->calculate_stats){ - if(lttv_stats_load_statistics(statistic_viewer_data->stats)) - statistic_viewer_data->calculate_stats = FALSE; + //if(lttv_stats_load_statistics(statistic_viewer_data->stats)) + // statistic_viewer_data->calculate_stats = FALSE; } if(statistic_viewer_data->calculate_stats == FALSE){ @@ -584,7 +528,7 @@ gboolean statistic_show_viewer(void * hook_data, void * call_data) show_traceset_stats(statistic_viewer_data); if(statistic_viewer_data->calculate_stats){ statistic_remove_context_hooks(statistic_viewer_data,tsc); - lttv_stats_save_statistics((LttvTracesetStats*)tsc); + //lttv_stats_save_statistics((LttvTracesetStats*)tsc); } } @@ -595,8 +539,8 @@ gboolean statistic_traceset_changed(void * hook_data, void * call_data) { StatisticViewerData *statistic_viewer_data = (StatisticViewerData*) hook_data; - // gtk_tree_store_clear (statistic_viewer_data->store_m); - // statistic_viewer_data->shown = FALSE; + gtk_tree_store_clear (statistic_viewer_data->store_m); + statistic_viewer_data->shown = FALSE; return FALSE; } @@ -604,7 +548,7 @@ gboolean statistic_traceset_changed(void * hook_data, void * call_data) void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data, LttvTracesetContext * tsc) { - gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu; + gint i, j, nbi, nb_tracefile; LttTrace *trace; LttvTraceContext *tc; LttvTracefileContext *tfc; @@ -627,19 +571,14 @@ void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data, 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, @@ -656,7 +595,7 @@ void statistic_add_context_hooks(StatisticViewerData * statistic_viewer_data, void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data, LttvTracesetContext * tsc) { - gint i, j, nbi, nb_tracefile, nb_control, nb_per_cpu; + gint i, j, nbi, nb_tracefile; LttTrace *trace; LttvTraceContext *tc; LttvTracefileContext *tfc; @@ -679,19 +618,14 @@ void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data, 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, @@ -705,3 +639,53 @@ void statistic_remove_context_hooks(StatisticViewerData * statistic_viewer_data, } +/** + * plugin's init function + * + * This function initializes the Statistic Viewer functionnality through the + * gtkTraceSet API. + */ +static void init() { + + statistic_traceset = g_ptr_array_new (); + + /* Register the toolbar insert button */ + toolbar_item_reg(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic); + + /* Register the menu item insert entry */ + menu_item_reg("/", "Insert Statistic Viewer", h_gui_statistic); + +} + +void statistic_destroy_walk(gpointer data, gpointer user_data) +{ + gui_statistic_destructor((StatisticViewerData*)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; + + if(g_statistic_viewer_data_list){ + g_slist_foreach(g_statistic_viewer_data_list, statistic_destroy_walk, NULL ); + g_slist_free(g_statistic_viewer_data_list); + } + g_ptr_array_free (statistic_traceset, TRUE); + + /* Unregister the toolbar insert button */ + toolbar_item_unreg(h_gui_statistic); + + /* Unregister the menu item insert entry */ + menu_item_unreg(h_gui_statistic); +} + + +LTTV_MODULE("guistatistics", "Statistics viewer", \ + "Graphical module to view statistics about processes, CPUs and systems", \ + init, destroy, "mainwin") +