commit
3d07765ff6
@ -272,6 +272,32 @@ History.prototype.getGasSpending = function()
|
|||||||
return gasSpending;
|
return gasSpending;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
History.prototype.getAvgHashrate = function()
|
||||||
|
{
|
||||||
|
if(this._items.length === 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
var difficultyHistory = _(this._items)
|
||||||
|
.map(function(item)
|
||||||
|
{
|
||||||
|
return item.block.difficulty;
|
||||||
|
})
|
||||||
|
.value();
|
||||||
|
|
||||||
|
var avgDifficulty = _.sum(difficultyHistory)/difficultyHistory.length;
|
||||||
|
|
||||||
|
var blocktimeHistory = _(this._items)
|
||||||
|
.map(function(item)
|
||||||
|
{
|
||||||
|
return item.block.time;
|
||||||
|
})
|
||||||
|
.value();
|
||||||
|
|
||||||
|
var avgBlocktime = _.sum(blocktimeHistory)/blocktimeHistory.length;
|
||||||
|
|
||||||
|
return avgDifficulty/1000 * 12 * (12/avgBlocktime);
|
||||||
|
}
|
||||||
|
|
||||||
History.prototype.getCharts = function()
|
History.prototype.getCharts = function()
|
||||||
{
|
{
|
||||||
var chartHistory = _(this._items)
|
var chartHistory = _(this._items)
|
||||||
@ -295,12 +321,14 @@ History.prototype.getCharts = function()
|
|||||||
var chart = {
|
var chart = {
|
||||||
height: _.pluck(chartHistory, 'height'),
|
height: _.pluck(chartHistory, 'height'),
|
||||||
blocktime: _.pluck(chartHistory, 'blocktime'),
|
blocktime: _.pluck(chartHistory, 'blocktime'),
|
||||||
|
avgBlocktime: _.sum(_.pluck(chartHistory, 'blocktime')) / (chartHistory.length === 0 ? 1 : chartHistory.length),
|
||||||
difficulty: _.pluck(chartHistory, 'difficulty'),
|
difficulty: _.pluck(chartHistory, 'difficulty'),
|
||||||
uncles: _.pluck(chartHistory, 'uncles'),
|
uncles: _.pluck(chartHistory, 'uncles'),
|
||||||
transactions: _.pluck(chartHistory, 'transactions'),
|
transactions: _.pluck(chartHistory, 'transactions'),
|
||||||
gasSpending: _.pluck(chartHistory, 'gasSpending'),
|
gasSpending: _.pluck(chartHistory, 'gasSpending'),
|
||||||
propagation: this.getBlockPropagation(),
|
propagation: this.getBlockPropagation(),
|
||||||
uncleCount: this.getUncleCount()
|
uncleCount: this.getUncleCount(),
|
||||||
|
avgHashrate: this.getAvgHashrate()
|
||||||
}
|
}
|
||||||
|
|
||||||
return chart;
|
return chart;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "eth-netstats",
|
"name": "eth-netstats",
|
||||||
"description": "Ethereum Network Intelligence dashboard",
|
"description": "Ethereum Network Intelligence dashboard",
|
||||||
"version": "0.0.5",
|
"version": "0.0.6",
|
||||||
"private": true,
|
"private": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": "0.12.0",
|
"node": "0.12.0",
|
||||||
|
@ -137,7 +137,8 @@ span.small-title span.small {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.big-info.chart .big-details {
|
.big-info.chart .big-details {
|
||||||
padding-top: 8px;
|
position: absolute;
|
||||||
|
top: 40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.big-info.chart {
|
.big-info.chart {
|
||||||
@ -202,7 +203,8 @@ span.small-title span.small {
|
|||||||
padding: 5px 15px;
|
padding: 5px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.second-row .box i {
|
.second-row .box i,
|
||||||
|
.big-info.chart i {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 2px;
|
top: 2px;
|
||||||
left: -3px;
|
left: -3px;
|
||||||
@ -213,13 +215,27 @@ span.small-title span.small {
|
|||||||
float: left;
|
float: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
.second-row .box .small-value {
|
.big-info.chart i {
|
||||||
|
font-size: 24px;
|
||||||
|
top: -2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.small-value {
|
||||||
font-weight: 300;
|
font-weight: 300;
|
||||||
-webkit-font-smoothing: subpixel-antialiased;
|
-webkit-font-smoothing: subpixel-antialiased;
|
||||||
-moz-osx-font-smoothing: auto;
|
-moz-osx-font-smoothing: auto;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.second-row .box .small-value {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.big-info .small-value {
|
||||||
|
position: absolute;
|
||||||
|
right: 14px;
|
||||||
|
top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
table i {
|
table i {
|
||||||
-webkit-font-smoothing: subpixel-antialiased;
|
-webkit-font-smoothing: subpixel-antialiased;
|
||||||
-moz-osx-font-smoothing: auto;
|
-moz-osx-font-smoothing: auto;
|
||||||
|
@ -14,6 +14,7 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
$scope.lastDifficulty = 0;
|
$scope.lastDifficulty = 0;
|
||||||
$scope.upTimeTotal = 0;
|
$scope.upTimeTotal = 0;
|
||||||
$scope.avgBlockTime = 0;
|
$scope.avgBlockTime = 0;
|
||||||
|
$scope.avgHashrate = 0;
|
||||||
$scope.uncleCount = 0;
|
$scope.uncleCount = 0;
|
||||||
$scope.bestStats = {};
|
$scope.bestStats = {};
|
||||||
|
|
||||||
@ -124,9 +125,12 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
data.stats.hashrate = 0;
|
data.stats.hashrate = 0;
|
||||||
|
|
||||||
var index = findIndex({id: data.id});
|
var index = findIndex({id: data.id});
|
||||||
|
|
||||||
|
if(typeof $scope.nodes[index].stats !== 'undefined') {
|
||||||
$scope.nodes[index].stats = data.stats;
|
$scope.nodes[index].stats = data.stats;
|
||||||
$scope.nodes[index].history = data.history;
|
$scope.nodes[index].history = data.history;
|
||||||
makePeerPropagationChart($scope.nodes[index]);
|
makePeerPropagationChart($scope.nodes[index]);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -150,6 +154,8 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
|
|
||||||
case "charts":
|
case "charts":
|
||||||
$scope.lastBlocksTime = data.blocktime;
|
$scope.lastBlocksTime = data.blocktime;
|
||||||
|
$scope.avgBlockTime = data.avgBlocktime;
|
||||||
|
$scope.avgHashrate = data.avgHashrate;
|
||||||
$scope.difficultyChart = data.difficulty;
|
$scope.difficultyChart = data.difficulty;
|
||||||
$scope.transactionDensity = data.transactions;
|
$scope.transactionDensity = data.transactions;
|
||||||
$scope.gasSpending = data.gasSpending;
|
$scope.gasSpending = data.gasSpending;
|
||||||
@ -174,6 +180,9 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "latency":
|
case "latency":
|
||||||
|
var node = $scope.nodes[findIndex({id: data.id})];
|
||||||
|
|
||||||
|
if(typeof node.stats !== 'undefined' && typeof node.stats.latency !== 'undefined')
|
||||||
$scope.nodes[findIndex({id: data.id})].stats.latency = data.latency;
|
$scope.nodes[findIndex({id: data.id})].stats.latency = data.latency;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -273,10 +282,6 @@ function StatsCtrl($scope, $filter, socket, _, toastr) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.avgBlockTime = _.max($scope.nodes, function(node) {
|
|
||||||
return parseInt(node.stats.block.number);
|
|
||||||
}).stats.blocktimeAvg;
|
|
||||||
|
|
||||||
$scope.upTimeTotal = _.reduce($scope.nodes, function(total, node) {
|
$scope.upTimeTotal = _.reduce($scope.nodes, function(total, node) {
|
||||||
return total + node.stats.uptime;
|
return total + node.stats.uptime;
|
||||||
}, 0) / $scope.nodes.length;
|
}, 0) / $scope.nodes.length;
|
||||||
|
@ -134,6 +134,9 @@ angular.module('netStatsApp.filters', [])
|
|||||||
})
|
})
|
||||||
.filter('hashFilter', function() {
|
.filter('hashFilter', function() {
|
||||||
return function(hash) {
|
return function(hash) {
|
||||||
|
if(typeof hash === 'undefined')
|
||||||
|
return "?";
|
||||||
|
|
||||||
if(hash.substr(0,2) === '0x')
|
if(hash.substr(0,2) === '0x')
|
||||||
hash = hash.substr(2,64);
|
hash = hash.substr(2,64);
|
||||||
|
|
||||||
|
@ -3,22 +3,6 @@ extends layout
|
|||||||
block content
|
block content
|
||||||
div.container-fluid(ng-controller='StatsCtrl')
|
div.container-fluid(ng-controller='StatsCtrl')
|
||||||
div.row(ng-cloak)
|
div.row(ng-cloak)
|
||||||
div.col-xs-2.stat-holder
|
|
||||||
div.big-info.nodesactive(class="{{ nodesActive | nodesActiveClass : nodesTotal }}")
|
|
||||||
div.pull-left.icon-full-width
|
|
||||||
i.icon-node
|
|
||||||
div.pull-left
|
|
||||||
span.small-title active nodes
|
|
||||||
span.big-details {{nodesActive}}/{{nodesTotal}}
|
|
||||||
div.clearfix
|
|
||||||
//- div.col-xs-2.stat-holder
|
|
||||||
//- div.big-info.uptime(class="{{ upTimeTotal | upTimeClass : true }}")
|
|
||||||
//- div.pull-left.icon-full-width
|
|
||||||
//- i.icon-bulb
|
|
||||||
//- div.pull-left
|
|
||||||
//- span.small-title up-time
|
|
||||||
//- span.big-details {{ upTimeTotal | upTimeFilter }}
|
|
||||||
//- div.clearfix
|
|
||||||
div.col-xs-2.stat-holder
|
div.col-xs-2.stat-holder
|
||||||
div.big-info.bestblock.text-info
|
div.big-info.bestblock.text-info
|
||||||
div.pull-left.icon-full-width
|
div.pull-left.icon-full-width
|
||||||
@ -27,14 +11,6 @@ block content
|
|||||||
span.small-title best block
|
span.small-title best block
|
||||||
span.big-details {{'#'}}{{ bestBlock | number}}
|
span.big-details {{'#'}}{{ bestBlock | number}}
|
||||||
div.clearfix
|
div.clearfix
|
||||||
div.col-xs-2.stat-holder
|
|
||||||
div.big-info.difficulty.text-info
|
|
||||||
div.pull-left.icon-full-width
|
|
||||||
i.icon-difficulty
|
|
||||||
div.pull-left
|
|
||||||
span.small-title difficulty
|
|
||||||
span.big-details {{ lastDifficulty | number }}
|
|
||||||
div.clearfix
|
|
||||||
div.col-xs-2.stat-holder
|
div.col-xs-2.stat-holder
|
||||||
div.big-info.uncleCount.text-info
|
div.big-info.uncleCount.text-info
|
||||||
div.pull-left.icon-full-width
|
div.pull-left.icon-full-width
|
||||||
@ -60,22 +36,39 @@ block content
|
|||||||
span.small-title avg block time
|
span.small-title avg block time
|
||||||
span.big-details {{ avgBlockTime | avgTimeFilter }}
|
span.big-details {{ avgBlockTime | avgTimeFilter }}
|
||||||
div.clearfix
|
div.clearfix
|
||||||
|
div.col-xs-2.stat-holder
|
||||||
|
div.big-info.difficulty.text-orange
|
||||||
|
div.pull-left.icon-full-width
|
||||||
|
i.icon-hashrate
|
||||||
|
div.pull-left
|
||||||
|
span.small-title avg network hashrate
|
||||||
|
span.big-details {{ avgHashrate | number : 1 }} MH/s
|
||||||
|
div.clearfix
|
||||||
|
div.col-xs-2.stat-holder
|
||||||
|
div.big-info.difficulty.text-danger
|
||||||
|
div.pull-left.icon-full-width
|
||||||
|
i.icon-difficulty
|
||||||
|
div.pull-left
|
||||||
|
span.small-title difficulty
|
||||||
|
span.big-details {{ lastDifficulty | number }}
|
||||||
|
div.clearfix
|
||||||
|
|
||||||
div.clearfix
|
div.clearfix
|
||||||
|
|
||||||
|
|
||||||
div.row(ng-cloak)
|
div.row(ng-cloak)
|
||||||
div.col-xs-8.stats-boxes(style="padding-top: 0px;")
|
div.col-xs-8.stats-boxes(style="padding-top: 0px;")
|
||||||
div.row.second-row
|
div.row.second-row
|
||||||
//- div.col-xs-3.stat-holder.box
|
|
||||||
//- div.active-nodes(class="{{ nodesActive | nodesActiveClass : nodesTotal }}")
|
|
||||||
//- i.icon-node
|
|
||||||
//- span.small-title active nodes
|
|
||||||
//- span.small-value {{nodesActive}}/{{nodesTotal}}
|
|
||||||
div.col-xs-3.stat-holder.box
|
div.col-xs-3.stat-holder.box
|
||||||
div.difficulty.text-info
|
div.active-nodes(class="{{ nodesActive | nodesActiveClass : nodesTotal }}")
|
||||||
i.icon-difficulty
|
i.icon-node
|
||||||
span.small-title difficulty
|
span.small-title active nodes
|
||||||
span.small-value {{ lastDifficulty | number }}
|
span.small-value {{nodesActive}}/{{nodesTotal}}
|
||||||
|
//- div.col-xs-3.stat-holder.box
|
||||||
|
//- div.difficulty.text-info
|
||||||
|
//- i.icon-difficulty
|
||||||
|
//- span.small-title difficulty
|
||||||
|
//- span.small-value {{ lastDifficulty | number }}
|
||||||
div.col-xs-3.stat-holder.box
|
div.col-xs-3.stat-holder.box
|
||||||
div.gasprice.text-info
|
div.gasprice.text-info
|
||||||
i.icon-gasprice
|
i.icon-gasprice
|
||||||
@ -94,18 +87,24 @@ block content
|
|||||||
|
|
||||||
div.row
|
div.row
|
||||||
div.col-xs-3.stat-holder
|
div.col-xs-3.stat-holder
|
||||||
div.big-info.chart
|
div.big-info.chart(class="{{ avgBlockTime | avgTimeClass }}")
|
||||||
|
//- i.icon-time
|
||||||
span.small-title block time
|
span.small-title block time
|
||||||
|
//- span.small-value {{ avgBlockTime | avgTimeFilter }}
|
||||||
span.big-details.spark-blocktimes
|
span.big-details.spark-blocktimes
|
||||||
|
|
||||||
div.col-xs-3.stat-holder
|
div.col-xs-3.stat-holder
|
||||||
div.big-info.chart
|
div.big-info.chart.text-info
|
||||||
|
//- i.icon-difficulty
|
||||||
span.small-title difficulty
|
span.small-title difficulty
|
||||||
|
//- span.small-value {{ lastDifficulty | number }}
|
||||||
span.big-details.spark-difficulty
|
span.big-details.spark-difficulty
|
||||||
|
|
||||||
div.col-xs-3.stat-holder.xpull-right
|
div.col-xs-3.stat-holder.xpull-right
|
||||||
div.big-info.chart.xdouble-chart
|
div.big-info.chart.xdouble-chart.text-info
|
||||||
|
//- i.icon-gas
|
||||||
span.small-title block propagation
|
span.small-title block propagation
|
||||||
|
//- span.small-value {{ lastDifficulty | number }}
|
||||||
histogram.big-details.d3-blockpropagation(data="blockPropagationChart")
|
histogram.big-details.d3-blockpropagation(data="blockPropagationChart")
|
||||||
|
|
||||||
div.col-xs-3.stat-holder.pull-right
|
div.col-xs-3.stat-holder.pull-right
|
||||||
@ -118,18 +117,22 @@ block content
|
|||||||
div.clearfix
|
div.clearfix
|
||||||
|
|
||||||
div.col-xs-3.stat-holder
|
div.col-xs-3.stat-holder
|
||||||
div.big-info.chart
|
div.big-info.chart.text-info
|
||||||
|
//- i.icon-uncle
|
||||||
span.small-title uncle count #[ ]
|
span.small-title uncle count #[ ]
|
||||||
span.small (25 blocks per bar)
|
span.small (25 blocks per bar)
|
||||||
|
//- span.small-value {{ bestStats.block.uncles.length }}/{{ uncleCount }}
|
||||||
span.big-details.spark-uncles
|
span.big-details.spark-uncles
|
||||||
|
|
||||||
div.col-xs-3.stat-holder
|
div.col-xs-3.stat-holder
|
||||||
div.big-info.chart
|
div.big-info.chart.text-info
|
||||||
|
//- i.icon-uncle
|
||||||
span.small-title transactions
|
span.small-title transactions
|
||||||
span.big-details.spark-transactions
|
span.big-details.spark-transactions
|
||||||
|
|
||||||
div.col-xs-3.stat-holder
|
div.col-xs-3.stat-holder
|
||||||
div.big-info.chart
|
div.big-info.chart.text-info
|
||||||
|
//- i.icon-gasprice
|
||||||
span.small-title gas spending
|
span.small-title gas spending
|
||||||
span.big-details.spark-gasspending
|
span.big-details.spark-gasspending
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user