Update FSF address
[lttv.git] / lttv / modules / gui / resourceview / module.c
CommitLineData
9e01e6d4 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
b9ce0bad
YB
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
16 * MA 02110-1301, USA.
9e01e6d4 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
508cde4f 33#include "resourceview_icon.xpm"
7d0aa40c 34/* unused #include "hLegendInsert.xpm" */
9e01e6d4 35
36GQuark LTT_NAME_CPU;
37
38/** Array containing instanced objects. Used when module is unloaded */
39GSList *g_control_flow_data_list = NULL ;
40
41GSList *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 */
52static 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",
508cde4f 60 resourceview_icon_xpm,
9e01e6d4 61 "Insert Resource Viewer",
58a9b31b 62 h_resourceview);
9e01e6d4 63
64
65 LTT_NAME_CPU = g_quark_from_string("/cpu");
66}
67
68void 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 */
81static 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 */
58a9b31b 89 lttvwindow_unregister_constructor(h_resourceview);
9e01e6d4 90}
91
92
93LTTV_MODULE("resourceview", "Resource viewer", \
94 "Graphical module to view usage of resources", \
95 init, destroy, "lttvwindow")
This page took 0.047223 seconds and 4 git commands to generate.