Exemple #1
0
int main(int argc, char **argv) {
    int nthreads;
    int exper_n;

    if (1 == argc) {
#     if !defined(HAVE_MMAP)
        nthreads = 3;
#     else
        nthreads = 10;
#     endif
    } else if (2 == argc) {
      nthreads = atoi(argv[1]);
      if (nthreads < 1 || nthreads > MAX_NTHREADS) {
        fprintf(stderr, "Invalid # of threads argument\n");
        exit(1);
      }
    } else {
      fprintf(stderr, "Usage: %s [# of threads]\n", argv[0]);
      exit(1);
    }
    printf("Performing %d reversals of %d element lists in %d threads\n",
           N_REVERSALS, LIST_LENGTH, nthreads);
    AO_malloc_enable_mmap();
    run_parallel(nthreads, run_one_test, dummy_test, "AO_malloc/AO_free");
    return 0;
}
Exemple #2
0
int main(int argc, char **argv) {
    int nthreads;

    if (1 == argc) {
      nthreads = DEFAULT_NTHREADS;
    } else if (2 == argc) {
      nthreads = atoi(argv[1]);
      if (nthreads < 1 || nthreads > MAX_NTHREADS) {
        fprintf(stderr, "Invalid # of threads argument\n");
        exit(1);
      }
    } else {
      fprintf(stderr, "Usage: %s [# of threads]\n", argv[0]);
      exit(1);
    }
    printf("Performing %d reversals of %d element lists in %d threads\n",
           N_REVERSALS, LIST_LENGTH, nthreads);
    AO_malloc_enable_mmap();

    /* Test various corner cases. */
    AO_free(NULL);
    AO_free(AO_malloc(0));
#   ifdef HAVE_MMAP
      AO_free(AO_malloc(CHUNK_SIZE - (sizeof(AO_t)-1))); /* large alloc */
#   endif

    run_parallel(nthreads, run_one_test, dummy_test, "AO_malloc/AO_free");
    return 0;
}