6b1d3120 |
1 | #include <glib.h> |
2 | #include <gmodule.h> |
3 | #include <gtk/gtk.h> |
4 | #include <gdk/gdk.h> |
5 | |
6 | #include <lttv/module.h> |
7 | #include <lttv/gtkTraceSet.h> |
8 | #include <lttv/processTrace.h> |
9 | #include <lttv/hook.h> |
10 | #include <lttv/common.h> |
11 | #include <lttv/state.h> |
12 | #include <lttv/stats.h> |
13 | |
14 | #include <ltt/ltt.h> |
15 | #include <ltt/event.h> |
16 | #include <ltt/type.h> |
17 | #include <ltt/trace.h> |
18 | |
19 | #include <string.h> |
20 | |
21 | #include "../icons/hGuiStatisticInsert.xpm" |
22 | |
f7afe191 |
23 | #define g_info(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format) |
24 | #define g_debug(format...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, format) |
25 | |
6b1d3120 |
26 | #define PATH_LENGTH 256 |
27 | |
10f2da95 |
28 | static LttvModule *statistic_main_win_module; |
6b1d3120 |
29 | |
30 | /** Array containing instanced objects. Used when module is unloaded */ |
10f2da95 |
31 | static GSList *g_statistic_viewer_data_list = NULL ; |
6b1d3120 |
32 | |
33 | typedef struct _StatisticViewerData StatisticViewerData; |
34 | |
35 | //! Statistic Viewer's constructor hook |
bca3b81f |
36 | GtkWidget *h_gui_statistic(MainWindow *parent_window); |
6b1d3120 |
37 | //! Statistic Viewer's constructor |
bca3b81f |
38 | StatisticViewerData *gui_statistic(MainWindow *parent_window); |
6b1d3120 |
39 | //! Statistic Viewer's destructor |
10f2da95 |
40 | void gui_statistic_destructor(StatisticViewerData *statistic_viewer_data); |
41 | void gui_statistic_free(StatisticViewerData *statistic_viewer_data); |
6b1d3120 |
42 | |
43 | void grab_focus(GtkWidget *widget, gpointer data); |
44 | static void tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data); |
45 | |
2176f952 |
46 | void statistic_destroy_hash_key(gpointer key); |
47 | void statistic_destroy_hash_data(gpointer data); |
6b1d3120 |
48 | |
10f2da95 |
49 | void get_traceset_stats(StatisticViewerData * statistic_viewer_data); |
50 | void show_traceset_stats(StatisticViewerData * statistic_viewer_data); |
51 | void show_tree(StatisticViewerData * statistic_viewer_data, |
6b1d3120 |
52 | LttvAttribute* stats, GtkTreeIter* parent); |
10f2da95 |
53 | void show_statistic(StatisticViewerData * statistic_viewer_data, |
6b1d3120 |
54 | LttvAttribute* stats, GtkTextBuffer* buf); |
55 | |
56 | |
57 | enum |
58 | { |
59 | NAME_COLUMN, |
60 | N_COLUMNS |
61 | }; |
62 | |
63 | struct _StatisticViewerData{ |
bca3b81f |
64 | MainWindow * mw; |
6b1d3120 |
65 | LttvTracesetStats * stats; |
66 | |
10f2da95 |
67 | GtkWidget * hpaned_v; |
68 | GtkTreeStore * store_m; |
69 | GtkWidget * tree_v; |
6b1d3120 |
70 | |
71 | //scroll window containing Tree View |
10f2da95 |
72 | GtkWidget * scroll_win_tree; |
6b1d3120 |
73 | |
10f2da95 |
74 | GtkWidget * text_v; |
6b1d3120 |
75 | //scroll window containing Text View |
10f2da95 |
76 | GtkWidget * scroll_win_text; |
6b1d3120 |
77 | |
78 | // Selection handler |
10f2da95 |
79 | GtkTreeSelection *select_c; |
6b1d3120 |
80 | |
81 | //hash |
10f2da95 |
82 | GHashTable *statistic_hash; |
6b1d3120 |
83 | }; |
84 | |
85 | |
86 | /** |
87 | * plugin's init function |
88 | * |
89 | * This function initializes the Statistic Viewer functionnality through the |
90 | * gtkTraceSet API. |
91 | */ |
92 | G_MODULE_EXPORT void init(LttvModule *self, int argc, char *argv[]) { |
93 | |
10f2da95 |
94 | statistic_main_win_module = lttv_module_require(self, "mainwin", argc, argv); |
6b1d3120 |
95 | |
10f2da95 |
96 | if(statistic_main_win_module == NULL){ |
6b1d3120 |
97 | g_critical("Can't load Statistic Viewer : missing mainwin\n"); |
98 | return; |
99 | } |
100 | |
6b1d3120 |
101 | /* Register the toolbar insert button */ |
10f2da95 |
102 | ToolbarItemReg(hGuiStatisticInsert_xpm, "Insert Statistic Viewer", h_gui_statistic); |
6b1d3120 |
103 | |
104 | /* Register the menu item insert entry */ |
10f2da95 |
105 | MenuItemReg("/", "Insert Statistic Viewer", h_gui_statistic); |
6b1d3120 |
106 | |
107 | } |
108 | |
2176f952 |
109 | void statistic_destroy_walk(gpointer data, gpointer user_data) |
6b1d3120 |
110 | { |
10f2da95 |
111 | gui_statistic_destructor((StatisticViewerData*)data); |
6b1d3120 |
112 | } |
113 | |
114 | /** |
115 | * plugin's destroy function |
116 | * |
117 | * This function releases the memory reserved by the module and unregisters |
118 | * everything that has been registered in the gtkTraceSet API. |
119 | */ |
120 | G_MODULE_EXPORT void destroy() { |
121 | int i; |
122 | |
10f2da95 |
123 | if(g_statistic_viewer_data_list){ |
124 | g_slist_foreach(g_statistic_viewer_data_list, statistic_destroy_walk, NULL ); |
125 | g_slist_free(g_statistic_viewer_data_list); |
2176f952 |
126 | } |
6b1d3120 |
127 | |
128 | /* Unregister the toolbar insert button */ |
10f2da95 |
129 | ToolbarItemUnreg(h_gui_statistic); |
6b1d3120 |
130 | |
131 | /* Unregister the menu item insert entry */ |
10f2da95 |
132 | MenuItemUnreg(h_gui_statistic); |
6b1d3120 |
133 | } |
134 | |
135 | |
136 | void |
10f2da95 |
137 | gui_statistic_free(StatisticViewerData *statistic_viewer_data) |
6b1d3120 |
138 | { |
10f2da95 |
139 | if(statistic_viewer_data){ |
140 | g_hash_table_destroy(statistic_viewer_data->statistic_hash); |
141 | g_statistic_viewer_data_list = g_slist_remove(g_statistic_viewer_data_list, statistic_viewer_data); |
142 | g_free(statistic_viewer_data); |
7a859036 |
143 | } |
6b1d3120 |
144 | } |
145 | |
146 | void |
10f2da95 |
147 | gui_statistic_destructor(StatisticViewerData *statistic_viewer_data) |
6b1d3120 |
148 | { |
149 | /* May already been done by GTK window closing */ |
10f2da95 |
150 | if(GTK_IS_WIDGET(statistic_viewer_data->hpaned_v)){ |
151 | gtk_widget_destroy(statistic_viewer_data->hpaned_v); |
152 | statistic_viewer_data = NULL; |
7a859036 |
153 | } |
10f2da95 |
154 | //gui_statistic_free(statistic_viewer_data); |
6b1d3120 |
155 | } |
156 | |
157 | |
158 | /** |
159 | * Statistic Viewer's constructor hook |
160 | * |
161 | * This constructor is given as a parameter to the menuitem and toolbar button |
162 | * registration. It creates the list. |
10f2da95 |
163 | * @param parent_window A pointer to the parent window. |
6b1d3120 |
164 | * @return The widget created. |
165 | */ |
166 | GtkWidget * |
bca3b81f |
167 | h_gui_statistic(MainWindow * parent_window) |
6b1d3120 |
168 | { |
10f2da95 |
169 | StatisticViewerData* statistic_viewer_data = gui_statistic(parent_window) ; |
6b1d3120 |
170 | |
10f2da95 |
171 | if(statistic_viewer_data) |
172 | return statistic_viewer_data->hpaned_v; |
6b1d3120 |
173 | else return NULL; |
174 | |
175 | } |
176 | |
177 | /** |
178 | * Statistic Viewer's constructor |
179 | * |
180 | * This constructor is used to create StatisticViewerData data structure. |
181 | * @return The Statistic viewer data created. |
182 | */ |
183 | StatisticViewerData * |
bca3b81f |
184 | gui_statistic(MainWindow *parent_window) |
6b1d3120 |
185 | { |
186 | GtkCellRenderer *renderer; |
187 | GtkTreeViewColumn *column; |
188 | |
10f2da95 |
189 | StatisticViewerData* statistic_viewer_data = g_new(StatisticViewerData,1); |
6b1d3120 |
190 | |
10f2da95 |
191 | statistic_viewer_data->mw = parent_window; |
192 | statistic_viewer_data->stats = getTracesetStats(statistic_viewer_data->mw); |
6b1d3120 |
193 | |
10f2da95 |
194 | statistic_viewer_data->statistic_hash = g_hash_table_new_full(g_str_hash, g_str_equal, |
2176f952 |
195 | statistic_destroy_hash_key, |
196 | statistic_destroy_hash_data); |
6b1d3120 |
197 | |
10f2da95 |
198 | statistic_viewer_data->hpaned_v = gtk_hpaned_new(); |
199 | statistic_viewer_data->store_m = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING); |
200 | statistic_viewer_data->tree_v = gtk_tree_view_new_with_model (GTK_TREE_MODEL (statistic_viewer_data->store_m)); |
201 | g_object_unref (G_OBJECT (statistic_viewer_data->store_m)); |
6b1d3120 |
202 | |
10f2da95 |
203 | g_signal_connect (G_OBJECT (statistic_viewer_data->tree_v), "grab-focus", |
6b1d3120 |
204 | G_CALLBACK (grab_focus), |
10f2da95 |
205 | statistic_viewer_data); |
6b1d3120 |
206 | |
207 | // Setup the selection handler |
10f2da95 |
208 | statistic_viewer_data->select_c = gtk_tree_view_get_selection (GTK_TREE_VIEW (statistic_viewer_data->tree_v)); |
209 | gtk_tree_selection_set_mode (statistic_viewer_data->select_c, GTK_SELECTION_SINGLE); |
210 | g_signal_connect (G_OBJECT (statistic_viewer_data->select_c), "changed", |
6b1d3120 |
211 | G_CALLBACK (tree_selection_changed_cb), |
10f2da95 |
212 | statistic_viewer_data); |
6b1d3120 |
213 | |
214 | renderer = gtk_cell_renderer_text_new (); |
215 | column = gtk_tree_view_column_new_with_attributes ("Statistic Name", |
216 | renderer, |
217 | "text", NAME_COLUMN, |
218 | NULL); |
219 | gtk_tree_view_column_set_alignment (column, 0.0); |
220 | // gtk_tree_view_column_set_fixed_width (column, 45); |
10f2da95 |
221 | gtk_tree_view_append_column (GTK_TREE_VIEW (statistic_viewer_data->tree_v), column); |
6b1d3120 |
222 | |
223 | |
10f2da95 |
224 | gtk_tree_view_set_headers_visible(GTK_TREE_VIEW (statistic_viewer_data->tree_v), FALSE); |
6b1d3120 |
225 | |
10f2da95 |
226 | statistic_viewer_data->scroll_win_tree = gtk_scrolled_window_new (NULL, NULL); |
227 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(statistic_viewer_data->scroll_win_tree), |
6b1d3120 |
228 | GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); |
229 | |
10f2da95 |
230 | gtk_container_add (GTK_CONTAINER (statistic_viewer_data->scroll_win_tree), statistic_viewer_data->tree_v); |
231 | gtk_paned_pack1(GTK_PANED(statistic_viewer_data->hpaned_v),statistic_viewer_data->scroll_win_tree, TRUE, FALSE); |
232 | gtk_paned_set_position(GTK_PANED(statistic_viewer_data->hpaned_v), 160); |
6b1d3120 |
233 | |
10f2da95 |
234 | statistic_viewer_data->scroll_win_text = gtk_scrolled_window_new (NULL, NULL); |
235 | gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(statistic_viewer_data->scroll_win_text), |
6b1d3120 |
236 | GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC); |
237 | |
10f2da95 |
238 | statistic_viewer_data->text_v = gtk_text_view_new (); |
239 | g_signal_connect (G_OBJECT (statistic_viewer_data->text_v), "grab-focus", |
6b1d3120 |
240 | G_CALLBACK (grab_focus), |
10f2da95 |
241 | statistic_viewer_data); |
6b1d3120 |
242 | |
10f2da95 |
243 | gtk_text_view_set_editable(GTK_TEXT_VIEW(statistic_viewer_data->text_v),FALSE); |
244 | gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(statistic_viewer_data->text_v),FALSE); |
245 | gtk_container_add (GTK_CONTAINER (statistic_viewer_data->scroll_win_text), statistic_viewer_data->text_v); |
246 | gtk_paned_pack2(GTK_PANED(statistic_viewer_data->hpaned_v), statistic_viewer_data->scroll_win_text, TRUE, FALSE); |
6b1d3120 |
247 | |
10f2da95 |
248 | gtk_widget_show(statistic_viewer_data->scroll_win_tree); |
249 | gtk_widget_show(statistic_viewer_data->scroll_win_text); |
250 | gtk_widget_show(statistic_viewer_data->tree_v); |
251 | gtk_widget_show(statistic_viewer_data->text_v); |
252 | gtk_widget_show(statistic_viewer_data->hpaned_v); |
6b1d3120 |
253 | |
254 | g_object_set_data_full( |
10f2da95 |
255 | G_OBJECT(statistic_viewer_data->hpaned_v), |
256 | "statistic_viewer_data", |
257 | statistic_viewer_data, |
258 | (GDestroyNotify)gui_statistic_free); |
6b1d3120 |
259 | |
260 | /* Add the object's information to the module's array */ |
10f2da95 |
261 | g_statistic_viewer_data_list = g_slist_append( |
262 | g_statistic_viewer_data_list, |
263 | statistic_viewer_data); |
6b1d3120 |
264 | |
10f2da95 |
265 | get_traceset_stats(statistic_viewer_data); |
6b1d3120 |
266 | |
10f2da95 |
267 | return statistic_viewer_data; |
6b1d3120 |
268 | } |
269 | |
270 | void grab_focus(GtkWidget *widget, gpointer data) |
271 | { |
10f2da95 |
272 | StatisticViewerData *statistic_viewer_data = (StatisticViewerData *)data; |
bca3b81f |
273 | MainWindow * mw = statistic_viewer_data->mw; |
10f2da95 |
274 | SetFocusedPane(mw, gtk_widget_get_parent(statistic_viewer_data->hpaned_v)); |
6b1d3120 |
275 | } |
276 | |
277 | static void |
278 | tree_selection_changed_cb (GtkTreeSelection *selection, gpointer data) |
279 | { |
10f2da95 |
280 | StatisticViewerData *statistic_viewer_data = (StatisticViewerData*)data; |
6b1d3120 |
281 | GtkTreeIter iter; |
10f2da95 |
282 | GtkTreeModel *model = GTK_TREE_MODEL(statistic_viewer_data->store_m); |
283 | gchar *event; |
6b1d3120 |
284 | GtkTextBuffer* buf; |
285 | gchar * str; |
286 | GtkTreePath * path; |
287 | GtkTextIter text_iter; |
288 | LttvAttribute * stats; |
289 | |
290 | if (gtk_tree_selection_get_selected (selection, &model, &iter)) |
291 | { |
10f2da95 |
292 | gtk_tree_model_get (model, &iter, NAME_COLUMN, &event, -1); |
6b1d3120 |
293 | |
294 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(model),&iter); |
295 | str = gtk_tree_path_to_string (path); |
10f2da95 |
296 | stats = (LttvAttribute*)g_hash_table_lookup (statistic_viewer_data->statistic_hash,str); |
6b1d3120 |
297 | g_free(str); |
298 | |
10f2da95 |
299 | buf = gtk_text_view_get_buffer((GtkTextView*)statistic_viewer_data->text_v); |
6b1d3120 |
300 | gtk_text_buffer_set_text(buf,"Statistic for '", -1); |
301 | gtk_text_buffer_get_end_iter(buf, &text_iter); |
10f2da95 |
302 | gtk_text_buffer_insert(buf, &text_iter, event, strlen(event)); |
6b1d3120 |
303 | gtk_text_buffer_get_end_iter(buf, &text_iter); |
304 | gtk_text_buffer_insert(buf, &text_iter, "' :\n\n",5); |
305 | |
10f2da95 |
306 | show_statistic(statistic_viewer_data, stats, buf); |
6b1d3120 |
307 | |
10f2da95 |
308 | g_free (event); |
6b1d3120 |
309 | } |
310 | } |
311 | |
2176f952 |
312 | void statistic_destroy_hash_key(gpointer key) |
6b1d3120 |
313 | { |
314 | g_free(key); |
315 | } |
316 | |
2176f952 |
317 | void statistic_destroy_hash_data(gpointer data) |
6b1d3120 |
318 | { |
319 | // g_free(data); |
320 | } |
321 | |
10f2da95 |
322 | void get_traceset_stats(StatisticViewerData * statistic_viewer_data) |
6b1d3120 |
323 | { |
324 | LttTime start, end; |
325 | |
326 | start.tv_sec = 0; |
327 | start.tv_nsec = 0; |
328 | end.tv_sec = G_MAXULONG; |
329 | end.tv_nsec = G_MAXULONG; |
330 | |
10f2da95 |
331 | stateAddEventHooks(statistic_viewer_data->mw); |
332 | statsAddEventHooks(statistic_viewer_data->mw); |
6b1d3120 |
333 | |
10f2da95 |
334 | processTraceset(statistic_viewer_data->mw, start, end, G_MAXULONG); |
6b1d3120 |
335 | |
10f2da95 |
336 | stateRemoveEventHooks(statistic_viewer_data->mw); |
337 | statsRemoveEventHooks(statistic_viewer_data->mw); |
6b1d3120 |
338 | |
339 | //establish tree view for stats |
10f2da95 |
340 | show_traceset_stats(statistic_viewer_data); |
6b1d3120 |
341 | } |
342 | |
10f2da95 |
343 | void show_traceset_stats(StatisticViewerData * statistic_viewer_data) |
6b1d3120 |
344 | { |
345 | int i, nb; |
346 | LttvTraceset *ts; |
347 | LttvTraceStats *tcs; |
348 | LttSystemDescription *desc; |
10f2da95 |
349 | LttvTracesetStats * tscs = statistic_viewer_data->stats; |
6b1d3120 |
350 | gchar * str, trace_str[PATH_LENGTH]; |
351 | GtkTreePath * path; |
352 | GtkTreeIter iter; |
10f2da95 |
353 | GtkTreeStore * store = statistic_viewer_data->store_m; |
6b1d3120 |
354 | |
355 | if(tscs->stats == NULL) return; |
356 | |
357 | gtk_tree_store_append (store, &iter, NULL); |
358 | gtk_tree_store_set (store, &iter, |
359 | NAME_COLUMN, "Traceset statistics", |
360 | -1); |
361 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
362 | str = gtk_tree_path_to_string (path); |
10f2da95 |
363 | g_hash_table_insert(statistic_viewer_data->statistic_hash, |
6b1d3120 |
364 | (gpointer)str, tscs->stats); |
10f2da95 |
365 | show_tree(statistic_viewer_data, tscs->stats, &iter); |
6b1d3120 |
366 | |
367 | //show stats for all traces |
368 | ts = tscs->parent.parent.ts; |
369 | nb = lttv_traceset_number(ts); |
370 | |
371 | for(i = 0 ; i < nb ; i++) { |
372 | tcs = (LttvTraceStats *)(LTTV_TRACESET_CONTEXT(tscs)->traces[i]); |
373 | desc = ltt_trace_system_description(tcs->parent.parent.t); |
374 | sprintf(trace_str, "Trace on system %s at time %d secs", |
375 | desc->node_name,desc->trace_start.tv_sec); |
376 | |
377 | gtk_tree_store_append (store, &iter, NULL); |
378 | gtk_tree_store_set (store, &iter,NAME_COLUMN,trace_str,-1); |
379 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
380 | str = gtk_tree_path_to_string (path); |
10f2da95 |
381 | g_hash_table_insert(statistic_viewer_data->statistic_hash, |
6b1d3120 |
382 | (gpointer)str,tcs->stats); |
10f2da95 |
383 | show_tree(statistic_viewer_data, tcs->stats, &iter); |
6b1d3120 |
384 | } |
385 | } |
386 | |
10f2da95 |
387 | void show_tree(StatisticViewerData * statistic_viewer_data, |
6b1d3120 |
388 | LttvAttribute* stats, GtkTreeIter* parent) |
389 | { |
390 | int i, nb; |
391 | LttvAttribute *subtree; |
392 | LttvAttributeName name; |
393 | LttvAttributeValue value; |
394 | LttvAttributeType type; |
395 | gchar * str, dir_str[PATH_LENGTH]; |
396 | GtkTreePath * path; |
397 | GtkTreeIter iter; |
10f2da95 |
398 | GtkTreeStore * store = statistic_viewer_data->store_m; |
6b1d3120 |
399 | |
400 | nb = lttv_attribute_get_number(stats); |
401 | for(i = 0 ; i < nb ; i++) { |
402 | type = lttv_attribute_get(stats, i, &name, &value); |
403 | switch(type) { |
404 | case LTTV_GOBJECT: |
405 | if(LTTV_IS_ATTRIBUTE(*(value.v_gobject))) { |
406 | sprintf(dir_str, "%s", g_quark_to_string(name)); |
407 | subtree = (LttvAttribute *)*(value.v_gobject); |
408 | gtk_tree_store_append (store, &iter, parent); |
409 | gtk_tree_store_set (store, &iter,NAME_COLUMN,dir_str,-1); |
410 | path = gtk_tree_model_get_path(GTK_TREE_MODEL(store), &iter); |
411 | str = gtk_tree_path_to_string (path); |
10f2da95 |
412 | g_hash_table_insert(statistic_viewer_data->statistic_hash, |
6b1d3120 |
413 | (gpointer)str, subtree); |
10f2da95 |
414 | show_tree(statistic_viewer_data, subtree, &iter); |
6b1d3120 |
415 | } |
416 | break; |
417 | default: |
418 | break; |
419 | } |
420 | } |
421 | } |
422 | |
10f2da95 |
423 | void show_statistic(StatisticViewerData * statistic_viewer_data, |
6b1d3120 |
424 | LttvAttribute* stats, GtkTextBuffer* buf) |
425 | { |
426 | int i, nb , flag; |
427 | LttvAttribute *subtree; |
428 | LttvAttributeName name; |
429 | LttvAttributeValue value; |
430 | LttvAttributeType type; |
431 | gchar type_name[PATH_LENGTH], type_value[PATH_LENGTH]; |
432 | GtkTextIter text_iter; |
433 | |
434 | flag = 0; |
435 | nb = lttv_attribute_get_number(stats); |
436 | for(i = 0 ; i < nb ; i++) { |
437 | type = lttv_attribute_get(stats, i, &name, &value); |
438 | sprintf(type_name,"%s", g_quark_to_string(name)); |
439 | type_value[0] = '\0'; |
440 | switch(type) { |
441 | case LTTV_INT: |
442 | sprintf(type_value, " : %d\n", *value.v_int); |
443 | break; |
444 | case LTTV_UINT: |
445 | sprintf(type_value, " : %u\n", *value.v_uint); |
446 | break; |
447 | case LTTV_LONG: |
448 | sprintf(type_value, " : %ld\n", *value.v_long); |
449 | break; |
450 | case LTTV_ULONG: |
451 | sprintf(type_value, " : %lu\n", *value.v_ulong); |
452 | break; |
453 | case LTTV_FLOAT: |
454 | sprintf(type_value, " : %f\n", (double)*value.v_float); |
455 | break; |
456 | case LTTV_DOUBLE: |
457 | sprintf(type_value, " : %f\n", *value.v_double); |
458 | break; |
459 | case LTTV_TIME: |
460 | sprintf(type_value, " : %10u.%09u\n", value.v_time->tv_sec, |
461 | value.v_time->tv_nsec); |
462 | break; |
463 | case LTTV_POINTER: |
464 | sprintf(type_value, " : POINTER\n"); |
465 | break; |
466 | case LTTV_STRING: |
467 | sprintf(type_value, " : %s\n", *value.v_string); |
468 | break; |
469 | default: |
470 | break; |
471 | } |
472 | if(strlen(type_value)){ |
473 | flag = 1; |
474 | strcat(type_name,type_value); |
475 | gtk_text_buffer_get_end_iter(buf, &text_iter); |
476 | gtk_text_buffer_insert(buf, &text_iter, type_name, strlen(type_name)); |
477 | } |
478 | } |
479 | |
480 | if(flag == 0){ |
481 | sprintf(type_value, "No statistic information in this directory.\nCheck in subdirectories please.\n"); |
482 | gtk_text_buffer_get_end_iter(buf, &text_iter); |
483 | gtk_text_buffer_insert(buf, &text_iter, type_value, strlen(type_value)); |
484 | |
485 | } |
486 | } |
487 | |
488 | |