2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-06-23 21:38:23 +00:00
|
|
|
/*
|
|
|
|
* (C) Copyright 2015 Google, Inc
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <command.h>
|
2016-03-16 13:44:35 +00:00
|
|
|
#include <div64.h>
|
2015-06-23 21:38:23 +00:00
|
|
|
#include "dhry.h"
|
|
|
|
|
2020-05-10 17:40:03 +00:00
|
|
|
static int do_dhry(struct cmd_tbl *cmdtp, int flag, int argc,
|
|
|
|
char *const argv[])
|
2015-06-23 21:38:23 +00:00
|
|
|
{
|
2016-03-16 13:44:35 +00:00
|
|
|
ulong start, duration, vax_mips;
|
|
|
|
u64 dhry_per_sec;
|
2015-06-23 21:38:23 +00:00
|
|
|
int iterations = 1000000;
|
|
|
|
|
|
|
|
if (argc > 1)
|
2021-07-24 15:03:30 +00:00
|
|
|
iterations = dectoul(argv[1], NULL);
|
2015-06-23 21:38:23 +00:00
|
|
|
|
|
|
|
start = get_timer(0);
|
|
|
|
dhry(iterations);
|
|
|
|
duration = get_timer(start);
|
2016-03-16 13:44:35 +00:00
|
|
|
dhry_per_sec = lldiv(iterations * 1000ULL, duration);
|
2016-03-17 14:14:25 +00:00
|
|
|
vax_mips = lldiv(dhry_per_sec, 1757);
|
2015-06-23 21:38:23 +00:00
|
|
|
printf("%d iterations in %lu ms: %lu/s, %lu DMIPS\n", iterations,
|
2016-03-16 13:44:35 +00:00
|
|
|
duration, (ulong)dhry_per_sec, vax_mips);
|
2015-06-23 21:38:23 +00:00
|
|
|
|
|
|
|
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"
|
|
|
|
);
|