setState('yaamp-algo', $_GET['algo']);
$algo = user()->getState('yaamp-algo');
$target = yaamp_hashrate_constant($algo);
$interval = yaamp_hashrate_step();
$delay = time()-$interval;
echo "
";
echo "";
echo "";
echo "Version | ";
echo "Workers | ";
echo "Hashrate | ";
echo "Bad | ";
echo " | ";
echo "
";
echo "";
$versions = dbolist("select version, count(*) as c from workers where algo=:algo group by version", array(':algo'=>$algo));
foreach($versions as $item)
{
$version = $item['version'];
$count = $item['c'];
$hashrate = dboscalar("select sum(difficulty) * $target / $interval / 1000 from shares where valid and time>$delay and
workerid in (select id from workers where algo=:algo and version=:version)", array(':algo'=>$algo, ':version'=>$version));
$invalid = dboscalar("select sum(difficulty) * $target / $interval / 1000 from shares where not valid and time>$delay and
workerid in (select id from workers where algo=:algo and version=:version)", array(':algo'=>$algo, ':version'=>$version));
$percent = $hashrate? round($invalid*100/$hashrate, 3): 0;
$hashrate = Itoa2($hashrate).'h/s';
$invalid = Itoa2($invalid).'h/s';
echo "";
echo "$version | ";
echo "$count | ";
echo "$hashrate | ";
echo "$invalid | ";
echo "{$percent}% | ";
echo "
";
}
echo "
";