-
Notifications
You must be signed in to change notification settings - Fork 0
/
time.c
39 lines (31 loc) · 787 Bytes
/
time.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
/*
time function call which tests waitx for any command to be executed
*/
#include "types.h"
#include "stat.h"
#include "user.h"
int main(int argc,char **argv){
if(argc < 2){
printf(1,"time : no arguments provided\n");
exit();
}
int proc = fork();
if(proc==0)
exec(argv[1],argv + 1);
else{
int *wtime = (int *)malloc(sizeof(int));
int *rtime = (int *)malloc(sizeof(int));
waitx(wtime,rtime);
printf(1,"Wait time (wtime) : %d ticks \nExecution time (rtime) : %d ticks\n",*wtime,*rtime);
}
#ifdef ORIGINAL
printf(1,"Scheduler : DEFAULT\n");
#endif
#ifdef PBS
printf(1,"Scheduler : PBS\n");
#endif
#ifdef FCFS
printf(1,"Scheduler : FCFS\n");
#endif
exit();
}