summaryrefslogtreecommitdiffstats
path: root/lib/dhry/cmd_dhry.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-06-23 15:38:23 -0600
committerSimon Glass <sjg@chromium.org>2015-07-21 17:39:19 -0600
commitd1389403ccb93df569e1559ef37edc53e8dbd589 (patch)
tree70ca67d47a4b45747465aeb230cc04d63af9386b /lib/dhry/cmd_dhry.c
parentb217c89e8565ade3aaa9f74c33c93236bf151187 (diff)
downloadtalos-obmc-uboot-d1389403ccb93df569e1559ef37edc53e8dbd589.tar.gz
talos-obmc-uboot-d1389403ccb93df569e1559ef37edc53e8dbd589.zip
Add a dhrystone benchmark command
Drystone provides a convenient sanity check that the CPU is running at full speed. Add this as a command which can be enabled as needed. Note: I investigated using Coremark for this but there was a license agreement and I could not work out if it was GPL-compatible. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'lib/dhry/cmd_dhry.c')
-rw-r--r--lib/dhry/cmd_dhry.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/dhry/cmd_dhry.c b/lib/dhry/cmd_dhry.c
new file mode 100644
index 0000000000..5dc191ea62
--- /dev/null
+++ b/lib/dhry/cmd_dhry.c
@@ -0,0 +1,34 @@
+/*
+ * (C) Copyright 2015 Google, Inc
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <command.h>
+#include "dhry.h"
+
+static int do_dhry(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ ulong start, duration, dhry_per_sec, vax_mips;
+ 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 = iterations * 1000 / duration;
+ vax_mips = dhry_per_sec / 1757;
+ printf("%d iterations in %lu ms: %lu/s, %lu DMIPS\n", iterations,
+ duration, 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"
+);
OpenPOWER on IntegriCloud