OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [conts/] [libmem/] [tests/] [test_kmalloc.c] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Testing code for the kmalloc allocator.
3
 *
4
 * Copyright (C) 2007 Bahadir Balban
5
 */
6
#include <l4/macros.h>
7
#include <l4/config.h>
8
#include <l4/types.h>
9
#include <l4/lib/list.h>
10
#include INC_GLUE(memory.h)
11
#include <stdlib.h>
12
#include <stdio.h>
13
#include <string.h>
14
#include <time.h>
15
#include "test_alloc_generic.h"
16
#include "test_allocpage.h"
17
#include "debug.h"
18
#include "tests.h"
19
 
20
extern struct link km_area_start;
21
 
22
void print_kmalloc_state(void)
23
{
24
        print_km_area_list(&km_area_start);
25
}
26
 
27
void test_kmalloc(int kmalloc_allocations, int kmalloc_alloc_size_max,
28
                  FILE *init_state, FILE *exit_state)
29
{
30
        unsigned int KMALLOC_ALLOCATIONS = 20;
31
        unsigned int KMALLOC_ALLOC_SIZE_MAX = (PAGE_SIZE * 3);
32
 
33
        if (!kmalloc_allocations)
34
                kmalloc_allocations = KMALLOC_ALLOCATIONS;
35
        if (!kmalloc_alloc_size_max)
36
                kmalloc_alloc_size_max = KMALLOC_ALLOC_SIZE_MAX;
37
 
38
        test_alloc_free_random_order(kmalloc_allocations, kmalloc_alloc_size_max,
39
                                     kmalloc, kfree, print_kmalloc_state,
40
                                     init_state, exit_state);
41
}
42
 

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.