diff --git a/ChangeLog b/ChangeLog index db129493..f72ae083 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Tue Dec 20 16:03:29 2005 Soeren Sandmann + + * TODO: Updates + + * sysprof-text.c (main): Make it try and load the module before + complaining. + 2005-12-20 Kristian Høgsberg * Makefile.am: Dist and install udev rule. diff --git a/TODO b/TODO index 4e82aaa6..6e311b6e 100644 --- a/TODO +++ b/TODO @@ -52,7 +52,6 @@ Before 1.2: recursive profiles. Hypothesis: seen_nodes can grow large, and the algorithm is O(n^2) in the length of the trace. - - make the things we put in a stackstash real objects so that - we can save them @@ -100,9 +99,12 @@ Before 1.2: * Make provisions for forward compatibility: maybe it should be possible to load records with more fields than specified. -* Figure out how to make sfile.[ch] use less memory. + * Figure out how to make sfile.[ch] use less memory. + - In general clean sfile.[ch] up a little: + - split out dfa in its own generic class + - make a generic representation of xml files with quarks for strings: struct item { int begin/end/text; @@ -111,12 +113,12 @@ Before 1.2: } perhaps even with iterators. Should be compact and suitable for both input and output.. - - make the api a little saner; add format/content structs - - + + - make the api saner; add format/content structs * See if the auto-expanding can be made more intelligent - "Everything" should be expanded exactly one level - - all nodes should be expanded at least one level + - all trees should be expanded at least one level * Send entire stack to user space, then do stackwalking there. That would allow us to do more complex algorithms, like dwarf, in userspace. Though diff --git a/collector.c b/collector.c index 0c21af67..96e0b3eb 100644 --- a/collector.c +++ b/collector.c @@ -176,9 +176,28 @@ open_fd (Collector *collector, fd = open (SYSPROF_FILE, O_RDONLY); if (fd < 0) { - load_module(); - - fd = open (SYSPROF_FILE, O_RDONLY); + if (load_module()) + { + GTimer *timer = g_timer_new (); + + while (fd < 0 && g_timer_elapsed (timer, NULL) < 0.5) + { + usleep (100000); + + g_print ("open\n"); + + fd = open (SYSPROF_FILE, O_RDONLY); + } + + g_timer_destroy (timer); + + if (fd < 0) + { + /* FIXME: set "module is loaded but no file error" */ + } + } + + /* Wait for udev to discover the new device */ if (fd < 0) { diff --git a/sysprof-text.c b/sysprof-text.c index b5586e96..8e46d208 100644 --- a/sysprof-text.c +++ b/sysprof-text.c @@ -75,13 +75,13 @@ no_module (void) { perror (SYSPROF_FILE); fprintf (stderr, - "\n" - "Can't open " SYSPROF_FILE ". You need to insert " - "the sysprof kernel module. Run\n" - "\n" - " modprobe sysprof-module\n" - "\n" - "as root.\n"); + "\n" + "Can't open " SYSPROF_FILE ". You need to insert " + "the sysprof kernel module. Run\n" + "\n" + " modprobe sysprof-module\n" + "\n" + "as root.\n"); } static void @@ -92,7 +92,7 @@ usage (const char *name) "Usage: \n" " %s \n" "\n" - "On SIGTERM or SIGINT (Ctrl-C) write the profile to \n" + "On SIGTERM or SIGINT (Ctrl-C) the profile will be written to \n" "\n", name); } @@ -103,38 +103,33 @@ main (int argc, { gboolean quit; Application *app = g_new0 (Application, 1); - int fd; - fd = open (SYSPROF_FILE, O_RDONLY); + app->collector = collector_new (NULL, NULL); + app->outfile = g_strdup (argv[1]); + app->main_loop = g_main_loop_new (NULL, 0); + /* FIXME: get the real error */ quit = FALSE; - if (fd < 0) + if (!collector_start (app->collector, NULL)) { - no_module (); + no_module(); quit = TRUE; } - + if (argc < 2) { usage (argv[0]); quit = TRUE; } - + if (quit) return -1; - - app->collector = collector_new (NULL, NULL); - app->outfile = g_strdup (argv[1]); - app->main_loop = g_main_loop_new (NULL, 0); - + /* FIXME: check the errors */ signal_set_handler (SIGTERM, signal_handler, app, NULL); signal_set_handler (SIGINT, signal_handler, app, NULL); - /* FIXME: check the error */ - collector_start (app->collector, NULL); - g_main_loop_run (app->main_loop); signal_unset_handler (SIGTERM);