From dc51fea3b4e70c7da059b0e2252e50fde0ea33e1 Mon Sep 17 00:00:00 2001 From: Soeren Sandmann Date: Fri, 24 Feb 2006 07:10:42 +0000 Subject: [PATCH] Clear screenshot window when start is toggled. Fri Feb 24 02:09:33 2006 Soeren Sandmann * sysprof.c (on_start_toggled): Clear screenshot window when start is toggled. * TODO: Add some notes about stack handling on the x86 --- TODO | 21 +++++++++++++++++++++ sysprof.c | 38 +++++++++++++++++++++----------------- 2 files changed, 42 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index f768adbb..1646e36d 100644 --- a/TODO +++ b/TODO @@ -268,6 +268,27 @@ http://www.linuxbase.org/spec/booksets/LSB-Embedded/LSB-Embedded/ehframe.html - somehow get access to VSEnterprise profiler and see how it works. somehow get access to vtune and see how it works. +* Some notes about timer interrupt handling in Linux + +On an SMP system APIC is used - the interesting file is arch/i386/kernel/apic.c + +On UP systems, the normal IRQ0 is used +When the interrupt happens, + entry.S + calls do_IRQ, which sets up the special interrupt stack, + and calls __do_IRQ, which is in /kernel/irq/handle.c. + This calls the corresponding irqaction, which has previously + been setup by arch/i386/mach-default/setup.c to point to + timer_interrupt, which is in arch/i386/kernel/time.c. + This calls do_timer_interrupt_hooks() which is defined in + /include/asm-i386/mach-default/do_timer.h. This function + then calls profile_tick(). + + Note when the CPU switches from user mode to kernel mode, it + pushes SS/ESP on top of the kernel stack, but when it switches + from kernel mode to kernel mode, it does _not_ push SS/ESP. + It does in both cases push EIP though. + Later: - See if it is possible to group the X server activity under the process that diff --git a/sysprof.c b/sysprof.c index 495c7902..2d1bfc91 100644 --- a/sysprof.c +++ b/sysprof.c @@ -105,6 +105,8 @@ struct Application */ }; +static void update_screenshot_window (Application *app); + static gboolean show_samples_timeout (gpointer data) { @@ -361,7 +363,7 @@ static void on_start_toggled (GtkWidget *widget, gpointer data) { Application *app = data; - + if (!gtk_toggle_tool_button_get_active ( GTK_TOGGLE_TOOL_BUTTON (app->start_button))) { @@ -385,7 +387,8 @@ on_start_toggled (GtkWidget *widget, gpointer data) "\n" "as root."); } - + + update_screenshot_window (app); update_sensitivity (app); } @@ -1085,6 +1088,17 @@ typedef struct GString *text; } AddTextInfo; +static void +set_monospace (GtkWidget *widget) +{ + PangoFontDescription *desc = + pango_font_description_from_string ("monospace"); + + gtk_widget_modify_font (widget, desc); + + pango_font_description_free (desc); +} + static void add_text (GtkTreeView *view, GtkTreePath *path, @@ -1108,21 +1122,13 @@ add_text (GtkTreeView *view, g_string_append_printf (info->text, "%-*s %6.2f %6.2f\n", info->max_width - indent, name, self, cumulative); } -static void -set_monospace (GtkWidget *widget) -{ - PangoFontDescription *desc = - pango_font_description_from_string ("monospace"); - - gtk_widget_modify_font (widget, desc); - - pango_font_description_free (desc); -} - static void update_screenshot_window (Application *app) { - /* FIXME: clear the text buffer here */ + GtkTextBuffer *text_buffer = + gtk_text_view_get_buffer (GTK_TEXT_VIEW (app->screenshot_textview)); + + gtk_text_buffer_set_text (text_buffer, "", -1); if (app->descendants) { @@ -1139,9 +1145,7 @@ update_screenshot_window (Application *app) add_text, &info); - gtk_text_buffer_set_text ( - gtk_text_view_get_buffer (GTK_TEXT_VIEW (app->screenshot_textview)), - info.text->str, -1); + gtk_text_buffer_set_text (text_buffer, info.text->str, -1); set_monospace (app->screenshot_textview);