mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
Primitive loading and saving.
Wed Mar 23 00:04:07 2005 Soeren Sandmann <sandmann@redhat.com> Primitive loading and saving. * sysprof.c (on_open_clicked): Hook up loading. * sfile.c: Add a copy of g_file_replace() from glib CVS HEAD. * sfile.c (add_string): Escape and quote the string * sfile.c (sfile_load): Initialize current_instruction and instructions_by_location * sfile.c (post_process_instructions_recurse): Handle NULL pointers properly. * sfile.c (handle_begin_element, handle_end_element, handle_text): Move error handling here from state_transition_begin/text/end. * sfile.c (handle_text): Discard whitespace-only strings * sfile.c (sfile_get_pointer, sfile_get_integer, sfile_get_string): expect both begin, value, and end transitions. * sfile.c (hook_up_pointers): Only treat instructions as pointer values when they are. Handle NULL targets properly. * sfile.c (get_number): Fix a few read-freed-data bugs * profile.c (profile_load): Call sfile_end_get() for the profile; build the nodes_by_objects hash table. Build the call tree. * profile.c (create_format): Don't store next pointer, but do store total, self and toplevel. * profile.c (make_hash_table): New function to build nodes_by_object hashtable from loaded data
This commit is contained in:
committed by
Søren Sandmann Pedersen
parent
64a1ac6355
commit
2af6447238
42
sysprof.c
42
sysprof.c
@ -56,6 +56,22 @@ struct Application
|
||||
|
||||
int timeout_id;
|
||||
int generating_profile;
|
||||
|
||||
gboolean profile_from_file; /* FIXME: This is a kludge. Figure out how
|
||||
* to maintain the application model properly
|
||||
*
|
||||
* The fundamental issue is that the state of
|
||||
* widgets is controlled by two different
|
||||
* entities:
|
||||
*
|
||||
* The user clicks on them, changing their
|
||||
* state.
|
||||
*
|
||||
* The application model changes, changing their
|
||||
* state.
|
||||
*
|
||||
* Model/View/Controller is a possibility.
|
||||
*/
|
||||
};
|
||||
|
||||
static void
|
||||
@ -290,6 +306,7 @@ delete_data (Application *app)
|
||||
process_flush_caches ();
|
||||
app->n_samples = 0;
|
||||
queue_show_samples (app);
|
||||
app->profile_from_file = FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -349,6 +366,7 @@ fill_main_list (Application *app)
|
||||
G_TYPE_POINTER);
|
||||
|
||||
objects = profile_get_objects (profile);
|
||||
g_print ("got %d objects\n", g_list_length (objects));
|
||||
for (list = objects; list != NULL; list = list->next)
|
||||
{
|
||||
ProfileObject *object = list->data;
|
||||
@ -414,12 +432,12 @@ on_profile_toggled (gpointer widget, gpointer data)
|
||||
|
||||
if (gtk_toggle_tool_button_get_active (widget))
|
||||
{
|
||||
if (app->profile)
|
||||
if (app->profile && !app->profile_from_file)
|
||||
{
|
||||
profile_free (app->profile);
|
||||
app->profile = NULL;
|
||||
}
|
||||
|
||||
|
||||
ensure_profile (app);
|
||||
}
|
||||
}
|
||||
@ -486,7 +504,27 @@ on_save_as_clicked (gpointer widget, gpointer data)
|
||||
static void
|
||||
on_open_clicked (gpointer widget, gpointer data)
|
||||
{
|
||||
#if 0
|
||||
sorry (NULL, "Open is not implemented yet. (Fortunately, neither is saving),");
|
||||
#endif
|
||||
Application *app = data;
|
||||
GError *err = NULL;
|
||||
Profile *profile = profile_load ("name.profile", &err);
|
||||
if (!profile)
|
||||
sorry (NULL, "Could not open: %s\n", err->message);
|
||||
else
|
||||
{
|
||||
delete_data (app);
|
||||
|
||||
app->state = DISPLAYING;
|
||||
|
||||
app->profile = profile;
|
||||
app->profile_from_file = TRUE;
|
||||
|
||||
fill_main_list (app);
|
||||
|
||||
update_sensitivity (app);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user