Преглед на файлове

[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 преди 12 години
родител
ревизия
ba480730dc
променени са 1 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 6
    3
      src/hci/commands/time_cmd.c

+ 6
- 3
src/hci/commands/time_cmd.c Целия файл

@@ -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
 }

Loading…
Отказ
Запис