Skip to contentSkip to conversation

CONFIG_PRINT_TIME: Measuring boot time.

PATCH New Benoit Monin 2 participants 2 messages Mar 5, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 CONFIG_PRINT_TIME: Measuring boot time.

De : "Jean-Christophe PLAGNIOL-VILLARD"

Hi Jean-Christophe,

Thanks for your answer.

Quoted 2 lines · Benoit Monin
Quoted 1 line

[..SNIP..]

Quoted 7 lines
Quoted 7 lines
(quoted diff) +1 -6
-	if (gd->flags & GD_FLG_DEVINIT) {
-		/* Send to the standard output */
-		fputc(stdout, c);
-	} else {
-		/* Send directly to the handler */
-		serial_putc(c);
+	__putc(c);
Quoted 8 lines

Review

Quoted 7 lines
(quoted diff) +7 -0
+#ifdef CONFIG_PRINT_TIME
+	if (c == '\n') {
+		unsigned long ms;
+		char tbuf[32];
+		int tlen;
+		int i;
+

NACK

Could you explain, please ?
Well, ms should be named us as it is a value in microsecond, but i'm guessing you are nack'ing something else.

Quoted 2 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+		ms = ticks2usec(get_ticks());

ticks2usec only exist on ppc

Right, ticks2usec is only implemented in lib_ppc and lib_sparc. I naively believed what was written in include/common.h.

All in all, do you think this patch is worth implementing ticks2usec in the 10 remaining lib_${arch} or should I just drop the ball ? I also have a "time" command (like the unix time command) that uses ticks2usec.

Quoted 3 lines

Review

Quoted 1 line
(quoted diff) +1 -0
+		tlen = sprintf(tbuf, "[%5lu.%06lu] ", (ms / 1000000UL), (ms % 1000000UL));

wont work on arm
please do_div

Does this mean you can't divide(or get the modulo of) a 32bits integer by another 32bits integer ? Sorry if it's obvious but my arm is a bit rusty ;)

Quoted 11 lines
Quoted 11 lines
(quoted diff) +3 -0
+		for (i = 0; i < tlen; i++)
+			__putc(tbuf[i]);
 	}
+#endif
 }
 
 void puts(const char *s)
@@ -358,6 +376,11 @@ void puts(const char *s)
 		return;
 #endif
 
Quoted 4 lines

Review void puts(const char *s) · line 381

Quoted 3 lines
(quoted diff) +3 -0
+#ifdef CONFIG_PRINT_TIME
+	while (*s) {
+		putc(*s++);

please use fputs and serail_puts

I should have written a comment around this: To print the timestamp at the beginning of every newline, the string must be scanned for '\n' and this is already done by putc. This way, the following strings are correctly displayed:

/* Multiple newlines */
puts (" Hello \n World \n My \n name \n is \n U-Boot.\n"); /* No newline */
puts ("Hello");
puts ("World\n");

Do you think of another way of doing it ?

Quoted 3 lines

Best Regards,
J.

Sincerely,
Beno?t.
--

Cr?ez votre adresse ?lectronique prenom.nom at laposte.net 1 Go d'espace de stockage, anti-spam et anti-virus int?gr?s.

#1 lore raw

PATCH 1/1 CONFIG_PRINT_TIME: Measuring boot time.

Quoted 16 lines · Benoit Monin
   De : "Jean-Christophe PLAGNIOL-VILLARD"

   Hi Jean-Christophe,

   Thanks for your answer.
   > On 17:16 Wed 04 Mar , Benoit Monin wrote:
   > >
   [..SNIP..]
   > > - if (gd->flags & GD_FLG_DEVINIT) {
   > > - /* Send to the standard output */
   > > - fputc(stdout, c);
   > > - } else {
   > > - /* Send directly to the handler */
   > > - serial_putc(c);
   > > + __putc(c);
   > > +#ifdef CONFIG_PRINT_TIME
Quoted 8 lines
   > > + if (c == '\n') {
   > > + unsigned long ms;
   > > + char tbuf[32];
   > > + int tlen;
   > > + int i;
   > > +
   > NACK
   Could you explain, please ?

your patch can not work on all arch

Quoted 11 lines

Well, ms should be named us as it is a value in microsecond, but i'm guessing you are nack'ing something else.

Quoted 2 lines
Quoted 1 line

+ ms = ticks2usec(get_ticks());

ticks2usec only exist on ppc

Right, ticks2usec is only implemented in lib_ppc and lib_sparc. I naively believed what was written in include/common.h.

All in all, do you think this patch is worth implementing ticks2usec in the 10 remaining lib_${arch} or should I just drop the ball ? I also have a "time" command (like the unix time command) that uses ticks2usec.

IMHO if it's a general purpose you must have it working on all arch not only one or two ditto for the time command

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

+ tlen = sprintf(tbuf, "[%5lu.%06lu] ", (ms / 1000000UL), (ms %

1000000UL));

Quoted 2 lines

wont work on arm
please do_div

Does this mean you can't divide(or get the modulo of) a 32bits integer by another 32bits integer ? Sorry if it's obvious but my arm is a bit rusty ;)

no but you will need to have the hard float support that we de not and please avoid modulo too for the same reason

btw get_ticks return a u64 so I'll prefer we keep this precision until the div

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

+ for (i = 0; i < tlen; i++)
+ __putc(tbuf[i]);
}
+#endif
}

void puts(const char *s)

(quoted diff) +0 -0
@@ -358,6 +376,11 @@ void puts(const char *s)
 return;
 #endif
 
Quoted 8 lines
Quoted 4 lines

Review void puts(const char *s) · line 381

Quoted 3 lines
(quoted diff) +3 -0
+#ifdef CONFIG_PRINT_TIME
+ while (*s) {
+ putc(*s++);

please use fputs and serail_puts

I should have written a comment around this: To print the timestamp at the beginning of every newline, the string must be scanned for '\n' and this is already done by putc. This way, the following strings are correctly

sure a comment will be better to understand what you want to do and why

Best Regards,
J.