Michael Thomson <[EMAIL PROTECTED]> wrote:
> Reinoud, any chance you can share
> your "random memory tester" or is that not openly available?
Sure, it's a trivial & tiny hack, see below. Note that you'll have
to set the memsize variable to something that will fit in available
memory. Expect to see some paging activity anyway, because it
over-allocates memory and shifts buffers around (to random offsets of
course;).
Please let me know about the results!
- Reinoud
/*--------------------------------------------------------------------
rmt.c - random memory tester, version 0
(todo: passno indicator, cmdline params, int mem access, rnd reads)
--------------------------------------------------------------------
Copyright (c) 2002 Reinoud Lamberts
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
--------------------------------------------------------------------*/
#include <stdio.h>
#include <stdlib.h>
#define GoodRNG() rand()
#define GoodRNG_init(seed) srand(seed)
int main()
{
/*unsigned int memsize = 16777216;*/
/*unsigned int memsize = 33554432;*/
/*unsigned int memsize = 67108864;*/
/*unsigned int memsize = 134217728;*/
unsigned int memsize = 268435456;
int rndseed = 2767;
unsigned char *mem, *bank0, *bank1;
int banksize = memsize / 2;
int bankmask = banksize - 1;
int memerr;
int i, idx;
if (RAND_MAX < bankmask) {
printf("error: out of RNG range\n");
exit(EXIT_FAILURE);
}
mem = malloc(memsize + banksize);
if (mem == NULL) {
printf("error: cannot allocate memory\n");
exit(EXIT_FAILURE);
}
bank0 = mem;
memerr = 0;
while (1) {
bank1 = mem + banksize + (GoodRNG() & bankmask);
GoodRNG_init(rndseed);
printf("initialising bank 0... ");
fflush(stdout);
for (i=0; i<banksize; i++)
bank0[i] = GoodRNG();
printf("writing bank 0...\n");
for (i=0; i<banksize; i++)
bank0[GoodRNG() & bankmask] = GoodRNG();
GoodRNG_init(rndseed);
printf("initialising bank 1... ");
fflush(stdout);
for (i=0; i<banksize; i++)
bank1[i] = GoodRNG();
printf("writing bank 1...\n");
for (i=0; i<banksize; i++)
bank1[GoodRNG() & bankmask] = GoodRNG();
printf("verifying...\n");
for (idx=0; idx<banksize; idx++)
if (bank0[idx] != bank1[idx]) {
printf("**warning** - memory error found!\n");
memerr = 1;
}
if (memerr)
exit(EXIT_FAILURE);
rndseed = GoodRNG();
}
return 0;
}
--
video4linux-list mailing list
Unsubscribe mailto:[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/video4linux-list