-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeter-information.html
406 lines (390 loc) · 16.2 KB
/
meter-information.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
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/bootstrap-select.min.css">
<link rel="stylesheet" href="css/navbar.css">
<style>
.media-left img {
height: 80px;
}
.media-body {
padding-left: 25px;
}
.media-body p {
font-size: 18px;
color: gray;
margin-top: 10px;
}
.media-heading {
margin-top: 10px;
font-size: 22px;
}
#chart1,
#chart2,
#chart3 {
height: 500px;
width: 80%;
margin: 0 auto;
margin-top: 30px;
}
</style>
<script src="js/jquery-1.9.1.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/echarts.min.js"></script>
<script src="js/bootstrap-select.min.js"></script>
<script src="js/defaults-zh_CN.min.js"></script>
<script type="text/javascript">
var getParam = function () {
/**
* 获取参数的键值对对象。
*/
try {
let url = window.location.href;
let result = url.split("?")[1];
let keyValue = result.split("&");
let obj = decodeURI(keyValue[0].split("=")[1]);
return obj;
} catch (e) {
console.warn("There has no param value!");
}
};
function drawLinechart(date, datas) {
let option = {
title: {
text: '实例性能随时间变化图',
left: '33%'
},
tooltip: {},
legend: {
data: ['时间']
},
xAxis: {
data: date
},
yAxis: {
},
series: [{
name: '性能分数',
type: 'line',
data: datas
}]
};
//初始化echarts实例
let myChart = echarts.init(document.getElementById('chart1'));
//使用制定的配置项和数据显示图表
myChart.setOption(option);
$(window).resize(myChart.resize);
}
function drawBarchart(region, datas) {
var option = {
title: {
text: '实例不同地域性能对比',
left: '33%'
},
color: ['#3398DB'],
tooltip: {
trigger: 'axis',
axisPointer: { // 坐标轴指示器,坐标轴触发有效
type: 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis: [
{
type: 'category',
data: region,
axisTick: {
alignWithLabel: true
}
}
],
yAxis: [
{
type: 'value'
}
],
series: [
{
name: '性能分数',
type: 'bar',
barWidth: '40%',
data: datas
}
]
};
//初始化echarts实例
var myChart = echarts.init(document.getElementById('chart2'));
//使用制定的配置项和数据显示图表
myChart.setOption(option);
$(window).resize(myChart.resize);
}
function drawRadar(datas) {
var option = {
title: {
text: '实例各类指标性能',
left: '36%'
},
tooltip: {},
legend: {
data: '实例性能'
},
radar: {
// shape: 'circle',
name: {
textStyle: {
color: '#fff',
backgroundColor: '#999',
borderRadius: 3,
padding: [3, 5]
}
},
indicator: [
{ name: '总分数', max: 600 },
{ name: '启动时间(ms)', max: 15 },
{ name: 'CPU性能分数', max: 150 },
{ name: '内存性能分数', max: 150 },
{ name: '磁盘性能分数', max: 150 },
{ name: '网络性能分数', max: 150 }
]
},
series: [{
name: '实例性能',
type: 'radar',
// areaStyle: {normal: {}},
data: [{
value: datas,
name: '实例性能'
}]
}]
};
//初始化echarts实例
var myChart = echarts.init(document.getElementById('chart3'));
//使用制定的配置项和数据显示图表
myChart.setOption(option);
$(window).resize(myChart.resize);
}
var instanceId = getParam();
var datas = [];
$.ajax({
url: "json/meters.json", //json文件位置
type: "GET", //请求方式为get
dataType: "json", //返回数据格式为json
success: function (data) {
data.forEach(function (item) {
let now = {};
now["date"] = item.date;
item.datas.forEach(function (t) {
if (t.instanceId == instanceId) {
now = Object.assign(now, t);
}
});
datas.push(now);
});
let select = document.getElementsByTagName("select")[0];
datas.forEach(function (value, index) {
if (index == 0) {
select.innerHTML += "<option selected=\"selected\" value=\"" + value.date + "\">" + value.date + "</option>";
} else {
select.innerHTML += "<option value=\"" + value.date + "\">" + value.date + "</option>";
}
});
let img = document.getElementsByClassName("media-left")[0];
if (datas[0].factory == "阿里云") {
img.innerHTML = "<img src=\"img/ali.png\">";
} else if (datas[0].factory == "腾讯云") {
img.innerHTML = "<img src=\"img/ten.png\">";
} else {
img.innerHTML = "<img src=\"img/ucl.png\">";
}
document.getElementsByClassName("media-heading")[0].innerHTML = instanceId;
document.getElementById("media-body-text").innerHTML = datas[0].config;
let param1 = [], param2 = [];
datas.forEach(function (value) {
param1.push(value.date);
param2.push(value.total);
});
drawLinechart(param1.reverse(), param2.reverse());
param1 = []; param2 = [];
for (let i = 0; i < 4 && i < datas.length; i++) {
param1.push(datas[i].region);
param2.push(datas[i].total);
}
drawBarchart(param1.reverse(), param2.reverse());
param1 = [];
param1.push(datas[0].total, parseFloat(datas[0].open.substr(0, datas[0].open.length-1)), datas[0].cpu,
datas[0].memory, datas[0].io, datas[0].network);
drawRadar(param1);
}
});
function changeChart(obj) {
let index = obj.selectedIndex;
let param1 = [];
param1.push(datas[index].total, parseFloat(datas[index].open.substr(0, datas[index].open.length-1)), datas[index].cpu,
datas[index].memory, datas[index].io, datas[index].network);
drawRadar(param1);
}
</script>
</head>
<body>
<div class="navbar navbar-fixed-top">
<div class="container">
<!-- Collapsed navigation -->
<div class="navbar-header">
<!-- Expander button -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<!-- Main title -->
<a class="navbar-brand" href="index.html">云服务推荐</a>
</div>
<!-- Expanded navigation -->
<div class="navbar-collapse collapse">
<!-- Main navigation -->
<ul class="nav navbar-nav">
<li class="active">
<a href="index.html">Home</a>
</li>
<li class="dropdown">
<a href="documents.html">评分规则</a>
</li>
<li>
<a href="bench.html">云服务评测</a>
</li>
<li>
<a href="ml.html">机器学习推荐</a>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">About <b class="caret"></b></a>
<ul class="dropdown-menu">
<li>
<a href="#">Contact</a>
</li>
<li>
<a href="#">Contributing</a>
</li>
<li>
<a href="#">Team</a>
</li>
</ul>
</li>
</ul>
<!-- Search, Navigation and Repo links -->
<ul class="nav navbar-nav navbar-right">
<li>
<a href="#" data-toggle="modal" data-target="#">
<i class="fa fa-search"></i> Search
</a>
</li>
<li>
<a href="#">
<i class="fa fa-github"></i>
GitHub
</a>
</li>
</ul>
</div>
</div>
</div>
<div class="container">
<div class="media">
<div class="media-left"></div>
<div class="media-body">
<h4 class="media-heading"></h4>
<p id="media-body-text"></p>
</div>
</div>
</div>
<div class="container">
<div id="chart1"></div>
<div id="chart2"></div>
<span style="font-size: 17px; margin-right: 10px;">评测时间:</span>
<select id="time" class="selectpicker" data-actions-box="true" onchange="changeChart(this)">
</select>
</div>
<div id="chart3"></div>
</div>
<!--modal-->
<div class="modal fade" id="addModal" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">
×
</button>
<h4 class="modal-title" id="myModalLabel">机器学习推荐</h4>
</div>
<div class="modal-body">
<form role="form" action="javascript:void(0)">
<span style="margin-left: 20px">任务程序:</span>
<input id="file" type="file" class="form-control"
style="width: 220px; display: inline-block; margin-top: 10px; margin-bottom: 10px">
<br />
<span style="margin-left: 20px; margin-right: 13px">执行命令:</span>
<input id="command" type="text" class="form-control"
style="width: 220px; display: inline-block; margin-top: 10px; margin-bottom: 10px">
<br />
<span style="margin-left: 20px; margin-right: 13px">实例规格:</span>
<select id="kind" class="selectpicker" data-size="6" multiple data-actions-box="true">
<option value="ecs.g5.large">ecs.g5.large</option>
<option value="ecs.g5.xlarge">ecs.g5.xlarge</option>
<option value="ecs.g5.2xlarge">ecs.g5.2xlarge</option>
<option value="ecs.g5.3xlarge">ecs.g5.3xlarge</option>
<option value="ecs.c5.large">ecs.c5.large</option>
<option value="ecs.c5.xlarge">ecs.c5.xlarge</option>
<option value="ecs.c5.2xlarge">ecs.c5.2xlarge</option>
<option value="ecs.c5.3xlarge">ecs.c5.3xlarge</option>
<option value="ecs.r5.large">ecs.r5.large</option>
<option value="ecs.r5.xlarge">ecs.r5.xlarge</option>
<option value="ecs.r5.2xlarge">ecs.r5.2xlarge</option>
<option value="ecs.r5.3xlarge">ecs.r5.3xlarge</option>
<option value="ecs.d1ne.2xlarge">ecs.d1ne.2xlarge</option>
<option value="ecs.i2g.2xlarge">ecs.i2g.2xlarge</option>
<option value="ecs.i2.xlarge">ecs.i2.xlarge</option>
<option value="ecs.i2.2xlarge">ecs.i2.2xlarge</option>
<option value="ecs.hfg5.large">ecs.hfg5.large</option>
<option value="ecs.hfg5.xlarge">ecs.hfg5.xlarge</option>
<option value="ecs.hfg5.2xlarge">ecs.hfg5.2xlarge</option>
<option value="ecs.hfg5.3xlarge">ecs.hfg5.3xlarge</option>
<option value="ecs.hfc5.large">ecs.hfc5.large</option>
<option value="ecs.hfc5.xlarge">ecs.hfc5.xlarge</option>
<option value="ecs.hfc5.2xlarge">ecs.hfc5.2xlarge</option>
<option value="ecs.hfc5.3xlarge">ecs.hfc5.3xlarge</option>
</select>
<br />
<span style="margin-left: 20px; margin-right: 13px">性能成本目标:</span>
<select id="supplier" class="selectpicker">
<option value="1">性能最好</option>
<option value="2">成本最低</option>
<option value="3">其他</option>
</select>
<br />
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" data-dismiss="modal" id="addRecord"
onclick="alert('请在我的评测中查看结果'); ">提交</button>
</div>
</div>
</div>
</div>
<footer style="margin-bottom: 5px;">
<hr>
<center>© Unias Team, SEI, PKU</center>
<center>Documentation built with <a href="http://www.mkdocs.org/">MkDocs</a>.</center>
</footer>
</body>
</html>