1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2011 The Chromium OS Authors.
9 static void report_time(ulong cycles)
11 ulong minutes, seconds, milliseconds;
12 ulong total_seconds, remainder;
14 total_seconds = cycles / CONFIG_SYS_HZ;
15 remainder = cycles % CONFIG_SYS_HZ;
16 minutes = total_seconds / 60;
17 seconds = total_seconds % 60;
18 /* approximate millisecond value */
19 milliseconds = (remainder * 1000 + CONFIG_SYS_HZ / 2) / CONFIG_SYS_HZ;
23 printf(" %lu minutes,", minutes);
24 printf(" %lu.%03lu seconds\n", seconds, milliseconds);
27 static int do_time(struct cmd_tbl *cmdtp, int flag, int argc,
37 retval = cmd_process(0, argc - 1, argv + 1, &repeatable, &cycles);
43 U_BOOT_CMD(time, CONFIG_SYS_MAXARGS, 0, do_time,
44 "run commands and summarize execution time",
45 "command [args...]\n");