- Timestamp:
- 2006-01-22T16:51:11Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0d8d27c
- Parents:
- bd6e392
- Location:
- test/mm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
test/mm/falloc1/test.c
rbd6e392 r1093620 30 30 #include <mm/page.h> 31 31 #include <mm/frame.h> 32 #include <mm/heap.h> 32 33 #include <arch/mm/page.h> 33 34 #include <arch/types.h> 34 35 #include <debug.h> 35 36 36 #define MAX_FRAMES 204837 #define MAX_FRAMES 1024 37 38 #define MAX_ORDER 8 38 #define TEST_RUNS 439 #define TEST_RUNS 2 39 40 40 41 void test(void) { 41 __address frames[MAX_FRAMES];42 __address * frames = (__address *) malloc(MAX_FRAMES*sizeof(__address)); 42 43 int results[MAX_ORDER+1]; 43 44 … … 53 54 allocated = 0; 54 55 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); 56 57 57 58 if (frames[allocated] % (FRAME_SIZE << order) != 0) { … … 83 84 } 84 85 85 86 free(frames); 86 87 87 88 printf("Test passed\n"); -
test/mm/falloc2/test.c
rbd6e392 r1093620 30 30 #include <mm/page.h> 31 31 #include <mm/frame.h> 32 #include <mm/heap.h> 32 33 #include <arch/mm/page.h> 33 34 #include <arch/types.h> … … 37 38 #include <memstr.h> 38 39 39 #define MAX_FRAMES 12840 #define MAX_ORDER 240 #define MAX_FRAMES 256 41 #define MAX_ORDER 8 41 42 42 43 #define THREAD_RUNS 1 43 #define THREADS 644 #define THREADS 8 44 45 45 46 static void thread(void * arg); … … 54 55 index_t k; 55 56 56 __address frames[MAX_FRAMES];57 __address * frames = (__address *) malloc(MAX_FRAMES * sizeof(__address)); 57 58 58 59 for (run=0;run<THREAD_RUNS;run++) { … … 61 62 printf("Thread #%d: Allocating %d frames blocks ... \n",val, 1<<order); 62 63 allocated = 0; 63 for (i=0;i <MAX_FRAMES>>order;i++) {64 for (i=0;i < (MAX_FRAMES >> order);i++) { 64 65 frames[allocated] = frame_alloc(FRAME_NON_BLOCKING | FRAME_KA,order, &status); 65 66 if (status == 0) { … … 75 76 printf("Thread #%d: Deallocating ... \n", val); 76 77 for (i=0;i<allocated;i++) { 78 77 79 for (k=0;k<=((FRAME_SIZE << order) - 1);k++) { 78 80 if ( ((char *) frames[i])[k] != val ) { … … 82 84 83 85 } 84 86 85 87 frame_free(frames[i]); 86 88 }
Note:
See TracChangeset
for help on using the changeset viewer.