Procházet zdrojové kódy

[cmdline] Increase resolution of "time" command

A reasonably large (512MB) file transferred via HTTP over Gigabit
Ethernet should complete in around 4.6 seconds.  Increase the
resolution of the "time" command to tenths of a second, to allow such
transfers to be meaningfully measured.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown před 12 roky
rodič
revize
ba480730dc
1 změnil soubory, kde provedl 6 přidání a 3 odebrání
  1. 6
    3
      src/hci/commands/time_cmd.c

+ 6
- 3
src/hci/commands/time_cmd.c Zobrazit soubor

@@ -56,7 +56,8 @@ static struct command_descriptor time_cmd =
56 56
 static int time_exec ( int argc, char **argv ) {
57 57
 	struct time_options opts;
58 58
 	unsigned long start;
59
-	int secs;
59
+	unsigned long elapsed;
60
+	int decisecs;
60 61
 	int rc;
61 62
 
62 63
 	/* Parse options */
@@ -65,9 +66,11 @@ static int time_exec ( int argc, char **argv ) {
65 66
 
66 67
 	start = currticks();
67 68
 	rc = execv ( argv[1], argv + 1 );
68
-	secs = (currticks() - start) / ticks_per_sec();
69
+	elapsed = ( currticks() - start );
70
+	decisecs = ( 10 * elapsed / ticks_per_sec() );
69 71
 
70
-	printf ( "%s: %ds\n", argv[0], secs );
72
+	printf ( "%s: %d.%ds\n", argv[0],
73
+		 ( decisecs / 10 ), ( decisecs % 10 ) );
71 74
 
72 75
 	return rc;
73 76
 }

Načítá se…
Zrušit
Uložit