mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
Memory addressing test implemented.
This commit is contained in:
parent
d033ccb0af
commit
d4a515c56d
@ -56,6 +56,33 @@ void memtest_progress_step(size_t curr, size_t size, char c) {
|
|||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Test that addressing is fine. Every location is populated with its own
|
||||||
|
* address, and finally verified. This test is very fast but may detect
|
||||||
|
* ASAP big issues with the memory subsystem. */
|
||||||
|
void memtest_addressing(unsigned long *l, size_t bytes) {
|
||||||
|
unsigned long words = bytes/sizeof(unsigned long);
|
||||||
|
unsigned long j, *p;
|
||||||
|
|
||||||
|
/* Fill */
|
||||||
|
p = l;
|
||||||
|
for (j = 0; j < words; j++) {
|
||||||
|
*p = (unsigned long)p;
|
||||||
|
p++;
|
||||||
|
if ((j & 0xffff) == 0) memtest_progress_step(j,words*2,'A');
|
||||||
|
}
|
||||||
|
/* Test */
|
||||||
|
p = l;
|
||||||
|
for (j = 0; j < words; j++) {
|
||||||
|
if (*p != (unsigned long)p) {
|
||||||
|
printf("\n*** MEMORY ADDRESSING ERROR: %p contains %lu\n",
|
||||||
|
(void*) p, *p);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
p++;
|
||||||
|
if ((j & 0xffff) == 0) memtest_progress_step(j+words,words*2,'A');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Fill words stepping a single page at every write, so we continue to
|
/* Fill words stepping a single page at every write, so we continue to
|
||||||
* touch all the pages in the smallest amount of time reducing the
|
* touch all the pages in the smallest amount of time reducing the
|
||||||
* effectiveness of caches, and making it hard for the OS to transfer
|
* effectiveness of caches, and making it hard for the OS to transfer
|
||||||
@ -162,6 +189,11 @@ void memtest_test(size_t megabytes, int passes) {
|
|||||||
}
|
}
|
||||||
while (pass != passes) {
|
while (pass != passes) {
|
||||||
pass++;
|
pass++;
|
||||||
|
|
||||||
|
memtest_progress_start("Addressing test",pass);
|
||||||
|
memtest_addressing(m,bytes);
|
||||||
|
memtest_progress_end();
|
||||||
|
|
||||||
memtest_progress_start("Random fill",pass);
|
memtest_progress_start("Random fill",pass);
|
||||||
memtest_fill_random(m,bytes);
|
memtest_fill_random(m,bytes);
|
||||||
memtest_progress_end();
|
memtest_progress_end();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user