Browse Source

[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 years ago
parent
commit
ba480730dc
1 changed files with 6 additions and 3 deletions
  1. 6
    3
      src/hci/commands/time_cmd.c

+ 6
- 3
src/hci/commands/time_cmd.c View File

56
 static int time_exec ( int argc, char **argv ) {
56
 static int time_exec ( int argc, char **argv ) {
57
 	struct time_options opts;
57
 	struct time_options opts;
58
 	unsigned long start;
58
 	unsigned long start;
59
-	int secs;
59
+	unsigned long elapsed;
60
+	int decisecs;
60
 	int rc;
61
 	int rc;
61
 
62
 
62
 	/* Parse options */
63
 	/* Parse options */
65
 
66
 
66
 	start = currticks();
67
 	start = currticks();
67
 	rc = execv ( argv[1], argv + 1 );
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
 	return rc;
75
 	return rc;
73
 }
76
 }

Loading…
Cancel
Save