All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: [PATCH] add a counter in grub_dprintf
Date: Thu, 19 Jun 2008 15:31:47 +0200	[thread overview]
Message-ID: <20080619133147.GA5018@thorin> (raw)

[-- 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);

             reply	other threads:[~2008-06-19 13:32 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-19 13:31 Robert Millan [this message]
2008-06-19 18:42 ` [PATCH] add a counter in grub_dprintf 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080619133147.GA5018@thorin \
    --to=rmh@aybabtu.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.