Author

Topic: [PERL][YAC] YaCoin stats (Read 657 times)

member
Activity: 70
Merit: 10
May 09, 2013, 06:20:52 PM
#2
nicely done!
hero member
Activity: 819
Merit: 1000
May 09, 2013, 06:18:26 PM
#1
I hacked together a perl script to show live stats. to use it, you need to install libjson-perl.
For Ubuntu people:

Code:
sudo apt-get install libjson-perl

I don't have windows, so if someone gets this running on windows please share what you needed to install.

Code:
#!/usr/bin/perl
use JSON;
$numsecs = 30;               #seconds to refresh
$hashespersec = 400000;  #Your mining speed
$input = `./yacoind getinfo`;
#print "Input:\n".$input."\n";
$json = JSON->new->allow_nonref;
$arrs = $json->decode($input);
$oldblocks = $arrs->{'blocks'};
sleep $numsecs;
while(1==1){
$input = `./yacoind getinfo`;
# print "Input:\n".$input."\n";
$json = JSON->new->allow_nonref;
$arrs = $json->decode($input);
# print "old: $oldblocks, new: ". $arrs->{'blocks'}."\n";
$secsperblock = ($numsecs/($arrs->{'blocks'}-$oldblocks));
print "Block: $secsperblock s ";
$hashesperblock = (2**32)*$arrs->{'difficulty'};
        $blocks = $arrs->{'blocks'}-$oldblocks;
        $speed = ($blocks*$hashesperblock)/$numsecs;
$time = $hashesperblock/400000;
$speed = $speed/$hashespersec;
        printf "Netspeed: %.3f MH/s %.3f hrs/b\n",$speed,$time/3600;
$oldblocks = $arrs->{'blocks'};
sleep $numsecs;
}

usage:
Code:
kalgecin@laptop:~/yacoin/src$ perl ~/yacoin.pl
suggestions for improvement are being accepted. Criticism is also accepted  Tongue Wink

Donations: Y7HPdphiDdH1Q7T2NJ4gxvNxP6XqPnVcNR
Jump to: