diff options
author | 2023-10-10 14:33:42 +0000 | |
---|---|---|
committer | 2023-10-10 14:33:42 +0000 | |
commit | af1a266670d040d2f4083ff309d732d648afba2a (patch) | |
tree | 2fc46203448ddcc6f81546d379abfaeb323575e9 /roms/u-boot/lib/dhry/cmd_dhry.c | |
parent | e02cda008591317b1625707ff8e115a4841aa889 (diff) |
Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec
Diffstat (limited to 'roms/u-boot/lib/dhry/cmd_dhry.c')
-rw-r--r-- | roms/u-boot/lib/dhry/cmd_dhry.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/roms/u-boot/lib/dhry/cmd_dhry.c b/roms/u-boot/lib/dhry/cmd_dhry.c new file mode 100644 index 000000000..d55ab54df --- /dev/null +++ b/roms/u-boot/lib/dhry/cmd_dhry.c @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) Copyright 2015 Google, Inc + */ + +#include <common.h> +#include <command.h> +#include <div64.h> +#include "dhry.h" + +static int do_dhry(struct cmd_tbl *cmdtp, int flag, int argc, + char *const argv[]) +{ + ulong start, duration, vax_mips; + u64 dhry_per_sec; + int iterations = 1000000; + + if (argc > 1) + iterations = simple_strtoul(argv[1], NULL, 10); + + start = get_timer(0); + dhry(iterations); + duration = get_timer(start); + dhry_per_sec = lldiv(iterations * 1000ULL, duration); + vax_mips = lldiv(dhry_per_sec, 1757); + printf("%d iterations in %lu ms: %lu/s, %lu DMIPS\n", iterations, + duration, (ulong)dhry_per_sec, vax_mips); + + return 0; +} + +U_BOOT_CMD( + dhry, 2, 1, do_dhry, + "[iterations] - run dhrystone benchmark", + "\n - run the Dhrystone 2.1 benchmark, a rough measure of CPU speed\n" +); |