Added stats grouped by algorithm
This commit is contained in:
parent
d65a1ab004
commit
ba1836b605
@ -14,13 +14,6 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
|
|
||||||
var redisClients = [];
|
var redisClients = [];
|
||||||
|
|
||||||
/*var algoMultipliers = {
|
|
||||||
'x11': Math.pow(2, 16),
|
|
||||||
'scrypt': Math.pow(2, 16),
|
|
||||||
'scrypt-jane': Math.pow(2,16),
|
|
||||||
'sha256': Math.pow(2, 32)
|
|
||||||
};*/
|
|
||||||
|
|
||||||
var canDoStats = true;
|
var canDoStats = true;
|
||||||
|
|
||||||
Object.keys(poolConfigs).forEach(function(coin){
|
Object.keys(poolConfigs).forEach(function(coin){
|
||||||
@ -55,7 +48,6 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
this.stats = {};
|
this.stats = {};
|
||||||
this.statsString = '';
|
this.statsString = '';
|
||||||
|
|
||||||
|
|
||||||
this.getGlobalStats = function(callback){
|
this.getGlobalStats = function(callback){
|
||||||
|
|
||||||
var allCoinStats = {};
|
var allCoinStats = {};
|
||||||
@ -76,6 +68,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
|
|
||||||
var commandsPerCoin = redisComamndTemplates.length;
|
var commandsPerCoin = redisComamndTemplates.length;
|
||||||
|
|
||||||
|
|
||||||
client.coins.map(function(coin){
|
client.coins.map(function(coin){
|
||||||
redisComamndTemplates.map(function(t){
|
redisComamndTemplates.map(function(t){
|
||||||
var clonedTemplates = t.slice(0);
|
var clonedTemplates = t.slice(0);
|
||||||
@ -84,6 +77,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
client.client.multi(redisCommands).exec(function(err, replies){
|
client.client.multi(redisCommands).exec(function(err, replies){
|
||||||
if (err){
|
if (err){
|
||||||
console.log('error with getting hashrate stats ' + JSON.stringify(err));
|
console.log('error with getting hashrate stats ' + JSON.stringify(err));
|
||||||
@ -121,6 +115,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
workers: 0,
|
workers: 0,
|
||||||
hashrate: 0
|
hashrate: 0
|
||||||
},
|
},
|
||||||
|
algos: {},
|
||||||
pools: allCoinStats
|
pools: allCoinStats
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,6 +138,18 @@ module.exports = function(logger, portalConfig, poolConfigs){
|
|||||||
coinStats.hashrate = hashratePre / 1e3 | 0;
|
coinStats.hashrate = hashratePre / 1e3 | 0;
|
||||||
portalStats.global.hashrate += coinStats.hashrate;
|
portalStats.global.hashrate += coinStats.hashrate;
|
||||||
portalStats.global.workers += Object.keys(coinStats.workers).length;
|
portalStats.global.workers += Object.keys(coinStats.workers).length;
|
||||||
|
|
||||||
|
/* algorithm specific global stats */
|
||||||
|
var algo = coinStats.algorithm;
|
||||||
|
if (!portalStats.algos.hasOwnProperty(algo)){
|
||||||
|
portalStats.algos[algo] = {
|
||||||
|
workers: 0,
|
||||||
|
hashrate: 0
|
||||||
|
};
|
||||||
|
}
|
||||||
|
portalStats.algos[algo].hashrate += coinStats.hashrate;
|
||||||
|
portalStats.algos[algo].workers += Object.keys(coinStats.workers).length;
|
||||||
|
|
||||||
delete coinStats.hashrates;
|
delete coinStats.hashrates;
|
||||||
delete coinStats.shares;
|
delete coinStats.shares;
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user