All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add a counter in grub_dprintf
@ 2008-06-19 13:31 Robert Millan
  2008-06-19 18:42 ` Isaac Dupree
  2008-07-03 18:08 ` Marco Gerards
  0 siblings, 2 replies; 17+ messages in thread
From: Robert Millan @ 2008-06-19 13:31 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]


How about adding a counter to grub_dprintf to make it easy to instrument
GRUB and find which are the bottlenecks in boot time?

Sidenote: perhaps it'd be a good idea to conditionalize all grub_dprintf
calls with #ifdef DEBUG to obtain a smaller core.img.  It's not hard to
ask a user to rebuild if dprintf is needed, and we can find non-ugly ways
to do this without massive #ifdefs all over the code.

-- 
Robert Millan

<GPLv2> I know my rights; I want my phone call!
<DRM> What good is a phone call… if you are unable to speak?
(as seen on /.)

[-- Attachment #2: counter.diff --]
[-- Type: text/x-diff, Size: 1737 bytes --]

diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/include/grub/time.h ./include/grub/time.h
--- ../grub2/include/grub/time.h	2007-10-22 22:02:16.000000000 +0200
+++ ./include/grub/time.h	2008-06-19 15:23:45.000000000 +0200
@@ -23,6 +23,8 @@
 #include <grub/machine/time.h>
 #include <grub/cpu/time.h>
 
+extern grub_uint32_t grub_start_time;
+
 void EXPORT_FUNC(grub_millisleep) (grub_uint32_t ms);
 void EXPORT_FUNC(grub_millisleep_generic) (grub_uint32_t ms);
 
diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/main.c ./kern/main.c
--- ../grub2/kern/main.c	2008-02-10 18:05:10.000000000 +0100
+++ ./kern/main.c	2008-06-19 15:19:45.000000000 +0200
@@ -106,12 +106,15 @@ grub_load_normal_mode (void)
   grub_print_error ();
 }
 
+grub_uint32_t grub_start_time;
+
 /* The main routine.  */
 void
 grub_main (void)
 {
   /* First of all, initialize the machine.  */
   grub_machine_init ();
+  grub_start_time = grub_get_rtc ();
 
   /* Hello.  */
   grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
diff -x ChangeLog -x configure -x config.h.in -x CVS -x '*~' -x '*.mk' -urp ../grub2/kern/misc.c ./kern/misc.c
--- ../grub2/kern/misc.c	2008-06-16 22:11:22.000000000 +0200
+++ ./kern/misc.c	2008-06-19 15:26:40.000000000 +0200
@@ -147,7 +147,15 @@ grub_real_dprintf (const char *file, con
   
   if (grub_strword (debug, "all") || grub_strword (debug, condition))
     {
-      grub_printf ("%s:%d: ", file, line);
+      grub_printf (
+#ifndef GRUB_UTIL
+		   "[%u] "
+#endif
+		   "%s:%d: ",
+#ifndef GRUB_UTIL
+		   grub_get_rtc () - grub_start_time,
+#endif
+		   file, line);
       va_start (args, fmt);
       grub_vprintf (fmt, args);
       va_end (args);

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2008-07-03 17:59 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-19 13:31 [PATCH] add a counter in grub_dprintf Robert Millan
2008-06-19 18:42 ` Isaac Dupree
2008-06-21 14:19   ` Robert Millan
2008-06-21 14:35     ` Javier Martín
2008-06-21 14:51       ` Bram Diederik
2008-06-22 11:30       ` Isaac Dupree
2008-06-26 14:08       ` Robert Millan
2008-06-26 15:20         ` Javier Martín
2008-06-29 11:22           ` Robert Millan
2008-06-30 17:13             ` Pavel Roskin
2008-06-30 17:33               ` Vesa Jääskeläinen
2008-07-01 15:59                 ` Robert Millan
2008-07-01 15:59               ` Robert Millan
2008-07-01 16:01                 ` Pavel Roskin
2008-07-01 17:19                   ` Robert Millan
2008-07-02  0:13                     ` Pavel Roskin
2008-07-03 18:08 ` Marco Gerards

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.