summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <ben@well-typed.com>2022-12-20 03:43:15 +0000
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-01-11 00:57:27 -0500
commit5f17e21af6368ec0e615af7de714a3194181f46a (patch)
tree82fab873c0453cbf8defee0a5d2b1a320eb4da50
parentb2857df4ee467c88162e5a6784ee1fb6e2038656 (diff)
downloadhaskell-5f17e21af6368ec0e615af7de714a3194181f46a.tar.gz
testsuite: Drop testheapalloced.c
As noted in #22414, this file (which appears to be a benchmark for characterising the one-step allocator's MBlock cache) is currently unreferenced. Remove it. Closes #22414.
-rw-r--r--testsuite/tests/rts/testheapalloced.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/testsuite/tests/rts/testheapalloced.c b/testsuite/tests/rts/testheapalloced.c
deleted file mode 100644
index 240f787c14..0000000000
--- a/testsuite/tests/rts/testheapalloced.c
+++ /dev/null
@@ -1,100 +0,0 @@
-#include "Rts.h"
-#include "RtsFlags.h"
-#if defined(DEBUG)
-#define INLINE_HEADER
-#endif
-#include "MBlock.h"
-#if defined(DEBUG)
-extern void *getFirstMBlock(void);
-extern void *getNextMBlock(void *mblock);
-#endif
-
-#include <stdio.h>
-#include <string.h>
-
-extern bdescr *allocGroup_lock_lock(uint32_t n);
-extern void freeGroup_lock(bdescr *p);
-
-const int ARRSIZE = 2000;
-const int LOOPS = 20000;
-const int MAXALLOC = ((8 * 1024 * 1024) / BLOCK_SIZE - 1);
-//const int MAXALLOC = ((4 * 1024 * 1024) / BLOCK_SIZE - 1);
-const int SEED = 0xf00f00;
-
-extern StgWord mblocks_allocated;
-
-int main (int argc, char *argv[])
-{
- int i, j, b;
-
- bdescr *a[ARRSIZE];
-
- srand(SEED);
-
- hs_init(&argc, &argv);
-
- memset(a, 0, ARRSIZE * sizeof(bdescr*));
-
- for (i=0; i < LOOPS; i++)
- {
- j = rand() % ARRSIZE;
- if (a[j]) { freeGroup_lock(a[j]); }
- a[j] = allocGroup_lock(rand() % MAXALLOC + 1);
- }
-
-#if defined(DEBUG)
- {
- void *p;
- i = 0;
- for (p = getFirstMBlock(); p != NULL; p = getNextMBlock(p))
- {
- if (!HEAP_ALLOCED(p)) barf("%p",p);
- i++;
- }
- printf("%d\n", i);
- }
-#endif
-
- {
- void *p, *base;
-
- j = 0;
- base = RtsFlags.GcFlags.heapBase;
-
- for (i=0; i < LOOPS*2000; i++)
- {
- // this is for testing: generate random addresses anywhere
- // in the address space.
- //
- // 48 bits is: 0x800000000000 - 0x7fffffffffff
- // so ((StgInt)rand() >> 4) varies between -2^27 and 2^27-1.
- // and << 20 of this is a random signed 48-bit megablock address
- //
- // p = (void*)((StgWord)((StgInt)rand() >> 4) << 20);
-
- // this is for benchmarking: roughly half of these
- // addresses will be in the heap.
- p = base + (((StgWord)rand() << 10) %
- ((StgWord)ARRSIZE * MAXALLOC * BLOCK_SIZE));
-
- if (HEAP_ALLOCED(p)) {
- // printf("%p\n",p);
- j++;
- }
- }
- printf("%d\n", j);
- }
-
- printf("misses: %ld, %ld%%\n", mpc_misses, mpc_misses / (LOOPS*20));
-
- for (i=0; i < ARRSIZE; i++)
- {
- if (a[i]) { freeGroup_lock(a[i]); }
- }
-
- hs_exit(); // will do a memory leak test
-
- exit(0);
-}
-
-// 48 bits is: 0x800000000000 - 0x7fffffffffff