-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtestapp.c
58 lines (43 loc) · 1.12 KB
/
testapp.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <stdio.h>
#include "uapi_mm.h"
typedef struct emp_ {
char name[32];
uint32_t emp_id;
} emp_t;
typedef struct student_ {
char name[32];
uint32_t student_id;
uint32_t marks_phys;
uint32_t marks_chem;
uint32_t marks_math;
struct student_ *next;
} student_t;
int main(int argc, char** argv) {
int wait;
mm_init();
MM_REG_STRUCT(emp_t);
MM_REG_STRUCT(student_t);
mm_print_registered_page_families();
emp_t *emp1 = XCALLOC(1, emp_t);
emp_t *emp2 = XCALLOC(1, emp_t);
emp_t *emp3 = XCALLOC(1, emp_t);
student_t *stud1 = XCALLOC(1, student_t);
student_t *stud2 = XCALLOC(1, student_t);
printf(" \nSCENARIO 1 : *********** \n");
mm_print_memory_usage(0);
mm_print_block_usage();
scanf("%d", &wait);
XFREE(emp1);
XFREE(emp3);
XFREE(stud2);
printf(" \nSCENARIO 2 : *********** \n");
mm_print_memory_usage(0);
mm_print_block_usage();
scanf("%d", &wait);
XFREE(emp2);
XFREE(stud1);
printf(" \nSCENARIO 3 : *********** \n");
mm_print_memory_usage(0);
mm_print_block_usage();
return 0;
}