mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
*** empty log message ***
This commit is contained in:
4
TODO
4
TODO
@ -6,10 +6,12 @@
|
|||||||
|
|
||||||
- loading and saving
|
- 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
|
Could be used for profiling startup etc. Should be able to dump the
|
||||||
data to a network socket.
|
data to a network socket.
|
||||||
|
|
||||||
|
- Port to GtkAction
|
||||||
|
|
||||||
DONE:
|
DONE:
|
||||||
|
|
||||||
- consider making ProfileObject more of an object.
|
- consider making ProfileObject more of an object.
|
||||||
|
|||||||
94
sysprof.c
94
sysprof.c
@ -66,6 +66,41 @@ disaster (const char *what)
|
|||||||
exit (1);
|
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
|
static void
|
||||||
update_sensitivity (Application *app)
|
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->object_view), sensitive_tree_views);
|
||||||
gtk_widget_set_sensitive (GTK_WIDGET (app->callers_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);
|
gtk_widget_set_sensitive (GTK_WIDGET (app->descendants_view), sensitive_tree_views);
|
||||||
|
|
||||||
|
queue_show_samples (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
@ -133,30 +170,6 @@ get_name (pid_t pid)
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
static void
|
||||||
on_read (gpointer data)
|
on_read (gpointer data)
|
||||||
{
|
{
|
||||||
@ -198,7 +211,6 @@ on_read (gpointer data)
|
|||||||
(gulong *)trace.addresses, trace.n_addresses, 1);
|
(gulong *)trace.addresses, trace.n_addresses, 1);
|
||||||
|
|
||||||
app->n_samples++;
|
app->n_samples++;
|
||||||
show_samples (app);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update_sensitivity (app);
|
update_sensitivity (app);
|
||||||
@ -222,7 +234,7 @@ delete_data (Application *app)
|
|||||||
app->stash = stack_stash_new ();
|
app->stash = stack_stash_new ();
|
||||||
process_flush_caches ();
|
process_flush_caches ();
|
||||||
app->n_samples = 0;
|
app->n_samples = 0;
|
||||||
show_samples (app);
|
queue_show_samples (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -351,24 +363,24 @@ sorry (GtkWidget *parent_window,
|
|||||||
const gchar *format,
|
const gchar *format,
|
||||||
...)
|
...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char *message;
|
char *message;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
g_vasprintf (&message, format, args);
|
g_vasprintf (&message, format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
dialog = gtk_message_dialog_new (parent_window ? GTK_WINDOW (parent_window) : NULL,
|
dialog = gtk_message_dialog_new (parent_window ? GTK_WINDOW (parent_window) : NULL,
|
||||||
GTK_DIALOG_DESTROY_WITH_PARENT,
|
GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||||
GTK_MESSAGE_WARNING,
|
GTK_MESSAGE_WARNING,
|
||||||
GTK_BUTTONS_OK, message);
|
GTK_BUTTONS_OK, message);
|
||||||
free (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_dialog_run (GTK_DIALOG (dialog));
|
||||||
gtk_widget_destroy (dialog);
|
gtk_widget_destroy (dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -812,7 +824,7 @@ build_gui (Application *app)
|
|||||||
|
|
||||||
/* Statusbar */
|
/* Statusbar */
|
||||||
app->statusbar = (GtkStatusbar *)glade_xml_get_widget (xml, "statusbar");
|
app->statusbar = (GtkStatusbar *)glade_xml_get_widget (xml, "statusbar");
|
||||||
show_samples (app);
|
queue_show_samples (app);
|
||||||
}
|
}
|
||||||
|
|
||||||
static Application *
|
static Application *
|
||||||
|
|||||||
Reference in New Issue
Block a user