mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-03-22 21:21:26 +00:00
*** empty log message ***
This commit is contained in:
4
TODO
4
TODO
@ -6,10 +6,12 @@
|
||||
|
||||
- loading and saving
|
||||
|
||||
- Non-GUI version that can save in a format the GUI could understand.
|
||||
- Non-GUI version that can save in a format the GUI can understand.
|
||||
Could be used for profiling startup etc. Should be able to dump the
|
||||
data to a network socket.
|
||||
|
||||
- Port to GtkAction
|
||||
|
||||
DONE:
|
||||
|
||||
- consider making ProfileObject more of an object.
|
||||
|
||||
94
sysprof.c
94
sysprof.c
@ -66,6 +66,41 @@ disaster (const char *what)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
show_samples_timeout (gpointer data)
|
||||
{
|
||||
Application *app = data;
|
||||
char *label;
|
||||
|
||||
switch (app->state)
|
||||
{
|
||||
case INITIAL:
|
||||
label = g_strdup ("");
|
||||
break;
|
||||
|
||||
case PROFILING:
|
||||
case DISPLAYING:
|
||||
label = g_strdup_printf ("Samples: %d", app->n_samples);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_statusbar_pop (app->statusbar, 0);
|
||||
gtk_statusbar_push (app->statusbar, 0, label);
|
||||
|
||||
g_free (label);
|
||||
|
||||
app->timeout_id = 0;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
queue_show_samples (Application *app)
|
||||
{
|
||||
if (!app->timeout_id)
|
||||
app->timeout_id = g_timeout_add (225, show_samples_timeout, app);
|
||||
}
|
||||
|
||||
static void
|
||||
update_sensitivity (Application *app)
|
||||
{
|
||||
@ -117,6 +152,8 @@ update_sensitivity (Application *app)
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (app->object_view), sensitive_tree_views);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (app->callers_view), sensitive_tree_views);
|
||||
gtk_widget_set_sensitive (GTK_WIDGET (app->descendants_view), sensitive_tree_views);
|
||||
|
||||
queue_show_samples (app);
|
||||
}
|
||||
|
||||
#if 0
|
||||
@ -133,30 +170,6 @@ get_name (pid_t pid)
|
||||
}
|
||||
#endif
|
||||
|
||||
static gboolean
|
||||
really_show_samples (gpointer data)
|
||||
{
|
||||
Application *app = data;
|
||||
char *label;
|
||||
|
||||
label = g_strdup_printf ("Samples: %d", app->n_samples);
|
||||
|
||||
gtk_statusbar_pop (app->statusbar, 0);
|
||||
gtk_statusbar_push (app->statusbar, 0, label);
|
||||
|
||||
g_free (label);
|
||||
|
||||
app->timeout_id = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
show_samples (Application *app)
|
||||
{
|
||||
if (!app->timeout_id)
|
||||
app->timeout_id = g_timeout_add (300, really_show_samples, app);
|
||||
}
|
||||
|
||||
static void
|
||||
on_read (gpointer data)
|
||||
{
|
||||
@ -198,7 +211,6 @@ on_read (gpointer data)
|
||||
(gulong *)trace.addresses, trace.n_addresses, 1);
|
||||
|
||||
app->n_samples++;
|
||||
show_samples (app);
|
||||
}
|
||||
|
||||
update_sensitivity (app);
|
||||
@ -222,7 +234,7 @@ delete_data (Application *app)
|
||||
app->stash = stack_stash_new ();
|
||||
process_flush_caches ();
|
||||
app->n_samples = 0;
|
||||
show_samples (app);
|
||||
queue_show_samples (app);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -351,24 +363,24 @@ sorry (GtkWidget *parent_window,
|
||||
const gchar *format,
|
||||
...)
|
||||
{
|
||||
va_list args;
|
||||
char *message;
|
||||
GtkWidget *dialog;
|
||||
va_list args;
|
||||
char *message;
|
||||
GtkWidget *dialog;
|
||||
|
||||
va_start (args, format);
|
||||
g_vasprintf (&message, format, args);
|
||||
va_end (args);
|
||||
va_start (args, format);
|
||||
g_vasprintf (&message, format, args);
|
||||
va_end (args);
|
||||
|
||||
dialog = gtk_message_dialog_new (parent_window ? GTK_WINDOW (parent_window) : NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_OK, message);
|
||||
free (message);
|
||||
dialog = gtk_message_dialog_new (parent_window ? GTK_WINDOW (parent_window) : NULL,
|
||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_WARNING,
|
||||
GTK_BUTTONS_OK, message);
|
||||
free (message);
|
||||
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), "System Profiler Warning");
|
||||
gtk_window_set_title (GTK_WINDOW (dialog), "System Profiler Warning");
|
||||
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -812,7 +824,7 @@ build_gui (Application *app)
|
||||
|
||||
/* Statusbar */
|
||||
app->statusbar = (GtkStatusbar *)glade_xml_get_widget (xml, "statusbar");
|
||||
show_samples (app);
|
||||
queue_show_samples (app);
|
||||
}
|
||||
|
||||
static Application *
|
||||
|
||||
Reference in New Issue
Block a user