Commit | Line | Data |
---|---|---|
ce0214a6 | 1 | /* This file is part of the Linux Trace Toolkit viewer |
2 | * Copyright (C) 2003-2004 Mathieu Desnoyers | |
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. | |
ce0214a6 | 17 | */ |
18 | ||
19 | ||
20 | ||
f0d936c0 | 21 | /*! \defgroup guiEvents libguiControlFlow: The GUI ControlFlow display plugin */ |
22 | /*\@{*/ | |
23 | ||
24 | /*! \file guiControlFlow.c | |
25 | * \brief Graphical plugin for showing control flow of a trace. | |
26 | * | |
27 | * This plugin adds a Control Flow Viewer functionnality to Linux TraceToolkit | |
28 | * GUI when this plugin is loaded. The init and destroy functions add the | |
5ac76b22 | 29 | * viewer's insertion menu item and toolbar icon by calling viewer.h's |
f0d936c0 | 30 | * API functions. Then, when a viewer's object is created, the constructor |
31 | * creates ans register through API functions what is needed to interact | |
32 | * with the TraceSet window. | |
33 | * | |
34 | * This plugin uses the gdk library to draw the events and gtk to interact | |
35 | * with the user. | |
36 | * | |
37 | * Author : Mathieu Desnoyers, June 2003 | |
38 | */ | |
39 | ||
4e4d11b3 | 40 | #ifdef HAVE_CONFIG_H |
41 | #include <config.h> | |
42 | #endif | |
43 | ||
558aa013 | 44 | #include <glib.h> |
2a2fa4f0 | 45 | #include <lttv/lttv.h> |
f0d936c0 | 46 | #include <lttv/module.h> |
2d262115 | 47 | #include <lttvwindow/lttvwindow.h> |
558aa013 | 48 | |
d66666fe | 49 | #include "cfv.h" |
e433e6d6 | 50 | #include "lttv_plugin_cfv.h" |
d66666fe | 51 | #include "eventhooks.h" |
558aa013 | 52 | |
0c56e138 | 53 | #include "hGuiControlFlowInsert.xpm" |
558aa013 | 54 | |
2c82c4dc | 55 | GQuark LTT_NAME_CPU; |
56 | ||
558aa013 | 57 | /** Array containing instanced objects. Used when module is unloaded */ |
68997a22 | 58 | GSList *g_control_flow_data_list = NULL ; |
558aa013 | 59 | |
f0d936c0 | 60 | /***************************************************************************** |
61 | * Functions for module loading/unloading * | |
62 | *****************************************************************************/ | |
63 | /** | |
64 | * plugin's init function | |
65 | * | |
66 | * This function initializes the Control Flow Viewer functionnality through the | |
67 | * gtkTraceSet API. | |
68 | */ | |
08b1c66e | 69 | static void init() { |
558aa013 | 70 | |
a56a1ba4 | 71 | g_info("GUI ControlFlow Viewer init()"); |
72 | ||
ca0f8a8e | 73 | /* Register the toolbar insert button and menu entry*/ |
e025a729 | 74 | lttvwindow_register_constructor("guicontrolflow", |
75 | "/", | |
ca0f8a8e | 76 | "Insert Control Flow Viewer", |
77 | hGuiControlFlowInsert_xpm, | |
78 | "Insert Control Flow Viewer", | |
79 | h_guicontrolflow); | |
0de51231 | 80 | |
2c82c4dc | 81 | LTT_NAME_CPU = g_quark_from_string("/cpu"); |
f0d936c0 | 82 | } |
83 | ||
84 | void destroy_walk(gpointer data, gpointer user_data) | |
85 | { | |
a56a1ba4 | 86 | g_info("Walk destroy GUI Control Flow Viewer"); |
e433e6d6 | 87 | guicontrolflow_destructor_full((LttvPluginCFV*)data); |
f0d936c0 | 88 | } |
89 | ||
f0d936c0 | 90 | |
91 | /** | |
92 | * plugin's destroy function | |
93 | * | |
94 | * This function releases the memory reserved by the module and unregisters | |
95 | * everything that has been registered in the gtkTraceSet API. | |
96 | */ | |
08b1c66e | 97 | static void destroy() { |
a56a1ba4 | 98 | g_info("GUI Control Flow Viewer destroy()"); |
f0d936c0 | 99 | |
68997a22 | 100 | g_slist_foreach(g_control_flow_data_list, destroy_walk, NULL ); |
a56a1ba4 | 101 | |
68997a22 | 102 | g_slist_free(g_control_flow_data_list); |
f7afe191 | 103 | |
0de51231 | 104 | g_slist_free(g_control_flow_data_list); |
105 | ||
ca0f8a8e | 106 | /* Unregister the toolbar insert button and menu entry */ |
107 | lttvwindow_unregister_constructor(h_guicontrolflow); | |
558aa013 | 108 | } |
08b1c66e | 109 | |
110 | ||
111 | LTTV_MODULE("guicontrolflow", "Control flow viewer", \ | |
112 | "Graphical module to view processes state and control flow", \ | |
db2c9c14 | 113 | init, destroy, "lttvwindow") |