Skip to content

Commit

Permalink
modify stat report
Browse files Browse the repository at this point in the history
  • Loading branch information
roks0n committed May 6, 2019
1 parent e7546b6 commit fd620f7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,15 @@ const report = (crawler) => {
const minDelay = Math.min(...allDelays)

console.log(`===========================================`)
console.log(`Total nodes visited: ${Object.keys(crawler.nodes).length}`)
console.log(`Total nodes online: ${crawler.heights.length}`)
console.log(`------------------------------------------`)
console.log(`All nodes: ${Object.keys(crawler.nodes).length}`)
console.log(`Nodes online: ${crawler.heights.length}`)
console.log(`Nodes offline: ${Object.keys(crawler.nodes).length - crawler.heights.length}`)

// height/block stats
console.log(``)
console.log(`Height and block stats:`)
for (const stat of orderBy(Object.values(blockStats), ['height'], ['desc'])) {
console.log(` ${stat.count} nodes on height ${stat.height} with hashes:`)
console.log(` ${stat.height} with ${stat.count} nodes. Block hashes:`)
for (const hash in stat.ids) {
console.log(` - ${hash} (${stat.ids[hash]} nodes)`)
}
Expand All @@ -54,15 +55,15 @@ const report = (crawler) => {
console.log(``)
console.log(`Version stats:`)
for (const stat of orderBy(Object.values(versionStats), ['version'], ['desc'])) {
console.log(` - ${stat.count} nodes on version ${stat.version}`)
console.log(` - ${stat.version} on ${stat.count} nodes`)
}

// delay stats
console.log(``)
console.log(`Delay`)
console.log(` Average delay: ${averageDelay}`)
console.log(` Min delay: ${minDelay}`)
console.log(` Max delay: ${maxDelay}`)
console.log(` Average: ${averageDelay}ms`)
console.log(` Min: ${minDelay}ms`)
console.log(` Max: ${maxDelay}ms`)

console.log(`------------------------------------------`)
console.log(`Finished scanning in ${new Date() - crawler.startTime}ms`)
Expand Down

0 comments on commit fd620f7

Please sign in to comment.