added print_processes function
This commit is contained in:
parent
d843d4d068
commit
35cf8505c9
14
simulator.c
14
simulator.c
@ -42,10 +42,19 @@ void print_pinfo(struct pinfo * info) {
|
||||
printf(" Arrival time: %d\n", info->arrival_time);
|
||||
printf(" Execution time: %d\n", info->execution_time);
|
||||
printf(" Priority: %d\n", info->priority);
|
||||
printf(" Wait time: %d\n", info->wait_time);
|
||||
printf(" Completion time: %d\n", info->completion_time);
|
||||
printf(" NEXT -> %p\n", info->next_pinfo);
|
||||
printf("}>\n");
|
||||
}
|
||||
|
||||
void print_processes(struct pinfo * processes) {
|
||||
while (processes != NULL) {
|
||||
print_pinfo(processes);
|
||||
processes = processes->next_pinfo;
|
||||
}
|
||||
}
|
||||
|
||||
struct pinfo * create_process(int id, int arrival_time, int execution_time, int priority) {
|
||||
struct pinfo * info = malloc(sizeof(struct pinfo));
|
||||
info->id = id;
|
||||
@ -142,10 +151,11 @@ void free_processes(struct pinfo * next) {
|
||||
int main() {
|
||||
struct pinfo * processes = read_file();
|
||||
|
||||
//struct perf_info perf = schedule_FCFS(processes);
|
||||
struct perf_info perf = schedule_FCFS(processes);
|
||||
|
||||
//write_file(processes, &perf);
|
||||
//print_perf(&perf);
|
||||
print_processes(processes);
|
||||
print_perf(&perf);
|
||||
|
||||
free_processes(processes);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user