From cf761a2a7095eec43b0be515cb24ef218df6fc20 Mon Sep 17 00:00:00 2001 From: Soren Sandmann Date: Sat, 5 Nov 2005 04:58:16 +0000 Subject: [PATCH] Add copyright statement. 2005-11-04 Soren Sandmann * collector.[ch]: Add copyright statement. * collector.c (on_read): Handle time getting set backwards. * collector.c: Remove unused empty_filedescriptor() function. --- ChangeLog | 8 +++++++ collector.c | 48 ++++++++++++++++++++--------------------- collector.h | 19 ++++++++++++++++ module/sysprof-module.c | 2 +- process.c | 2 +- sysprof.c | 10 +++++---- 6 files changed, 58 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 51ac69e5..2cdf9367 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2005-11-04 Soren Sandmann + + * collector.[ch]: Add copyright statement. + + * collector.c (on_read): Handle time getting set backwards. + + * collector.c: Remove unused empty_filedescriptor() function. + 2005-11-03 Soren Sandmann * configure.ac: Make the message about the kernel source package diff --git a/collector.c b/collector.c index 8e892826..4b376c9b 100644 --- a/collector.c +++ b/collector.c @@ -1,3 +1,22 @@ +/* Sysprof -- Sampling, systemwide CPU profiler + * Copyright 2004, Red Hat, Inc. + * Copyright 2004, 2005, Soeren Sandmann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #include "stackstash.h" #include "collector.h" #include "module/sysprof-module.h" @@ -89,6 +108,7 @@ on_read (gpointer data) Collector *collector = data; GTimeVal now; int rd; + double diff; rd = read (collector->fd, &trace, sizeof (trace)); @@ -100,8 +120,9 @@ on_read (gpointer data) /* After a reset we ignore samples for a short period so that * a reset will actually cause 'samples' to become 0 */ - /* FIXME: handle time getting set back */ - if (time_diff (&now, &collector->latest_reset) < RESET_DEAD_PERIOD) + diff = time_diff (&now, &collector->latest_reset); + + if (diff >= 0.0 && diff < RESET_DEAD_PERIOD) return; #if 0 @@ -160,16 +181,6 @@ open_fd (Collector *collector, if (fd < 0) { /* FIXME: set error */ -#if 0 - sorry (app->main_window, - "Can't open /proc/sysprof-trace. You need to insert\n" - "the sysprof kernel module. Run\n" - "\n" - " modprobe sysprof-module\n" - "\n" - "as root."); -#endif - return FALSE; } } @@ -180,19 +191,6 @@ open_fd (Collector *collector, return TRUE; } -static void -empty_file_descriptor (Collector *collector) -{ - int rd; - SysprofStackTrace trace; - - do - { - rd = read (collector->fd, &trace, sizeof (trace)); - - } while (rd != -1); /* until EWOULDBLOCK */ -} - gboolean collector_start (Collector *collector, GError **err) diff --git a/collector.h b/collector.h index 6379b10b..7a5c1a8b 100644 --- a/collector.h +++ b/collector.h @@ -1,3 +1,22 @@ +/* Sysprof -- Sampling, systemwide CPU profiler + * Copyright 2004, Red Hat, Inc. + * Copyright 2004, 2005, Soeren Sandmann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + #include "profile.h" typedef struct Collector Collector; diff --git a/module/sysprof-module.c b/module/sysprof-module.c index 24529fb1..c682eed1 100644 --- a/module/sysprof-module.c +++ b/module/sysprof-module.c @@ -251,7 +251,7 @@ static int timer_notify (struct pt_regs *regs) i = 0; if (!is_user) { - trace->addresses[i++] = 0x01; + trace->addresses[i++] = (void *)0x01; regs = (void *)current->thread.esp0 - sizeof (struct pt_regs); } diff --git a/process.c b/process.c index 391c292e..0ac4a3f8 100644 --- a/process.c +++ b/process.c @@ -149,7 +149,7 @@ create_process (const char *cmdline, int pid) p->maps = NULL; p->pid = pid; p->undefined.name = NULL; - p->undefined.address = NULL; + p->undefined.address = 0x00; g_assert (!g_hash_table_lookup (processes_by_pid, GINT_TO_POINTER (pid))); g_assert (!g_hash_table_lookup (processes_by_cmdline, cmdline)); diff --git a/sysprof.c b/sysprof.c index 7a8fc884..1bee13ca 100644 --- a/sysprof.c +++ b/sysprof.c @@ -231,7 +231,8 @@ update_sensitivity (Application *app) } static void -set_busy (GtkWidget *widget, gboolean busy) +set_busy (GtkWidget *widget, + gboolean busy) { GdkCursor *cursor; @@ -547,8 +548,8 @@ fill_descendants_tree (Application *app) } static void -add_callers (GtkListStore *list_store, - Profile *profile, +add_callers (GtkListStore *list_store, + Profile *profile, ProfileCaller *callers) { while (callers) @@ -1339,7 +1340,8 @@ load_file (gpointer data) } int -main (int argc, char **argv) +main (int argc, + char **argv) { Application *app;