sched complete

This commit is contained in:
Jai Sharma Sharma 2024-10-01 00:10:13 +05:30
parent fc7925be3e
commit 785b4a63ac
1 changed files with 7 additions and 0 deletions

View File

@ -583,13 +583,20 @@ int main(int argc, char **argv) {
output_file << out_strings[i] << endl;
}
output_file.close();
float tot = 0;
int count = processes.size();
for(int i = 0; i < processes.size(); ++i) {
tot += processes[i].completion_time;
cout << "Process " << i+1 << " Completion Time: " << processes[i].completion_time << endl;
}
cout << "Average Completion Time: " << tot/count << endl;
tot = 0;
for(int i = 0; i < processes.size(); ++i) {
tot += processes[i].completion_time - processes[i].cpu_time;
cout << "Process " << i+1 << " Waiting Time: " << processes[i].completion_time - processes[i].cpu_time << endl;
// cout << "Process " << i+1 << " Waiting Time: " << processes[i].wait_time << endl;
}
cout << "Average Waiting Time: " << tot/count << endl;
std::cout << "Execution time: " << duration.count() << " ms" << std::endl;
return 0;