update test-stress with better object distribution

This commit is contained in:
Daan Leijen 2019-11-10 08:13:40 -08:00
parent 194008b869
commit d2279b2a3f

View file

@ -17,8 +17,8 @@ terms of the MIT license.
#include <mimalloc.h>
// argument defaults
static int THREADS = 32; // more repeatable if THREADS <= #processors
static int N = 40; // scaling factor
static int THREADS = 8; // more repeatable if THREADS <= #processors
static int N = 200; // scaling factor
// static int THREADS = 8; // more repeatable if THREADS <= #processors
// static int N = 100; // scaling factor
@ -63,7 +63,11 @@ static bool chance(size_t perc, random_t r) {
}
static void* alloc_items(size_t items, random_t r) {
if (chance(1, r)) items *= 100; // 1% huge objects;
if (chance(1, r)) {
if (chance(1, r)) items *= 1000; // 0.01% giant
else if (chance(10, r)) items *= 100; // 0.1% huge
else items *= 10; // 1% large objects;
}
if (items==40) items++; // pthreads uses that size for stack increases
uintptr_t* p = (uintptr_t*)mi_malloc(items*sizeof(uintptr_t));
if (p != NULL) {