瀏覽代碼

[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…
取消
儲存