mariadb/linux/tests/test-wss.c
Rich Prohaska aae80d1446 run the linux portability tests. addresses #1524
git-svn-id: file:///svn/toku/tokudb@9880 c7de825b-a66e-492c-adef-691d508d4ae1
2013-04-16 23:57:43 -04:00

50 lines
1 KiB
C

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <stdint.h>
#include <inttypes.h>
#include <toku_os.h>
const int nbuffers = 1000;
const int buffersize = 1024*1024;
static void do_mallocs(void) {
int i;
void *vp[nbuffers];
for (i=0; i<nbuffers; i++) {
int nbytes = buffersize;
vp[i] = malloc(nbytes);
memset(vp[i], 0, nbytes);
}
for (i=0; i<nbuffers; i++)
free(vp[i]);
}
int main(int argc, char *argv[]) {
int verbose = 0;
int i;
for (i=1; i<argc; i++) {
if (strcmp(argv[i], "-v") == 0) {
verbose = 1;
continue;
}
if (strcmp(argv[i], "-q") == 0) {
verbose = 0;
continue;
}
}
int64_t rss;
toku_os_get_max_rss(&rss);
if (verbose) printf("%"PRId64"\n", rss);
assert(rss < nbuffers*buffersize);
do_mallocs();
toku_os_get_max_rss(&rss);
if (verbose) printf("%"PRId64"\n", rss);
assert(rss > nbuffers*buffersize);
return 0;
}