From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1K9KFT-0006In-9N for mharc-grub-devel@gnu.org; Thu, 19 Jun 2008 09:32:23 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K9KFR-0006HY-3E for grub-devel@gnu.org; Thu, 19 Jun 2008 09:32:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K9KFO-0006GZ-P6 for grub-devel@gnu.org; Thu, 19 Jun 2008 09:32:19 -0400 Received: from [199.232.76.173] (port=49010 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K9KFO-0006GG-Ev for grub-devel@gnu.org; Thu, 19 Jun 2008 09:32:18 -0400 Received: from aybabtu.com ([69.60.117.155]:46923) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K9KFO-0004KY-0h for grub-devel@gnu.org; Thu, 19 Jun 2008 09:32:18 -0400 Received: from [192.168.10.10] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1K9KCo-0004gb-Mz for grub-devel@gnu.org; Thu, 19 Jun 2008 15:29:39 +0200 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1K9KEt-0001K1-7z for grub-devel@gnu.org; Thu, 19 Jun 2008 15:31:47 +0200 Date: Thu, 19 Jun 2008 15:31:47 +0200 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20080619133147.GA5018@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="y0ulUmNC+osPPQO6" Content-Disposition: inline Content-Transfer-Encoding: 8bit Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [PATCH] add a counter in grub_dprintf X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jun 2008 13:32:21 -0000 --y0ulUmNC+osPPQO6 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 I know my rights; I want my phone call! What good is a phone call… if you are unable to speak? (as seen on /.) --y0ulUmNC+osPPQO6 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="counter.diff" 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 #include +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); --y0ulUmNC+osPPQO6--