move lttv into trunk/lttv
[lttv.git] / trunk / lttv / lttv / modules / gui / resourceview / module.c
1 /* This file is part of the Linux Trace Toolkit viewer
2 * Copyright (C) 2007 Pierre-Marc Fournier
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
16 * MA 02111-1307, USA.
17 */
18
19
20 #ifdef HAVE_CONFIG_H
21 #include <config.h>
22 #endif
23
24 #include <glib.h>
25 #include <lttv/lttv.h>
26 #include <lttv/module.h>
27 #include <lttvwindow/lttvwindow.h>
28
29 #include "cfv.h"
30 #include "lttv_plugin_cfv.h"
31 #include "eventhooks.h"
32
33 #include "resourceview_icon.xpm"
34 #include "hLegendInsert.xpm"
35
36 GQuark LTT_NAME_CPU;
37
38 /** Array containing instanced objects. Used when module is unloaded */
39 GSList *g_control_flow_data_list = NULL ;
40
41 GSList *g_legend_list = NULL ;
42
43 /*****************************************************************************
44 * Functions for module loading/unloading *
45 *****************************************************************************/
46 /**
47 * plugin's init function
48 *
49 * This function initializes the Control Flow Viewer functionnality through the
50 * gtkTraceSet API.
51 */
52 static void init() {
53
54 g_info("Resource usage viewer init()");
55
56 /* Register the toolbar insert button and menu entry*/
57 lttvwindow_register_constructor("resourceview",
58 "/",
59 "Insert Resource Viewer",
60 resourceview_icon_xpm,
61 "Insert Resource Viewer",
62 h_resourceview);
63
64
65 LTT_NAME_CPU = g_quark_from_string("/cpu");
66 }
67
68 void destroy_walk(gpointer data, gpointer user_data)
69 {
70 g_info("Walk destroy Resource Viewer");
71 guicontrolflow_destructor_full((LttvPluginCFV*)data);
72 }
73
74
75 /**
76 * plugin's destroy function
77 *
78 * This function releases the memory reserved by the module and unregisters
79 * everything that has been registered in the gtkTraceSet API.
80 */
81 static void destroy() {
82 g_info("GUI resource viewer destroy()");
83
84 g_slist_foreach(g_control_flow_data_list, destroy_walk, NULL );
85
86 g_slist_free(g_control_flow_data_list);
87
88 /* Unregister the toolbar insert button and menu entry */
89 lttvwindow_unregister_constructor(h_resourceview);
90 }
91
92
93 LTTV_MODULE("resourceview", "Resource viewer", \
94 "Graphical module to view usage of resources", \
95 init, destroy, "lttvwindow")
This page took 0.030594 seconds and 4 git commands to generate.