Example #1
0
int
main(int argc, char *argv[])
{
    int ret = 0;

    if (argc != 2) {
        printf("Usage: %s [getattr|readdir|open|read]\n", argv[0]);
        ret = 1;
        goto out;
    }

    pagesize = getpagesize();

    if (strcmp(argv[1], "getattr") == 0) {
        ret = getattr_test();
    } else if (strcmp(argv[1], "readdir") == 0) {
        ret = readdir_test();
    } else if (strcmp(argv[1], "open") == 0) {
        ret = open_test();
    } else if (strcmp(argv[1], "read") == 0) {
        ret = read_test();
    } else if (strcmp(argv[1], "write") == 0) {
        ret = write_test();
    } else if (strcmp(argv[1], "remove") == 0) {
        ret = remove_test();
    }else if (strcmp(argv[1], "mkdir") == 0) {
        ret = mkdir_test();
    }else if (strcmp(argv[1], "rmdir") == 0) {
        ret = rmdir_test();
    }
out:
    exit(ret);
}
Example #2
0
static int address_mapping_test_init(void)
{
	START_TESTS("Address Mapping test");

	INIT_CALL_END(init(), add_test(), end(), "add function");
	INIT_CALL_END(init(), daniel_test(), end(), "Daniel's xlat tests");
	INIT_CALL_END(init(), anderson_test(), end(), "Tore's xlat tests");
	INIT_CALL_END(init(), remove_test(), end(), "remove function");

	END_TESTS;
}
int main()
{
    copy_test();
    copy_backward_test();
    transform_test();
    replace_test();
    replace_if_test();
    replace_copy_test();
    replace_copy_if_test();
    fill_test();
    fill_n_test();
    generate_test();
    generate_n_test();
    remove_test();
    remove_if_test();
    remove_copy_test();
    remove_copy_if_test();
    unique_test();
    unique_copy_test();
    reverse_test();
    reverse_copy_test();
    boost::report_errors();
}
int main() {
    int repeat = 500;
    int size = TESTSIZE;
    tellmeall();
    printf("array container benchmarks\n");
    array_container_t* B = array_container_create();
    BEST_TIME(add_test(B), 0, repeat, size);
    int answer = contains_test(B);
    size = 1 << 16;
    BEST_TIME(contains_test(B), answer, repeat, size);

    size = (1 << 16) / 3;
    BEST_TIME(remove_test(B), 0, repeat, size);
    array_container_free(B);

    for (int howmany = 32; howmany <= (1 << 16); howmany *= 8) {
        array_container_t* Bt = array_container_create();
        for (int j = 0; j < howmany; ++j) {
            array_container_add(Bt, (uint16_t)pcg32_random());
        }
        size_t nbrtestvalues = 1024;
        uint16_t* testvalues = malloc(nbrtestvalues * sizeof(uint16_t));
        printf("\n number of values in container = %d\n", Bt->cardinality);
        int card = array_container_cardinality(Bt);
        uint32_t* out = malloc(sizeof(uint32_t) * (unsigned long)card);
        BEST_TIME(array_container_to_uint32_array(out, Bt, 1234), card, repeat,
                  card);
        free(out);
        BEST_TIME_PRE_ARRAY(Bt, array_container_contains, array_cache_prefetch,
                            testvalues, nbrtestvalues);
        BEST_TIME_PRE_ARRAY(Bt, array_container_contains, array_cache_flush,
                            testvalues, nbrtestvalues);
        free(testvalues);
        array_container_free(Bt);
    }
    printf("\n");

    array_container_t* B1 = array_container_create();
    for (int x = 0; x < 1 << 16; x += 3) {
        array_container_add(B1, (uint16_t)x);
    }
    array_container_t* B2 = array_container_create();
    for (int x = 0; x < 1 << 16; x += 5) {
        array_container_add(B2, (uint16_t)x);
    }
    int32_t inputsize = B1->cardinality + B2->cardinality;
    array_container_t* BO = array_container_create();
    printf("\nUnion and intersections...\n");
    printf("\nNote:\n");
    printf(
        "union times are expressed in cycles per number of input elements "
        "(both arrays)\n");
    printf(
        "intersection times are expressed in cycles per number of output "
        "elements\n\n");
    printf("==intersection and union test 1 \n");
    printf("input 1 cardinality = %d, input 2 cardinality = %d \n",
           B1->cardinality, B2->cardinality);
    answer = union_test(B1, B2, BO);
    printf("union cardinality = %d \n", answer);
    printf("B1 card = %d B2 card = %d \n", B1->cardinality, B2->cardinality);
    BEST_TIME(union_test(B1, B2, BO), answer, repeat, inputsize);
    answer = intersection_test(B1, B2, BO);
    printf("intersection cardinality = %d \n", answer);
    BEST_TIME(intersection_test(B1, B2, BO), answer, repeat, answer);
    printf("==intersection and union test 2 \n");
    array_container_clear(B1);
    array_container_clear(B2);
    for (int x = 0; x < 1 << 16; x += 16) {
        array_container_add(B1, (uint16_t)x);
    }
    for (int x = 1; x < 1 << 16; x += x) {
        array_container_add(B2, (uint16_t)x);
    }
    printf("input 1 cardinality = %d, input 2 cardinality = %d \n",
           B1->cardinality, B2->cardinality);
    answer = union_test(B1, B2, BO);
    printf("union cardinality = %d \n", answer);
    printf("B1 card = %d B2 card = %d \n", B1->cardinality, B2->cardinality);
    BEST_TIME(union_test(B1, B2, BO), answer, repeat, inputsize);
    answer = intersection_test(B1, B2, BO);
    printf("intersection cardinality = %d \n", answer);
    BEST_TIME(intersection_test(B1, B2, BO), answer, repeat, answer);

    array_container_free(B1);
    array_container_free(B2);
    array_container_free(BO);
    return 0;
}