";
echo "
Miners: $user->username
";
echo "
";
echo "
";
echo "";
echo "";
echo "Summary | ";
echo "Miners | ";
echo "Shares | ";
echo "Hashrate* | ";
echo "Reject* | ";
echo "
";
echo "";
foreach(yaamp_get_algos() as $algo)
{
// debuglog($algo);
$user_rate1 = yaamp_user_rate($user->id, $algo);
$user_rate1_bad = yaamp_user_rate_bad($user->id, $algo);
$percent_bad = ($user_rate1 + $user_rate1_bad)? $user_rate1_bad * 100 / ($user_rate1 + $user_rate1_bad): 0;
$percent_bad = $percent_bad? round($percent_bad, 1).'%': '';
$user_rate1 = $user_rate1? Itoa2($user_rate1).'h/s': '-';
$minercount = getdbocount('db_workers', "userid=$user->id and algo=:algo", array(':algo'=>$algo));
$user_shares = controller()->memcache->get_database_scalar("wallet_user_shares-$user->id-$algo",
"select sum(difficulty) from shares where valid and algo=:algo and userid=$user->id", array(':algo'=>$algo));
if(!$user_shares && !$minercount) continue;
$total_shares = controller()->memcache->get_database_scalar("wallet_total_shares-$algo",
"select sum(difficulty) from shares where valid and algo=:algo", array(':algo'=>$algo));
if(!$total_shares) continue;
$percent_shares = round($user_shares * 100 / $total_shares, 4);
echo "";
echo "$algo | ";
echo "$minercount | ";
echo "{$percent_shares}% | ";
echo "$user_rate1 | ";
echo "$percent_bad | ";
echo "
";
}
echo "
";
EDIT: and the underlying sql table, so maybe something going screwy in the memcache?
DROP TABLE IF EXISTS `shares`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `shares` (
`id` bigint(30) NOT NULL AUTO_INCREMENT,
`userid` int(11) DEFAULT NULL,
`workerid` int(11) DEFAULT NULL,
`coinid` int(11) DEFAULT NULL,
`jobid` int(11) DEFAULT NULL,
`pid` int(11) DEFAULT NULL,
`time` int(11) DEFAULT NULL,
`error` int(11) DEFAULT NULL,
`valid` tinyint(1) DEFAULT NULL,
`extranonce1` tinyint(1) DEFAULT NULL,
`difficulty` double DEFAULT '0',
`algo` varchar(16) DEFAULT 'x11',
PRIMARY KEY (`id`),
KEY `time` (`time`),
KEY `algo1` (`algo`),
KEY `valid1` (`valid`),
KEY `user1` (`userid`),
KEY `worker1` (`workerid`),
KEY `coin1` (`coinid`),
KEY `jobid` (`jobid`)
) ENGINE=InnoDB AUTO_INCREMENT=248001 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
Further edit: Share database writes are handled by the stratum c++ processes. So the alternative explanation for the strange share percentage could be a stratum process bug inserting some rubbish into the table.
https://github.com/tpruvot/yiimp/blob/yiimp/stratum/share.cppvoid share_write(YAAMP_DB *db)
{
int pid = getpid();
int count = 0;
int now = time(NULL);
char buffer[1024*1024] = "insert into shares (userid, workerid, coinid, jobid, pid, valid, extranonce1, difficulty, time, algo, error) values ";
g_list_worker.Enter();
for(CLI li = g_list_worker.first; li; li = li->next)
{
YAAMP_WORKER *worker = (YAAMP_WORKER *)li->data;
if(worker->deleted) continue;
if(count) strcat(buffer, ",");
sprintf(buffer+strlen(buffer), "(%d, %d, %d, %d, %d, %d, %d, %f, %d, '%s', %d)",
worker->userid, worker->workerid, worker->coinid, worker->remoteid, pid,
worker->valid, worker->extranonce1, worker->difficulty, now, g_stratum_algo, worker->error_number);
if(++count >= 1000)
{
db_query(db, buffer);
strcpy(buffer, "insert into shares (userid, workerid, coinid, jobid, pid, valid, extranonce1, difficulty, time, algo, error) values ");
count = 0;
}
object_delete(worker);
}
g_list_worker.Leave();
if(count) db_query(db, buffer);
}