-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
313 lines (292 loc) · 19 KB
/
index.html
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<title>프로세스 스케쥴링 시뮬레이터</title>
<script src="js/jquery.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="js/process.js"></script>
<script src="js/core.js"></script>
<script src="js/p_core.js"></script>
<script src="js/e_core.js"></script>
<script src="js/ready_queue.js"></script>
<script src="js/heapq.js"></script>
<script src="js/fcfs_ready_queue.js"></script>
<script src="js/spn_ready_queue.js"></script>
<script src="js/srtn_ready_queue.js"></script>
<script src="js/hrrn_ready_queue.js"></script>
<script src="js/upn_ready_queue.js"></script>
<script src="js/eaupn_ready_queue.js"></script>
<script src="js/scheduler.js"></script>
<script src="js/fcfs_schduler.js"></script>
<script src="js/rr_schduler.js"></script>
<script src="js/spn_scheduler.js"></script>
<script src ="js/srtn_scheduler.js"></script>
<script src="js/hrrn_scheduler.js"></script>
<script src="js/yosa_bf_scheduler.js"></script>
<script src="js/upn_scheduler.js"></script>
<script src="js/eaupn_scheduler.js"></script>
<script src="js/vue.min.js"></script>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="css/main_frame.css">
<link rel="stylesheet" href="css/header.css">
<link rel="stylesheet" href="css/middle_left.css">
<link rel="stylesheet" href="css/middle_right.css">
<link rel="stylesheet" href="css/bottom_ready_queue.css">
<link rel="stylesheet" href="css/bottom_gantte_chart.css">
<link rel="stylesheet" href="css/bottom_result.css">
<link rel="stylesheet" href="css/sample_btn.css">
<link rel ="shortcut icon" type="image/x-icon" href="img/favicon.ico">
<style>
/* div
{
border: 1px solid black;
} */
#app
{
border: 3px solid black;
}
</style>
</head>
<body>
<a class="btn btn-primary btn-sm" onclick="sample1()" id="sample1">sample1</a>
<a class="btn btn-primary btn-sm" onclick="sample2()" id="sample2">sample2</a>
<a class="btn btn-primary btn-sm" onclick="sample3()" id="sample3">sample3</a>
<a class="btn btn-primary btn-sm" onclick="sample4()" id="sample4">sample4</a>
<a class="btn btn-primary btn-sm" onclick="sample5()" id="sample5">sample5</a>
<a class="btn btn-primary btn-sm" onclick="sample6()" id="sample6">sample6</a>
<a class="btn btn-primary btn-sm" onclick="sample7()" id="sample7">sample7</a>
<a class="btn btn-primary btn-sm" onclick="sample8()" id="sample8">Random Sample</a>
<div id="app">
<!-- header부분(start버튼, reset버튼, 알고리즘 선택, 퀀텀 타임, 토탈 코어, p코어 개수를 선택) -->
<div id="header">
<!-- start버튼 -->
<button type="button" class="btn" id="btn_program_start" @click="start_btn_clicked" :class="program_state_class">
{{ program_state }}
</button>
<!-- reset버튼 -->
<button type="button" class="btn btn-danger" id="btn_program_reset" @click="reset" :disabled="running != 2">RESET</button>
<!-- p코어 개수 -->
<form class="form-floating" id="p_cores_form">
<input type="number" class="form-control" id="p_cores" v-model="p_cores" min="0" :max="total_cores" :disabled="running != 0 && running != 3"/>
<label for="p_cores">P Cores</label>
</form>
<!-- 토탈 코어 개수 -->
<form class="form-floating" id="total_cores_form">
<input type="number" class="form-control" id="total_cores" v-model="total_cores" :min="Math.max(p_cores, 1)" :disabled="running != 0 && running != 3"/>
<label for="total_cores">Total Cores</label>
</form>
<!-- 퀀텀타임 -->
<form class="form-floating" id="quantum_time_form">
<input type="number" class="form-control" id="quantum_time_cores" v-model="quantum_time" :disabled="algorithm != 'RR' || (running != 0 && running != 3)" min="1"/>
<label for="quantum_time_cores">Quantum Time</label>
</form>
<!-- 알고리즘 선택 -->
<div class="form-floating" id="algorithm_div">
<select class="form-select" id="algorithm_floatingSelect" v-model="algorithm" :disabled="running != 0 && running != 3">
<option value="FCFS">FCFS</option>
<option value="RR">RR</option>
<option value="SPN">SPN</option>
<option value="SRTN">SRTN</option>
<option value="HRRN">HRRN</option>
<option value="YOSA_UPN">UPN</option>
<option value="YOSA_EAUPN">EAUPN</option>
</select>
<label for="algorithm_floatingSelect">Algorithm</label>
</div>
<!-- 인터벌 간격 -->
<form class="form-floating" id="interval_term_form">
<input type="number" class="form-control" id="interval_term" v-model="interval_term" min="0" max="1000" step="250" :disabled="running == 1"/>
<label for="interval_term_cores">Interval</label>
</form>
<!-- 우선 코어 선택-->
<button type="button" class="btn btn-secondary" id="first_core_div" @click="is_p_core_first = !is_p_core_first" :disabled="(running != 0 && running != 3) || algorithm=='YOSA_EAUPN' ">{{is_p_core_first? "P First" : "E First"}}</button>
</div>
<!-- middle부분(도착시간, 실행시간, 프로세스 스케쥴링 테이블) -->
<div id="middle">
<div id="middle-left">
<!-- 데드라인 -->
<form class="form-floating" id="deadline_form">
<input type="number" class="form-control" id="deadline" v-model="deadline" :disabled="running != 0 && running != 3 || !(algorithm.startsWith('YOSA') )" min="1" @keyup.enter.prevent="process_add" />
<label for="deadline">Deadline</label>
</form>
<!-- 도착시간 -->
<form class="form-floating" id="arrive_time_form">
<input type="number" class="form-control" id="arrive_time" v-model="arrival_time" min="0" :disabled="running != 0 && running != 3" @keyup.enter.prevent="process_add"/>
<label for="arrive_time">Arrival Time</label>
</form>
<!-- 실행시간 -->
<form class="form-floating" id="burst_time_form">
<input type="number" class="form-control" id="burst_time" v-model="burst_time" min="1" :disabled="running != 0 && running != 3" @keyup.enter.prevent="process_add"/>
<label for="burst_time">Burst Time</label>
</form>
<button type="button" class="btn btn-dark" id="process_add_btn" @click="process_add" :disabled="running != 0 && running != 3">Add Process</button>
</div>
<!-- 프로세스 스케쥴링 테이블 -->
<div id="middle-right">
<table class="table table-light" id="process_schedule_table">
<thead>
<tr>
<th class="col-3">Process Name</th>
<th class="col-3">Arrival Time</th>
<th class="col-3">Burst Time</th>
<th v-if="algorithm.startsWith('YOSA')"class="col-2">Deadline</th>
<th class="col-1">
<button id="process_table_remove_btn" type="button" class="btn btn-danger" @click="only_table_reset" :disabled="running != 0 && running != 3">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-counterclockwise" viewBox="0 0 16 16">
<path fill-rule="evenodd" d="M8 3a5 5 0 1 1-4.546 2.914.5.5 0 0 0-.908-.417A6 6 0 1 0 8 2v1z"/>
<path d="M8 4.466V.534a.25.25 0 0 0-.41-.192L5.23 2.308a.25.25 0 0 0 0 .384l2.36 1.966A.25.25 0 0 0 8 4.466z"/>
</svg>
</button>
</th>
</tr>
</thead>
<tbody>
<tr v-for="(process, index) in processes">
<td :style="{backgroundColor: process.color, color:process.complement_color}">{{process.name}}</td>
<td>{{process.arrival_time}}</td>
<td>{{process.burst_time}}</td>
<td v-if="algorithm.startsWith('YOSA')">{{process.deadline}}</td>
<td>
<button type="button" class="btn btn-secondary" @click="process_table_process_remove(index)" :disabled="running != 0 && running != 3">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-x-circle" viewBox="0 0 16 16">
<path d="M8 15A7 7 0 1 1 8 1a7 7 0 0 1 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
</svg>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<!-- bottom부분(타임슬라이드, 레디큐, 칸트차트, 결과테이블을 출력한다.) -->
<!-- bottom부분 -->
<div id="bottom">
<!-- 타임슬라이드 -->
<div id="bottom-ready-queue">
<div id="time-slider">
<label for="cpu-time" class="form-label"><strong>Time : {{time}}</strong></label>
<input type="range" class="form-range" min="0" :max="max_time" id="cpu-time" v-model="time" :disabled="running == 1">
<!-- 레디큐 --></div>
<div id="ready-queue">
<p><strong><Ready Queue></strong></p>
<div v-if="scheduler && scheduler.ready_queue" v-for="process in scheduler.ready_queue.snapshot(Number(time),Number(max_time))" class="process_in_queue"
:style="{backgroundColor: process.color, color:process.complement_color}">
<span>{{process.name}}</span>
</div>
</div>
</div>
<!-- 간트차트 -->
<div id="bottom-gantt-chart">
<table class="table">
<thead>
<tr>
<th scope="col" class="sticky_column" style="z-index: 10; border-right:1px solid black;padding:0; position: sticky; top:0;background-color: aliceblue;">Time(sec)</th>
<th v-for="i in (Number(time)+1)" scope="col" style="border-right:1px solid black;padding:0; position: sticky; top:0;background-color: aliceblue;">{{i-1}} </th>
</tr>
</thead>
<tbody>
<tr v-if="is_p_core_first" v-for="i in Number(p_cores)">
<th scope="row" class="sticky_column" style="background-color: aliceblue;">Core{{i-1}}{P}</th>
<td v-for="(proc, index) in cores[i-1].processed_list_until_time(Number(time), Number(max_time))" :colspan="proc.processed_time" :style="{backgroundColor: proc.process_color, color:proc.process_complement_color}">
{{proc.process_name}}
</td>
<td>
{{cores[i-1].total_power_consumption.toFixed(1)}}W
</td>
<td v-if="Number(p_cores) && i == 1" :rowspan="cores.length">
</td>
</tr>
<tr v-if="is_p_core_first" v-for="i in Number(total_cores) -Number(p_cores)" >
<th scope="row" class="sticky_column" style="background-color: aliceblue;">Core{{i-1 + Number(p_cores)}}{E}</th>
<td v-for="proc in cores[i-1+Number(p_cores)].processed_list_until_time(Number(time), Number(max_time))" :colspan="proc.processed_time" :style="{backgroundColor: proc.process_color, color:proc.process_complement_color}">
{{proc.process_name}}
</td>
<td>
{{cores[i-1+Number(p_cores)].total_power_consumption.toFixed(1)}}W
</td>
<td v-if="Number(p_cores) == 0 && i == 1" :rowspan="cores.length">
</td>
</tr>
<tr v-if="!is_p_core_first" v-for="i in Number(total_cores) -Number(p_cores)">
<th scope="row" class="sticky_column" style="background-color: aliceblue;">Core{{i-1}}{E}</th>
<td v-for="(proc, index) in cores[i-1].processed_list_until_time(Number(time), Number(max_time))" :colspan="proc.processed_time" :style="{backgroundColor: proc.process_color, color:proc.process_complement_color}">
{{proc.process_name}}
</td>
<td>
{{cores[i-1].total_power_consumption.toFixed(1)}}W
</td>
<td v-if="(Number(total_cores) -Number(p_cores)) && i == 1" :rowspan="cores.length">
</td>
</tr>
<tr v-if="!is_p_core_first" v-for="i in Number(p_cores)" >
<th scope="row" class="sticky_column" style="background-color: aliceblue;">Core{{i-1 + Number(total_cores) -Number(p_cores)}}{P}</th>
<td v-for="proc in cores[i-1+Number(total_cores) -Number(p_cores)].processed_list_until_time(Number(time), Number(max_time))" :colspan="proc.processed_time" :style="{backgroundColor: proc.process_color, color:proc.process_complement_color}">
{{proc.process_name}}
</td>
<td>
{{cores[i-1+Number(total_cores) -Number(p_cores)].total_power_consumption.toFixed(1)}}W
</td>
<td v-if="(Number(total_cores) -Number(p_cores))==0 && i == 1" :rowspan="cores.length">
</td>
</tr>
</tbody>
</table>
</div>
<!-- 결과테이블 -->
<!-- 프로세스 결과창이 나오는 테이블 -->
<div id="bottom-result-table">
<table class="table table-light" id="result_table">
<thead>
<tr>
<th>Process Name</th>
<th>Arrival Time(AT)</th>
<th>Burst Time(BT)</th>
<th>Waiting Time(WT)</th>
<th>Turnaround Time(TT)</th>
<th>Normalized TT(NTT)</th>
<th>Power Consumption</th>
<th v-if="algorithm.startsWith('YOSA')">DeadLine Over</th>
</tr>
</thead>
<tbody>
<tr v-for="process in processes">
<td :style="{backgroundColor: process.color, color:process.complement_color}">{{process.name}}</td>
<td>{{process.arrival_time}}</td>
<td>{{process.burst_time}}</td>
<td>{{process.turnaround_time != -1? process.waiting_time : '-'}}</td>
<td>{{process.turnaround_time != -1? process.turnaround_time : '-'}}</td>
<td>{{process.turnaround_time != -1? (process.turnaround_time / process.burst_time).toFixed(3) : '-'}}</td>
<td>{{process.power_consumption}}</td>
<td v-if="algorithm.startsWith('YOSA')">{{process.dead_exceed_amount}}</td>
</tr>
<tr>
<td style="color: black;">Total Power Consumption</td>
<td colspan="7" style="color: black;">{{total_cores_power_consumption.toFixed(1)}}W</td>
</tr>
<tr v-if="algorithm.startsWith('YOSA')">
<td style="color: black;">Deadline Over Sum</td>
<td colspan="7" style="color: black;">{{dead_sum}}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
<script src="js/main.js"></script>
<script src="js/sample/sample1.js"></script>
<script src="js/sample/sample2.js"></script>
<script src="js/sample/sample3.js"></script>
<script src="js/sample/sample4.js"></script>
<script src="js/sample/sample5.js"></script>
<script src="js/sample/sample6.js"></script>
<script src="js/sample/sample7.js"></script>
<script src="js/sample/sample8.js"></script>
<script src="js/sample/smaple_btn_click.js"></script>
</html>