summaryrefslogtreecommitdiffstats
path: root/src/hci
diff options
context:
space:
mode:
authorMichael Brown2012-06-26 13:42:06 +0200
committerMichael Brown2012-06-27 20:15:16 +0200
commitba480730dc2759aad76729102400b2265eb87aac (patch)
tree1fda42aafeed02102fb727f934cf3fa370a3710d /src/hci
parent[realtek] Add missing cpu_to_le16() (diff)
downloadipxe-ba480730dc2759aad76729102400b2265eb87aac.tar.gz
ipxe-ba480730dc2759aad76729102400b2265eb87aac.tar.xz
ipxe-ba480730dc2759aad76729102400b2265eb87aac.zip
[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>
Diffstat (limited to 'src/hci')
-rw-r--r--src/hci/commands/time_cmd.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/hci/commands/time_cmd.c b/src/hci/commands/time_cmd.c
index 6c9556ce..ce26f9d2 100644
--- a/src/hci/commands/time_cmd.c
+++ b/src/hci/commands/time_cmd.c
@@ -56,7 +56,8 @@ static struct command_descriptor time_cmd =
static int time_exec ( int argc, char **argv ) {
struct time_options opts;
unsigned long start;
- int secs;
+ unsigned long elapsed;
+ int decisecs;
int rc;
/* Parse options */
@@ -65,9 +66,11 @@ static int time_exec ( int argc, char **argv ) {
start = currticks();
rc = execv ( argv[1], argv + 1 );
- secs = (currticks() - start) / ticks_per_sec();
+ elapsed = ( currticks() - start );
+ decisecs = ( 10 * elapsed / ticks_per_sec() );
- printf ( "%s: %ds\n", argv[0], secs );
+ printf ( "%s: %d.%ds\n", argv[0],
+ ( decisecs / 10 ), ( decisecs % 10 ) );
return rc;
}