mirror of
https://github.com/ipxe/ipxe
synced 2025-12-23 21:41:43 +03:00
[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>
This commit is contained in:
@@ -56,7 +56,8 @@ static struct command_descriptor time_cmd =
|
|||||||
static int time_exec ( int argc, char **argv ) {
|
static int time_exec ( int argc, char **argv ) {
|
||||||
struct time_options opts;
|
struct time_options opts;
|
||||||
unsigned long start;
|
unsigned long start;
|
||||||
int secs;
|
unsigned long elapsed;
|
||||||
|
int decisecs;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* Parse options */
|
/* Parse options */
|
||||||
@@ -65,9 +66,11 @@ static int time_exec ( int argc, char **argv ) {
|
|||||||
|
|
||||||
start = currticks();
|
start = currticks();
|
||||||
rc = execv ( argv[1], argv + 1 );
|
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;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user