From: ljsebald <ljs...@us...> - 2023-02-12 01:57:52
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "A pseudo Operating System for the Dreamcast.". The branch, master has been updated via 9db78833f9f1228318f42b6ef1bd97593273f48c (commit) from da62e62955d2edad42c218257a50da10aff59f56 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9db78833f9f1228318f42b6ef1bd97593273f48c Author: Andress Barajas <and...@gm...> Date: Sat Feb 11 17:57:06 2023 -0800 Updated speed test to calculate the average (#105) ----------------------------------------------------------------------- Summary of changes: examples/dreamcast/sd/speedtest/sd-speedtest.c | 27 ++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/examples/dreamcast/sd/speedtest/sd-speedtest.c b/examples/dreamcast/sd/speedtest/sd-speedtest.c index edca977..593acac 100644 --- a/examples/dreamcast/sd/speedtest/sd-speedtest.c +++ b/examples/dreamcast/sd/speedtest/sd-speedtest.c @@ -50,8 +50,10 @@ static void __attribute__((__noreturn__)) wait_exit() { int main(int argc, char *argv[]) { kos_blockdev_t sd_dev; - uint64 begin, end, timer; + uint64 begin, end, timer, average; + uint64 sum = 0; uint8_t pt; + int i; dbgio_dev_select("fb"); dbglog(DBG_DEBUG, "Initializing SD card.\n"); @@ -69,20 +71,25 @@ int main(int argc, char *argv[]) { wait_exit(); } - dbglog(DBG_DEBUG, "Reading 1024 blocks.\n"); + dbglog(DBG_DEBUG, "Calculating average speed for reading 1024 blocks.\n"); - begin = timer_ms_gettime64(); + for(i = 0; i < 10; i++) { + begin = timer_ms_gettime64(); - if(sd_dev.read_blocks(&sd_dev, 0, 1024, tbuf)) { - dbglog(DBG_DEBUG, "couldn't read block: %s\n", strerror(errno)); - return -1; + if(sd_dev.read_blocks(&sd_dev, 0, 1024, tbuf)) { + dbglog(DBG_DEBUG, "couldn't read block: %s\n", strerror(errno)); + return -1; + } + + end = timer_ms_gettime64(); + timer = end - begin; + sum += timer; } - end = timer_ms_gettime64(); - timer = end - begin; + average = sum / 10; - dbglog(DBG_DEBUG, "SD card read took %llu ms (%.3f KB/sec)\n", - timer, (512 * 1024) / ((double)timer)); + dbglog(DBG_DEBUG, "SD card read average took %llu ms (%.3f KB/sec)\n", + average, (512 * 1024) / ((double)average)); sd_shutdown(); wait_exit(); hooks/post-receive -- A pseudo Operating System for the Dreamcast. |