Changeset 1093620 in mainline for test


Ignore:
Timestamp:
2006-01-22T16:51:11Z (20 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0d8d27c
Parents:
bd6e392
Message:

Fixes, comments, tests to frame allocator

Location:
test/mm
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • test/mm/falloc1/test.c

    rbd6e392 r1093620  
    3030#include <mm/page.h>
    3131#include <mm/frame.h>
     32#include <mm/heap.h>
    3233#include <arch/mm/page.h>
    3334#include <arch/types.h>
    3435#include <debug.h>
    3536
    36 #define MAX_FRAMES 2048
     37#define MAX_FRAMES 1024
    3738#define MAX_ORDER 8
    38 #define TEST_RUNS 4
     39#define TEST_RUNS 2
    3940
    4041void test(void) {
    41         __address frames[MAX_FRAMES];
     42        __address * frames = (__address *) malloc(MAX_FRAMES*sizeof(__address));
    4243        int results[MAX_ORDER+1];
    4344       
     
    5354                        allocated = 0;
    5455                        for (i=0;i<MAX_FRAMES>>order;i++) {
    55                                 frames[allocated] = frame_alloc(FRAME_NON_BLOCKING, order, &status);
     56                                frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA, order, &status);
    5657                               
    5758                                if (frames[allocated] % (FRAME_SIZE << order) != 0) {
     
    8384        }
    8485
    85 
     86        free(frames);
    8687       
    8788        printf("Test passed\n");
  • test/mm/falloc2/test.c

    rbd6e392 r1093620  
    3030#include <mm/page.h>
    3131#include <mm/frame.h>
     32#include <mm/heap.h>
    3233#include <arch/mm/page.h>
    3334#include <arch/types.h>
     
    3738#include <memstr.h>
    3839
    39 #define MAX_FRAMES 128
    40 #define MAX_ORDER 2
     40#define MAX_FRAMES 256
     41#define MAX_ORDER 8
    4142
    4243#define THREAD_RUNS 1
    43 #define THREADS 6
     44#define THREADS 8
    4445
    4546static void thread(void * arg);
     
    5455        index_t k;
    5556       
    56         __address frames[MAX_FRAMES];
     57        __address * frames =  (__address *) malloc(MAX_FRAMES * sizeof(__address));
    5758
    5859        for (run=0;run<THREAD_RUNS;run++) {
     
    6162                        printf("Thread #%d: Allocating %d frames blocks ... \n",val, 1<<order);
    6263                        allocated = 0;
    63                         for (i=0;i<MAX_FRAMES>>order;i++) {
     64                        for (i=0;i < (MAX_FRAMES >> order);i++) {
    6465                                frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA,order, &status);
    6566                                if (status == 0) {
     
    7576                        printf("Thread #%d: Deallocating ... \n", val);
    7677                        for (i=0;i<allocated;i++) {
     78                       
    7779                                for (k=0;k<=((FRAME_SIZE << order) - 1);k++) {
    7880                                        if ( ((char *) frames[i])[k] != val ) {
     
    8284                               
    8385                                }
    84                        
     86                               
    8587                                frame_free(frames[i]);
    8688                        }
Note: See TracChangeset for help on using the changeset viewer.