Skip to content

Commit f842cfe

Browse files
Display Number of Context Switches
1 parent 059c748 commit f842cfe

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

script.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,18 @@ function showFinalTable(input, output, outputDiv) {
551551
input.totalBurstTime.forEach((element) => (tbt += element));
552552
let lastct = 0;
553553
output.completionTime.forEach((element) => (lastct = Math.max(lastct, element)));
554+
554555
let cpu = document.createElement("p");
555556
cpu.innerHTML = "CPU Utilization : " + (tbt / lastct) * 100 + "%";
556557
outputDiv.appendChild(cpu);
558+
557559
let tp = document.createElement("p");
558560
tp.innerHTML = "Throughput : " + process / lastct;
559561
outputDiv.appendChild(tp);
562+
563+
let cs = document.createElement("p");
564+
cs.innerHTML = "Number of Context Switches : " + (output.contextSwitches - 1);
565+
outputDiv.appendChild(cs);
560566
}
561567

562568
function toggleTimeLogArrowColor(timeLog, color) {

0 commit comments

Comments
 (0)