mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
Show the right number of samples afte Open; remove shadows from menu bars
Sat Mar 26 19:26:52 2005 Søren Sandmann <sandmann@redhat.com> * sysprof.c: Show the right number of samples afte Open; remove shadows from menu bars and toolbars; some other tweaks.
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
cc25479579
commit
398603a85d
@ -1,3 +1,8 @@
|
|||||||
|
Sat Mar 26 19:26:52 2005 Søren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
|
* sysprof.c: Show the right number of samples afte Open; remove
|
||||||
|
shadows from menu bars and toolbars; some other tweaks.
|
||||||
|
|
||||||
Sat Mar 26 11:26:00 2005 Soeren Sandmann <sandmann@redhat.com>
|
Sat Mar 26 11:26:00 2005 Soeren Sandmann <sandmann@redhat.com>
|
||||||
|
|
||||||
* TODO: Updates
|
* TODO: Updates
|
||||||
|
|||||||
4
TODO
4
TODO
@ -60,8 +60,6 @@
|
|||||||
|
|
||||||
- consider caching [filename => bin_file]
|
- consider caching [filename => bin_file]
|
||||||
|
|
||||||
- Make sure samples label shows correct nunber after Open
|
|
||||||
|
|
||||||
- Have kernel module report the file the address was found in
|
- Have kernel module report the file the address was found in
|
||||||
Should avoid a lot of potential broken/raciness with dlopen etc.
|
Should avoid a lot of potential broken/raciness with dlopen etc.
|
||||||
|
|
||||||
@ -98,6 +96,8 @@
|
|||||||
|
|
||||||
DONE:
|
DONE:
|
||||||
|
|
||||||
|
- Make sure samples label shows correct nunber after Open
|
||||||
|
|
||||||
- Move "samples" label to the toolbar, then get rid of statusbar.
|
- Move "samples" label to the toolbar, then get rid of statusbar.
|
||||||
|
|
||||||
- crashes when you ctrl-click the selected item in the top left pane
|
- crashes when you ctrl-click the selected item in the top left pane
|
||||||
|
|||||||
433
sysprof.c
433
sysprof.c
@ -172,7 +172,7 @@ update_sensitivity (Application *app)
|
|||||||
|
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (app->start_button),
|
gtk_widget_set_sensitive (GTK_WIDGET (app->start_button),
|
||||||
sensitive_start_button);
|
sensitive_start_button);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* FIXME: gtk+ doesn't handle changes in sensitivity in response
|
/* FIXME: gtk+ doesn't handle changes in sensitivity in response
|
||||||
* to a click on the same button very well
|
* to a click on the same button very well
|
||||||
@ -194,14 +194,14 @@ static void
|
|||||||
set_busy (Application *app, gboolean busy)
|
set_busy (Application *app, gboolean busy)
|
||||||
{
|
{
|
||||||
GdkCursor *cursor;
|
GdkCursor *cursor;
|
||||||
|
|
||||||
if (busy)
|
if (busy)
|
||||||
cursor = gdk_cursor_new (GDK_WATCH);
|
cursor = gdk_cursor_new (GDK_WATCH);
|
||||||
else
|
else
|
||||||
cursor = NULL;
|
cursor = NULL;
|
||||||
|
|
||||||
gdk_window_set_cursor (app->main_window->window, cursor);
|
gdk_window_set_cursor (app->main_window->window, cursor);
|
||||||
|
|
||||||
if (cursor)
|
if (cursor)
|
||||||
gdk_cursor_unref (cursor);
|
gdk_cursor_unref (cursor);
|
||||||
}
|
}
|
||||||
@ -350,7 +350,7 @@ empty_file_descriptor (Application *app)
|
|||||||
{
|
{
|
||||||
int rd;
|
int rd;
|
||||||
SysprofStackTrace trace;
|
SysprofStackTrace trace;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
rd = read (app->input_fd, &trace, sizeof (trace));
|
rd = read (app->input_fd, &trace, sizeof (trace));
|
||||||
@ -362,16 +362,16 @@ static gboolean
|
|||||||
start_profiling (gpointer data)
|
start_profiling (gpointer data)
|
||||||
{
|
{
|
||||||
Application *app = data;
|
Application *app = data;
|
||||||
|
|
||||||
app->state = PROFILING;
|
app->state = PROFILING;
|
||||||
|
|
||||||
update_sensitivity (app);
|
update_sensitivity (app);
|
||||||
|
|
||||||
/* Make sure samples generated between 'start clicked' and now
|
/* Make sure samples generated between 'start clicked' and now
|
||||||
* are deleted
|
* are deleted
|
||||||
*/
|
*/
|
||||||
empty_file_descriptor (app);
|
empty_file_descriptor (app);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +385,7 @@ on_start_toggled (GtkWidget *widget, gpointer data)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
delete_data (app);
|
delete_data (app);
|
||||||
|
|
||||||
g_idle_add_full (G_PRIORITY_LOW, start_profiling, app, NULL);
|
g_idle_add_full (G_PRIORITY_LOW, start_profiling, app, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -414,6 +414,29 @@ enum
|
|||||||
DESCENDANTS_OBJECT
|
DESCENDANTS_OBJECT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static ProfileObject *
|
||||||
|
get_current_object (Application *app)
|
||||||
|
{
|
||||||
|
GtkTreeSelection *selection;
|
||||||
|
GtkTreeModel *model;
|
||||||
|
GtkTreeIter selected;
|
||||||
|
ProfileObject *object;
|
||||||
|
|
||||||
|
selection = gtk_tree_view_get_selection (app->object_view);
|
||||||
|
|
||||||
|
if (gtk_tree_selection_get_selected (selection, &model, &selected))
|
||||||
|
{
|
||||||
|
gtk_tree_model_get (model, &selected,
|
||||||
|
OBJECT_OBJECT, &object,
|
||||||
|
-1);
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fill_main_list (Application *app)
|
fill_main_list (Application *app)
|
||||||
{
|
{
|
||||||
@ -467,10 +490,175 @@ fill_main_list (Application *app)
|
|||||||
|
|
||||||
g_object_unref (G_OBJECT (list_store));
|
g_object_unref (G_OBJECT (list_store));
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_view_columns_autosize (app->object_view);
|
gtk_tree_view_columns_autosize (app->object_view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_node (GtkTreeStore *store,
|
||||||
|
int size,
|
||||||
|
const GtkTreeIter *parent,
|
||||||
|
ProfileDescendant *node)
|
||||||
|
{
|
||||||
|
GtkTreeIter iter;
|
||||||
|
|
||||||
|
if (!node)
|
||||||
|
return;
|
||||||
|
|
||||||
|
gtk_tree_store_insert (store, &iter, (GtkTreeIter *)parent, 0);
|
||||||
|
|
||||||
|
gtk_tree_store_set (store, &iter,
|
||||||
|
DESCENDANTS_NAME, node->object->name,
|
||||||
|
DESCENDANTS_SELF, 100 * (node->self)/(double)size,
|
||||||
|
DESCENDANTS_NON_RECURSE, 100 * (node->non_recursion)/(double)size,
|
||||||
|
DESCENDANTS_TOTAL, 100 * (node->total)/(double)size,
|
||||||
|
DESCENDANTS_OBJECT, node->object,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
add_node (store, size, parent, node->siblings);
|
||||||
|
add_node (store, size, &iter, node->children);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_descendants_tree (Application *app)
|
||||||
|
{
|
||||||
|
GtkTreeStore *tree_store;
|
||||||
|
gpointer sort_state;
|
||||||
|
|
||||||
|
sort_state = save_sort_state (app->descendants_view);
|
||||||
|
|
||||||
|
if (app->descendants)
|
||||||
|
{
|
||||||
|
profile_descendant_free (app->descendants);
|
||||||
|
app->descendants = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
tree_store =
|
||||||
|
gtk_tree_store_new (5,
|
||||||
|
G_TYPE_STRING,
|
||||||
|
G_TYPE_DOUBLE,
|
||||||
|
G_TYPE_DOUBLE,
|
||||||
|
G_TYPE_DOUBLE,
|
||||||
|
G_TYPE_POINTER);
|
||||||
|
|
||||||
|
if (app->profile)
|
||||||
|
{
|
||||||
|
ProfileObject *object = get_current_object (app);
|
||||||
|
if (object)
|
||||||
|
{
|
||||||
|
app->descendants =
|
||||||
|
profile_create_descendants (app->profile, object);
|
||||||
|
add_node (tree_store,
|
||||||
|
profile_get_size (app->profile), NULL, app->descendants);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_tree_view_set_model (
|
||||||
|
app->descendants_view, GTK_TREE_MODEL (tree_store));
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (tree_store));
|
||||||
|
|
||||||
|
if (!sort_state)
|
||||||
|
{
|
||||||
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree_store),
|
||||||
|
DESCENDANTS_NON_RECURSE,
|
||||||
|
GTK_SORT_DESCENDING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
restore_sort_state (app->descendants_view, sort_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_tree_view_columns_autosize (app->descendants_view);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
add_callers (GtkListStore *list_store,
|
||||||
|
Profile *profile,
|
||||||
|
ProfileCaller *callers)
|
||||||
|
{
|
||||||
|
while (callers)
|
||||||
|
{
|
||||||
|
gchar *name;
|
||||||
|
GtkTreeIter iter;
|
||||||
|
double profile_size = profile_get_size (profile);
|
||||||
|
|
||||||
|
if (callers->object)
|
||||||
|
name = callers->object->name;
|
||||||
|
else
|
||||||
|
name = "<spontaneous>";
|
||||||
|
|
||||||
|
gtk_list_store_append (list_store, &iter);
|
||||||
|
gtk_list_store_set (
|
||||||
|
list_store, &iter,
|
||||||
|
CALLERS_NAME, name,
|
||||||
|
CALLERS_SELF, 100.0 * callers->self / profile_size,
|
||||||
|
CALLERS_TOTAL, 100.0 * callers->total / profile_size,
|
||||||
|
CALLERS_OBJECT, callers->object,
|
||||||
|
-1);
|
||||||
|
|
||||||
|
callers = callers->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_callers_list (Application *app)
|
||||||
|
{
|
||||||
|
GtkListStore *list_store;
|
||||||
|
gpointer sort_state;
|
||||||
|
|
||||||
|
sort_state = save_sort_state (app->descendants_view);
|
||||||
|
|
||||||
|
if (app->callers)
|
||||||
|
{
|
||||||
|
profile_caller_free (app->callers);
|
||||||
|
app->callers = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
list_store =
|
||||||
|
gtk_list_store_new (4,
|
||||||
|
G_TYPE_STRING,
|
||||||
|
G_TYPE_DOUBLE,
|
||||||
|
G_TYPE_DOUBLE,
|
||||||
|
G_TYPE_POINTER);
|
||||||
|
|
||||||
|
if (app->profile)
|
||||||
|
{
|
||||||
|
ProfileObject *object = get_current_object (app);
|
||||||
|
if (object)
|
||||||
|
{
|
||||||
|
app->callers = profile_list_callers (app->profile, object);
|
||||||
|
add_callers (list_store, app->profile, app->callers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_tree_view_set_model (
|
||||||
|
app->callers_view, GTK_TREE_MODEL (list_store));
|
||||||
|
|
||||||
|
g_object_unref (G_OBJECT (list_store));
|
||||||
|
|
||||||
|
if (!sort_state)
|
||||||
|
{
|
||||||
|
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
|
||||||
|
CALLERS_TOTAL,
|
||||||
|
GTK_SORT_DESCENDING);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
restore_sort_state (app->callers_view, sort_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtk_tree_view_columns_autosize (app->callers_view);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
fill_lists (Application *app)
|
||||||
|
{
|
||||||
|
fill_main_list (app);
|
||||||
|
fill_callers_list (app);
|
||||||
|
fill_descendants_tree (app);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ensure_profile (Application *app)
|
ensure_profile (Application *app)
|
||||||
{
|
{
|
||||||
@ -480,7 +668,7 @@ ensure_profile (Application *app)
|
|||||||
/* take care of reentrancy */
|
/* take care of reentrancy */
|
||||||
app->profile = profile_new (app->stash);
|
app->profile = profile_new (app->stash);
|
||||||
|
|
||||||
fill_main_list (app);
|
fill_lists (app);
|
||||||
|
|
||||||
app->state = DISPLAYING;
|
app->state = DISPLAYING;
|
||||||
|
|
||||||
@ -608,7 +796,7 @@ on_save_as_clicked (gpointer widget, gpointer data)
|
|||||||
|
|
||||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
@ -616,14 +804,14 @@ on_save_as_clicked (gpointer widget, gpointer data)
|
|||||||
gchar *filename;
|
gchar *filename;
|
||||||
|
|
||||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
|
|
||||||
if (g_file_test (filename, G_FILE_TEST_EXISTS) &&
|
if (g_file_test (filename, G_FILE_TEST_EXISTS) &&
|
||||||
!overwrite_file (GTK_WINDOW (app->main_window), filename))
|
!overwrite_file (GTK_WINDOW (app->main_window), filename))
|
||||||
{
|
{
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!profile_save (app->profile, filename, &err))
|
if (!profile_save (app->profile, filename, &err))
|
||||||
{
|
{
|
||||||
sorry (app->main_window, "Could not save %s: %s",
|
sorry (app->main_window, "Could not save %s: %s",
|
||||||
@ -632,7 +820,7 @@ on_save_as_clicked (gpointer widget, gpointer data)
|
|||||||
g_free (filename);
|
g_free (filename);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -654,7 +842,7 @@ on_open_clicked (gpointer widget, gpointer data)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||||
{
|
{
|
||||||
@ -663,16 +851,16 @@ on_open_clicked (gpointer widget, gpointer data)
|
|||||||
|
|
||||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||||
profile = profile_load (filename, &err);
|
profile = profile_load (filename, &err);
|
||||||
|
|
||||||
if (!profile)
|
if (!profile)
|
||||||
{
|
{
|
||||||
sorry (app->main_window, "Could not open %s: %s",
|
sorry (app->main_window, "Could not open %s: %s",
|
||||||
filename, err->message);
|
filename, err->message);
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -683,11 +871,13 @@ on_open_clicked (gpointer widget, gpointer data)
|
|||||||
delete_data (app);
|
delete_data (app);
|
||||||
|
|
||||||
app->state = DISPLAYING;
|
app->state = DISPLAYING;
|
||||||
|
|
||||||
|
app->n_samples = profile_get_size (profile);
|
||||||
|
|
||||||
app->profile = profile;
|
app->profile = profile;
|
||||||
app->profile_from_file = TRUE;
|
app->profile_from_file = TRUE;
|
||||||
|
|
||||||
fill_main_list (app);
|
fill_lists (app);
|
||||||
|
|
||||||
update_sensitivity (app);
|
update_sensitivity (app);
|
||||||
}
|
}
|
||||||
@ -699,186 +889,6 @@ on_delete (GtkWidget *window)
|
|||||||
gtk_main_quit ();
|
gtk_main_quit ();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
add_node (GtkTreeStore *store,
|
|
||||||
int size,
|
|
||||||
const GtkTreeIter *parent,
|
|
||||||
ProfileDescendant *node)
|
|
||||||
{
|
|
||||||
GtkTreeIter iter;
|
|
||||||
|
|
||||||
if (!node)
|
|
||||||
return;
|
|
||||||
|
|
||||||
gtk_tree_store_insert (store, &iter, (GtkTreeIter *)parent, 0);
|
|
||||||
|
|
||||||
gtk_tree_store_set (store, &iter,
|
|
||||||
DESCENDANTS_NAME, node->object->name,
|
|
||||||
DESCENDANTS_SELF, 100 * (node->self)/(double)size,
|
|
||||||
DESCENDANTS_NON_RECURSE, 100 * (node->non_recursion)/(double)size,
|
|
||||||
DESCENDANTS_TOTAL, 100 * (node->total)/(double)size,
|
|
||||||
DESCENDANTS_OBJECT, node->object,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
add_node (store, size, parent, node->siblings);
|
|
||||||
add_node (store, size, &iter, node->children);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ProfileObject *
|
|
||||||
get_current_object (Application *app)
|
|
||||||
{
|
|
||||||
GtkTreeSelection *selection;
|
|
||||||
GtkTreeModel *model;
|
|
||||||
GtkTreeIter selected;
|
|
||||||
ProfileObject *object;
|
|
||||||
|
|
||||||
selection = gtk_tree_view_get_selection (app->object_view);
|
|
||||||
|
|
||||||
if (gtk_tree_selection_get_selected (selection, &model, &selected))
|
|
||||||
{
|
|
||||||
gtk_tree_model_get (model, &selected,
|
|
||||||
OBJECT_OBJECT, &object,
|
|
||||||
-1);
|
|
||||||
return object;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
fill_descendants_tree (Application *app)
|
|
||||||
{
|
|
||||||
GtkTreeStore *tree_store;
|
|
||||||
gpointer sort_state;
|
|
||||||
|
|
||||||
sort_state = save_sort_state (app->descendants_view);
|
|
||||||
|
|
||||||
if (app->descendants)
|
|
||||||
{
|
|
||||||
profile_descendant_free (app->descendants);
|
|
||||||
app->descendants = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
tree_store =
|
|
||||||
gtk_tree_store_new (5,
|
|
||||||
G_TYPE_STRING,
|
|
||||||
G_TYPE_DOUBLE,
|
|
||||||
G_TYPE_DOUBLE,
|
|
||||||
G_TYPE_DOUBLE,
|
|
||||||
G_TYPE_POINTER);
|
|
||||||
|
|
||||||
if (app->profile)
|
|
||||||
{
|
|
||||||
ProfileObject *object = get_current_object (app);
|
|
||||||
if (object)
|
|
||||||
{
|
|
||||||
app->descendants =
|
|
||||||
profile_create_descendants (app->profile, object);
|
|
||||||
add_node (tree_store,
|
|
||||||
profile_get_size (app->profile), NULL, app->descendants);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_tree_view_set_model (
|
|
||||||
app->descendants_view, GTK_TREE_MODEL (tree_store));
|
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (tree_store));
|
|
||||||
|
|
||||||
if (!sort_state)
|
|
||||||
{
|
|
||||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (tree_store),
|
|
||||||
DESCENDANTS_NON_RECURSE,
|
|
||||||
GTK_SORT_DESCENDING);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
restore_sort_state (app->descendants_view, sort_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_tree_view_columns_autosize (app->descendants_view);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
add_callers (GtkListStore *list_store,
|
|
||||||
Profile *profile,
|
|
||||||
ProfileCaller *callers)
|
|
||||||
{
|
|
||||||
while (callers)
|
|
||||||
{
|
|
||||||
gchar *name;
|
|
||||||
GtkTreeIter iter;
|
|
||||||
double profile_size = profile_get_size (profile);
|
|
||||||
|
|
||||||
if (callers->object)
|
|
||||||
name = callers->object->name;
|
|
||||||
else
|
|
||||||
name = "<spontaneous>";
|
|
||||||
|
|
||||||
gtk_list_store_append (list_store, &iter);
|
|
||||||
gtk_list_store_set (
|
|
||||||
list_store, &iter,
|
|
||||||
CALLERS_NAME, name,
|
|
||||||
CALLERS_SELF, 100.0 * callers->self / profile_size,
|
|
||||||
CALLERS_TOTAL, 100.0 * callers->total / profile_size,
|
|
||||||
CALLERS_OBJECT, callers->object,
|
|
||||||
-1);
|
|
||||||
|
|
||||||
callers = callers->next;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
fill_callers_list (Application *app)
|
|
||||||
{
|
|
||||||
GtkListStore *list_store;
|
|
||||||
gpointer sort_state;
|
|
||||||
|
|
||||||
sort_state = save_sort_state (app->descendants_view);
|
|
||||||
|
|
||||||
if (app->callers)
|
|
||||||
{
|
|
||||||
profile_caller_free (app->callers);
|
|
||||||
app->callers = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
list_store =
|
|
||||||
gtk_list_store_new (4,
|
|
||||||
G_TYPE_STRING,
|
|
||||||
G_TYPE_DOUBLE,
|
|
||||||
G_TYPE_DOUBLE,
|
|
||||||
G_TYPE_POINTER);
|
|
||||||
|
|
||||||
if (app->profile)
|
|
||||||
{
|
|
||||||
ProfileObject *object = get_current_object (app);
|
|
||||||
if (object)
|
|
||||||
{
|
|
||||||
app->callers = profile_list_callers (app->profile, object);
|
|
||||||
add_callers (list_store, app->profile, app->callers);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_tree_view_set_model (
|
|
||||||
app->callers_view, GTK_TREE_MODEL (list_store));
|
|
||||||
|
|
||||||
g_object_unref (G_OBJECT (list_store));
|
|
||||||
|
|
||||||
if (!sort_state)
|
|
||||||
{
|
|
||||||
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (list_store),
|
|
||||||
CALLERS_TOTAL,
|
|
||||||
GTK_SORT_DESCENDING);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
restore_sort_state (app->callers_view, sort_state);
|
|
||||||
}
|
|
||||||
|
|
||||||
gtk_tree_view_columns_autosize (app->callers_view);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
on_object_selection_changed (GtkTreeSelection *selection, gpointer data)
|
on_object_selection_changed (GtkTreeSelection *selection, gpointer data)
|
||||||
{
|
{
|
||||||
@ -1001,6 +1011,21 @@ set_sizes (GtkWindow *window,
|
|||||||
gtk_paned_set_position (GTK_PANED (hpaned), width / 2);
|
gtk_paned_set_position (GTK_PANED (hpaned), width / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_shadows (GladeXML *xml)
|
||||||
|
{
|
||||||
|
/* Get rid of motif out-bevels */
|
||||||
|
gtk_rc_parse_string (
|
||||||
|
"style \"blah\" "
|
||||||
|
"{ "
|
||||||
|
" GtkToolbar::shadow_type = none "
|
||||||
|
" GtkMenuBar::shadow_type = none "
|
||||||
|
"} "
|
||||||
|
"widget \"*toolbar\" style : rc \"blah\"\n"
|
||||||
|
"widget \"*menubar\" style : rc \"blah\"\n"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
build_gui (Application *app)
|
build_gui (Application *app)
|
||||||
{
|
{
|
||||||
@ -1008,6 +1033,8 @@ build_gui (Application *app)
|
|||||||
GtkTreeSelection *selection;
|
GtkTreeSelection *selection;
|
||||||
GtkTreeViewColumn *col;
|
GtkTreeViewColumn *col;
|
||||||
|
|
||||||
|
set_shadows (xml);
|
||||||
|
|
||||||
xml = glade_xml_new ("./sysprof.glade", NULL, NULL);
|
xml = glade_xml_new ("./sysprof.glade", NULL, NULL);
|
||||||
|
|
||||||
/* Main Window */
|
/* Main Window */
|
||||||
@ -1015,7 +1042,7 @@ build_gui (Application *app)
|
|||||||
|
|
||||||
g_signal_connect (G_OBJECT (app->main_window), "delete_event",
|
g_signal_connect (G_OBJECT (app->main_window), "delete_event",
|
||||||
G_CALLBACK (on_delete), NULL);
|
G_CALLBACK (on_delete), NULL);
|
||||||
|
|
||||||
/* Menu items */
|
/* Menu items */
|
||||||
app->start_item = glade_xml_get_widget (xml, "start_item");
|
app->start_item = glade_xml_get_widget (xml, "start_item");
|
||||||
app->profile_item = glade_xml_get_widget (xml, "profile_item");
|
app->profile_item = glade_xml_get_widget (xml, "profile_item");
|
||||||
@ -1103,13 +1130,13 @@ build_gui (Application *app)
|
|||||||
add_double_format_column (app->descendants_view, _("Cumulative"), DESCENDANTS_NON_RECURSE, "%.2f");
|
add_double_format_column (app->descendants_view, _("Cumulative"), DESCENDANTS_NON_RECURSE, "%.2f");
|
||||||
g_signal_connect (app->descendants_view, "row-activated",
|
g_signal_connect (app->descendants_view, "row-activated",
|
||||||
G_CALLBACK (on_descendants_row_activated), app);
|
G_CALLBACK (on_descendants_row_activated), app);
|
||||||
|
|
||||||
gtk_tree_view_column_set_expand (col, TRUE);
|
gtk_tree_view_column_set_expand (col, TRUE);
|
||||||
|
|
||||||
gtk_widget_grab_focus (GTK_WIDGET (app->object_view));
|
gtk_widget_grab_focus (GTK_WIDGET (app->object_view));
|
||||||
gtk_widget_show_all (app->main_window);
|
gtk_widget_show_all (app->main_window);
|
||||||
gtk_widget_hide (app->dummy_button);
|
gtk_widget_hide (app->dummy_button);
|
||||||
|
|
||||||
/* Statusbar */
|
/* Statusbar */
|
||||||
queue_show_samples (app);
|
queue_show_samples (app);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,7 +25,7 @@
|
|||||||
<property name="spacing">0</property>
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkMenuBar" id="menubar1">
|
<widget class="GtkMenuBar" id="menubar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
@ -205,6 +205,17 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHSeparator" id="hseparator1">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="padding">2</property>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">True</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="hbox1">
|
<widget class="GtkHBox" id="hbox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
@ -212,7 +223,7 @@
|
|||||||
<property name="spacing">0</property>
|
<property name="spacing">0</property>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolbar" id="toolbar1">
|
<widget class="GtkToolbar" id="toolbar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
|
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
|
||||||
<property name="tooltips">True</property>
|
<property name="tooltips">True</property>
|
||||||
@ -330,7 +341,7 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkToolbar" id="toolbar2">
|
<widget class="GtkToolbar" id="samples-toolbar">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
|
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
|
||||||
<property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</property>
|
<property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user