Example #1
0
static void testInArena(mps_arena_t arena)
{
    mps_pool_t lopool, hipool;
    PoolStatStruct lostruct;  /* stats about lopool */
    PoolStatStruct histruct;  /* stats about lopool */
    PoolStat lostat = &lostruct;
    PoolStat histat = &histruct;
    int i;

    die(mps_pool_create(&hipool, arena, mps_class_mvff(),
                        chunkSize, chunkSize,
                        (mps_align_t)1024,
                        TRUE, TRUE, TRUE),
        "Create HI MFFV");

    die(mps_pool_create(&lopool, arena, mps_class_mvff(),
                        chunkSize, chunkSize,
                        (mps_align_t)1024,
                        FALSE, FALSE, TRUE),
        "Create LO MFFV");

    poolStatInit(lostat, lopool, chunkSize);
    poolStatInit(histat, hipool, chunkSize);

    /* iterate, allocating objects */
    for (i=0; i<iterationCount; ++i) {
        allocMultiple(lostat);
        allocMultiple(histat);
    }

    /* report results */
    reportResults(lostat, "the low MVFF pool");
    reportResults(histat, "the high MVFF pool");

    if (lostat->max > histat->min) {
        error("\nFOUND PROBLEM - low range overlaps high\n");
    } else {
        printf("\nNo problems detected.\n");
    }

    mps_pool_destroy(hipool);
    mps_pool_destroy(lopool);
}
Example #2
0
static void testInArena(mps_arena_t arena,
                        mps_bool_t failcase,
                        mps_bool_t usefulFailcase)
{
  mps_pool_t lopool, hipool, temppool;
  PoolStatStruct lostruct;  /* stats about lopool */
  PoolStatStruct histruct;  /* stats about lopool */
  PoolStatStruct tempstruct;  /* stats about temppool */
  PoolStat lostat = &lostruct;
  PoolStat histat = &histruct;
  PoolStat tempstat = &tempstruct;
  int i;

  die(mps_pool_create(&hipool, arena, mps_class_mvff(),
                      chunkSize, chunkSize, (size_t)1024,
                      TRUE, TRUE, TRUE),
      "Create HI MFFV");

  die(mps_pool_create(&lopool, arena, mps_class_mvff(),
                      chunkSize, chunkSize, (size_t)1024,
                      FALSE, FALSE, TRUE),
      "Create LO MFFV");

  die(mps_pool_create(&temppool, arena, mps_class_mv(),
                      chunkSize, chunkSize, chunkSize),
      "Create TEMP");

  if(failcase) {
    if(usefulFailcase) {
      /* describe a useful failure case */
    } else {
      /* describe a misleading failure case */
    }
  }

  poolStatInit(lostat, lopool, chunkSize);
  poolStatInit(histat, hipool, chunkSize);
  poolStatInit(tempstat, temppool, chunkSize);

  /* iterate, allocating objects */
  for (i=0; i<iterationCount; ++i) {
    mps_res_t res;
    res = allocMultiple(lostat);
    if (res != MPS_RES_OK)
      break;
    res = allocMultiple(histat);
    if (res != MPS_RES_OK)
      break;
    res = allocMultiple(tempstat);
    if (res != MPS_RES_OK)
      break;
  }

  /* report results */
  reportResults(lostat, "the low MVFF pool");
  reportResults(histat, "the high MVFF pool");
  reportResults(tempstat, "the temp pool");

  mps_pool_destroy(hipool);
  mps_pool_destroy(lopool);
  mps_pool_destroy(temppool);

}