GOSTcoin support for ccminer CUDA miner project, compatible with most nvidia cards
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

122 lines
2.7 KiB

<!DOCTYPE HTML>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/modules/exporting.js"></script>
</head>
<body>
<div id="container" style="min-width: 310px; height: 400px; margin: 0 auto"></div>
<script type="text/javascript">
var hashrates = [];
var timestamps = [];
var timeline = [];
function drawChart(ip) {
$('#container').highcharts({
title: {
text: 'CCMiner WebSocket Sample - ' + ip,
x: -20 //center
},
subtitle: {
text: 'By tpruvot@gibhub 2014',
x: -20
},
xAxis: {
title: {
text: 'Age'
},
valueSuffix: ' s',
categories: timestamps[0]
},
yAxis: {
title: {
text: 'Hash Rate (KH/s)'
},
plotLines: [{
value: 0,
width: 1,
color: '#808080'
}]
},
tooltip: {
valueSuffix: ' KH'
},
legend: {
layout: 'vertical',
align: 'right',
verticalAlign: 'middle',
borderWidth: 0
},
series: [
{
name: 'GPU0',
data: hashrates[0]
}/*,
{
name: 'GPU1',
data: hashrates[1]
}*/
]
});
}
function getData(ip, port) {
if ("WebSocket" in window) {
var ws = new WebSocket('ws://'+ip+':'+port+'/histo','text');
for (var gpu=0; gpu<8; gpu++) {
timestamps[gpu] = [];
hashrates[gpu] = [];
}
ws.onmessage = function (evt) {
var now = new Date();
var ts = Math.round(now/1000);
var data = evt.data.split('|');
for (n in data) {
var map = data[n].split(';');
var gpu = 0;
var plot = {};
for (k in map) {
var kv = map[k].split('=');
if (kv.length == 1)
continue;
if (kv[0] === 'GPU')
gpu = parseInt(kv[1], 10);
else if (kv[0] === 'TS')
plot.timestamp = ts - parseInt(kv[1], 10);
else if (kv[0] === 'KHS')
plot.hashrate = parseInt(kv[1], 10) / 1000.0;
//console.log('Data received: #GPU'+gpu+': '+kv[0]+' = '+kv[1]);
}
timeline[n] = plot.timestamp;
timestamps[gpu][n] = plot.timestamp;
hashrates[gpu][n] = plot.hashrate;
}
drawChart(ip);
};
ws.onerror = function (evt) {
var w = evt.target;
console.log('Error! readyState=' + w.readyState); //log errors
$('#container').html('Error! Unable to get WebSocket data from '+ip); //log errors
return false;
};
ws.onclose = function() {
// websocket is closed.
};
} else {
// The browser doesn't support WebSocket
alert("WebSocket NOT supported by your Browser!");
}
}
$(function () {
//getData('192.168.0.110', 4068);
getData('localhost', 4068);
});
</script>
</body>
</html>