software/libbase/memtest: improve reporting.

- indent sub-reports.
- report speed in MiB/s.
This commit is contained in:
Florent Kermarrec 2020-09-15 19:37:09 +02:00
parent e28e808c24
commit e63a40370e
1 changed files with 11 additions and 11 deletions

View File

@ -202,9 +202,9 @@ void memspeed(unsigned int *addr, unsigned long size, bool read_only)
} }
timer0_update_value_write(1); timer0_update_value_write(1);
end = timer0_value_read(); end = timer0_value_read();
write_speed = (8*size*(CONFIG_CLOCK_FREQUENCY/1000000))/(start - end); write_speed = (size*(CONFIG_CLOCK_FREQUENCY/1000000))/(start - end);
} }
printf("Write: %ld Mbps\n", write_speed); printf(" Write: %ldMiB/s\n", write_speed);
/* flush CPU and L2 caches */ /* flush CPU and L2 caches */
flush_cpu_dcache(); flush_cpu_dcache();
@ -221,8 +221,8 @@ void memspeed(unsigned int *addr, unsigned long size, bool read_only)
} }
timer0_update_value_write(1); timer0_update_value_write(1);
end = timer0_value_read(); end = timer0_value_read();
read_speed = (8*size*(CONFIG_CLOCK_FREQUENCY/1000000))/(start - end); read_speed = (size*(CONFIG_CLOCK_FREQUENCY/1000000))/(start - end);
printf("Read: %ld Mbps\n", read_speed); printf(" Read: %ldMiB/s\n", read_speed);
} }
int memtest(unsigned int *addr, unsigned long maxsize) int memtest(unsigned int *addr, unsigned long maxsize)
@ -239,9 +239,9 @@ int memtest(unsigned int *addr, unsigned long maxsize)
data_errors = memtest_data(addr, data_size, MEMTEST_DATA_RANDOM); data_errors = memtest_data(addr, data_size, MEMTEST_DATA_RANDOM);
if(bus_errors + addr_errors + data_errors != 0) { if(bus_errors + addr_errors + data_errors != 0) {
printf("- bus errors: %d/%ld\n", bus_errors, 2*bus_size/4); printf(" bus errors: %d/%ld\n", bus_errors, 2*bus_size/4);
printf("- addr errors: %d/%ld\n", addr_errors, addr_size/4); printf(" addr errors: %d/%ld\n", addr_errors, addr_size/4);
printf("- data errors: %d/%ld\n", data_errors, data_size/4); printf(" data errors: %d/%ld\n", data_errors, data_size/4);
printf("Memtest KO\n"); printf("Memtest KO\n");
return 0; return 0;
} }