-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
80 lines (52 loc) · 1.58 KB
/
main.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h> /* clock_t, clock() */
#include <sys/syscall.h> /* syscall() */
#include "aim7.h"
#define GET_TICK(target_function) start=clock(); target_function(); end=clock();
int main (int agrc, char *argv[]) {
clock_t start, end; /* unsigned long */
unsigned long sum;
double avg;
int i;
pid_t parent_tid, tid;
sum = 0;
init_num_fcns_c();
init_pipe_test_c();
parent_tid = syscall(SYS_gettid);
/*****************************************************************************/
/*****************************************************************************/
sum = 0;
for (i = 0; i < 100 ; i ++) {
start = clock();
syscall(SYS_clone);
end = clock();
tid = syscall(SYS_gettid);
if (tid != parent_tid || tid == -1)
exit(1);
sum += (end-start);
}
avg = sum/100;
printf("Average Ticks: %.2lf ticks\n", avg);
syscall(SYS_fork);
/*****************************************************************************/
/*
sum = 0;
for (i = 0 ; i < 100 ; i ++) {
GET_TICK(disk_src);
sum += (end-start);
}
avg = sum/100;
printf("Average Ticks: %.2lf ticks\n", avg);
*/
/*****************************************************************************/
/*
char dummy[1000];
sprintf(dummy, "AIM_MKTEMP_TESTXXXXXXXXXX");
aim_mktemp(dummy);
creat_clo();
*/
return 0;
}