Fix hashrate bug and add stats by algorithm to index and stats pages

This commit is contained in:
Jerry Brady 2014-04-04 02:55:35 +00:00
parent 795b93e254
commit 71024f18dc
3 changed files with 34 additions and 11 deletions

View File

@ -135,8 +135,7 @@ module.exports = function(logger, portalConfig, poolConfigs){
}); });
var shareMultiplier = algos[coinStats.algorithm].multiplier || 0; var shareMultiplier = algos[coinStats.algorithm].multiplier || 0;
var hashratePre = shareMultiplier * coinStats.shares / portalConfig.website.hashrateWindow; var hashratePre = shareMultiplier * coinStats.shares / portalConfig.website.hashrateWindow;
coinStats.hashrate = hashratePre / 1e3 | 0; coinStats.hashrate = hashratePre | 0;
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 */ /* algorithm specific global stats */

View File

@ -50,10 +50,12 @@
</li> </li>
</ul> </ul>
<div class="stats"> {{ for(var algo in it.stats.algos) { }}
<div><i class="fa fa-users"></i>&nbsp;<span id="statsMiners">{{=it.stats.global.workers}}</span> Miners</div> {{=algo}}: <div class="stats">
<div><i class="fa fa-tachometer"></i>&nbsp;<span id="statsHashrate">{{=it.stats.global.hashrate}}</span> KH/s</div> <div><i class="fa fa-users"></i>&nbsp;<span id="statsMiners{{=algo}}">{{=it.stats.algos[algo].workers}}</span> Miners</div>
</div> <div><i class="fa fa-tachometer"></i>&nbsp;<span id="statsHashrate{{=algo}}">{{=it.stats.algos[algo].hashrateString}}</span></div>
</div>&nbsp;
{{ } }}
</div> </div>
</header> </header>
@ -86,4 +88,4 @@
</body> </body>
</html> </html>

View File

@ -1,5 +1,27 @@
<div> <div>
fancy graphs here <table class="pure-table">
<br> <thead>
{{=JSON.stringify(it.stats)}} <tr>
</div> <th>Pool</th>
<th>Algo</th>
<th>Workers</th>
<th>Valid Shares</th>
<th>Invalid Shares</th>
<th>Blocks</th>
<th>Hashrate</th>
</tr>
</tr>
</thead>
{{ for(var pool in it.stats.pools) { }}
<tr class="pure-table-odd">
<td>{{=it.stats.pools[pool].name}}</td>
<td>{{=it.stats.pools[pool].algorithm}}</td>
<td>{{=Object.keys(it.stats.pools[pool].workers).length}}</td>
<td>{{=it.stats.pools[pool].poolStats.validShares}}</td>
<td>{{=it.stats.pools[pool].poolStats.invalidShares}}</td>
<td>{{=it.stats.pools[pool].poolStats.validBlocks}}</td>
<td>{{=it.stats.pools[pool].hashrateString}}</div>
</tr>
{{ } }}
</table>
</div>