Revert "Merge pull request #784 from iAmShorty/pool-stat-additions"

This reverts commit df6134db76, reversing
changes made to 0d1a53c7a3.
This commit is contained in:
Sebastian Grewe 2013-10-29 09:33:45 +01:00
parent df6134db76
commit 178f798d8f
5 changed files with 17 additions and 168 deletions

View File

@ -52,58 +52,6 @@ class Statistics {
return true;
}
/**
* Fetch last found blocks by time
**/
function getLastValidBlocksbyTime($aTimeFrame) {
$this->debug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__ . $aTimeFrame)) return $data;
$date = new DateTime();
$actualTime = $date->getTimestamp();
$aTimeDiff = $actualTime - $aTimeFrame;
if ($aTimeFrame == 0) $aTimeDiff = 0;
$stmt = $this->mysqli->prepare("
SELECT COUNT(id) AS count FROM " . $this->block->getTableName() . "
WHERE confirmations > 0
AND time >= ?
");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $aTimeDiff) && $stmt->execute() && $result = $stmt->get_result())
if ($aTimeFrame == 0) return $this->memcache->setCache(FOUNDALLVALID, $result->fetch_object()->count);
if ($aTimeFrame == 3600) return $this->memcache->setCache(FOUNDLASTHOURVALID, $result->fetch_object()->count);
if ($aTimeFrame == 86400) return $this->memcache->setCache(FOUNDLAST24HOURSVALID, $result->fetch_object()->count);
if ($aTimeFrame == 604800) return $this->memcache->setCache(FOUNDLAST7DAYSVALID, $result->fetch_object()->count);
if ($aTimeFrame == 2419200) return $this->memcache->setCache(FOUNDLAST4WEEKSVALID, $result->fetch_object()->count);
$this->debug->append("Failed to get Blocks by time: ". $this->mysqli->error);
return false;
}
function getLastOrphanBlocksbyTime($aTimeFrame) {
$this->debug->append("STA " . __METHOD__, 4);
if ($data = $this->memcache->get(__FUNCTION__ . $aTimeFrame)) return $data;
$date = new DateTime();
$actualTime = $date->getTimestamp();
$aTimeDiff = $actualTime - $aTimeFrame;
if ($aTimeFrame == 0) $aTimeDiff = 0;
$stmt = $this->mysqli->prepare("
SELECT COUNT(id) AS count FROM " . $this->block->getTableName() . "
WHERE confirmations = -1
AND time >= ?
");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $aTimeDiff) && $stmt->execute() && $result = $stmt->get_result())
if ($aTimeFrame == 0) return $this->memcache->setCache(FOUNDALLORPHAN, $result->fetch_object()->count);
if ($aTimeFrame == 3600) return $this->memcache->setCache(FOUNDLASTHOURORPHAN, $result->fetch_object()->count);
if ($aTimeFrame == 86400) return $this->memcache->setCache(FOUNDLAST24HOURSORPHAN, $result->fetch_object()->count);
if ($aTimeFrame == 604800) return $this->memcache->setCache(FOUNDLAST7DAYSORPHAN, $result->fetch_object()->count);
if ($aTimeFrame == 2419200) return $this->memcache->setCache(FOUNDLAST4WEEKSORPHAN, $result->fetch_object()->count);
$this->debug->append("Failed to get Blocks by time: ". $this->mysqli->error);
return false;
}
/**
* Get our last $limit blocks found
* @param limit int Last limit blocks

View File

@ -42,35 +42,7 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
$dTimeSinceLast = 0;
}
$iFoundLastValid = $statistics->getLastValidBlocksbyTime(0);
$iFoundLastHourValid = $statistics->getLastValidBlocksbyTime(3600);
$iFoundLastDayValid = $statistics->getLastValidBlocksbyTime(86400);
$iFoundLastWeekValid = $statistics->getLastValidBlocksbyTime(604800);
$iFoundLastMonthValid = $statistics->getLastValidBlocksbyTime(2419200);
$iFoundLastOrphan = $statistics->getLastOrphanBlocksbyTime(0);
$iFoundLastHourOrphan = $statistics->getLastOrphanBlocksbyTime(3600);
$iFoundLastDayOrphan = $statistics->getLastOrphanBlocksbyTime(86400);
$iFoundLastWeekOrphan = $statistics->getLastOrphanBlocksbyTime(604800);
$iFoundLastMonthOrphan = $statistics->getLastOrphanBlocksbyTime(2419200);
// Propagate content our template
$smarty->assign("FOUNDALLVALID", $iFoundLastValid);
$smarty->assign("FOUNDLASTHOURVALID", $iFoundLastHourValid);
$smarty->assign("FOUNDLAST24HOURSVALID", $iFoundLastDayValid);
$smarty->assign("FOUNDLAST7DAYSVALID", $iFoundLastWeekValid);
$smarty->assign("FOUNDLAST4WEEKSVALID", $iFoundLastMonthValid);
$smarty->assign("FOUNDALLORPHAN", $iFoundLastOrphan);
$smarty->assign("FOUNDLASTHOURORPHAN", $iFoundLastHourOrphan);
$smarty->assign("FOUNDLAST24HOURSORPHAN", $iFoundLastDayOrphan);
$smarty->assign("FOUNDLAST7DAYSORPHAN", $iFoundLastWeekOrphan);
$smarty->assign("FOUNDLAST4WEEKSORPHAN", $iFoundLastMonthOrphan);
$smarty->assign("ESTTIME", $iEstTime);
$smarty->assign("ESTTIME", $iEstTime);
$smarty->assign("TIMESINCELAST", $dTimeSinceLast);
$smarty->assign("BLOCKSFOUND", $aBlocksFoundData);

View File

@ -51,26 +51,6 @@
{assign var=estshares value=(65536 * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16))}
<td>{$estshares|number_format:"0"} <font size="1">(done: {(100 / $estshares * $GLOBAL.roundshares.valid)|number_format:"2"} %)</td>
</tr>
<tr>
<th align="left">All Blocks - Found / Valid / Orphan</td>
<td>{$FOUNDALLVALID + $FOUNDALLORPHAN} / {$FOUNDALLVALID} / {$FOUNDALLORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last hour - Found / Valid / Orphan</td>
<td>{$FOUNDLASTHOURVALID + $FOUNDLASTHOURORPHAN} / {$FOUNDLASTHOURVALID} / {$FOUNDLASTHOURORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 24 hours - Found / Valid / Orphan</td>
<td>{$FOUNDLAST24HOURSVALID + $FOUNDLAST24HOURSORPHAN} / {$FOUNDLAST24HOURSVALID} / {$FOUNDLAST24HOURSORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 7 days - Found / Valid / Orphan</td>
<td>{$FOUNDLAST7DAYSVALID + $FOUNDLAST7DAYSORPHAN} / {$FOUNDLAST7DAYSVALID} / {$FOUNDLAST7DAYSORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 4 weeks - Found / Valid / Orphan</td>
<td>{$FOUNDLAST4WEEKSVALID + $FOUNDLAST4WEEKSORPHAN} / {$FOUNDLAST4WEEKSVALID} / {$FOUNDLAST4WEEKSORPHAN}</td>
</tr>
<tr>
<td class="leftheader">Time Since Last Block</td>
<td>{$TIMESINCELAST|seconds_to_words}</td>

View File

@ -41,26 +41,6 @@
<td class="leftheader">Est. Shares this Round</td>
<td>{((65536 * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16)))|number_format:"0"} <font size="1">(done: {(100 / ((65536 * $DIFFICULTY) / pow(2, ($GLOBAL.config.targetdiff - 16))) * $GLOBAL.roundshares.valid)|number_format:"2"} %)</td>
</tr>
<tr>
<th align="left">All Blocks - Found / Valid / Orphan</td>
<td>{$FOUNDALLVALID + $FOUNDALLORPHAN} / {$FOUNDALLVALID} / {$FOUNDALLORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last hour - Found / Valid / Orphan</td>
<td>{$FOUNDLASTHOURVALID + $FOUNDLASTHOURORPHAN} / {$FOUNDLASTHOURVALID} / {$FOUNDLASTHOURORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 24 hours - Found / Valid / Orphan</td>
<td>{$FOUNDLAST24HOURSVALID + $FOUNDLAST24HOURSORPHAN} / {$FOUNDLAST24HOURSVALID} / {$FOUNDLAST24HOURSORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 7 days - Found / Valid / Orphan</td>
<td>{$FOUNDLAST7DAYSVALID + $FOUNDLAST7DAYSORPHAN} / {$FOUNDLAST7DAYSVALID} / {$FOUNDLAST7DAYSORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 4 weeks - Found / Valid / Orphan</td>
<td>{$FOUNDLAST4WEEKSVALID + $FOUNDLAST4WEEKSORPHAN} / {$FOUNDLAST4WEEKSVALID} / {$FOUNDLAST4WEEKSORPHAN}</td>
</tr>
<tr>
<td class="leftheader">Time Since Last Block</td>
<td>{$TIMESINCELAST|seconds_to_words}</td>

View File

@ -1,10 +1,10 @@
<article class="module width_half">
<article class="module width_half">
<header><h3>General Statistics</h3></header>
<div class="module_content">
<table width="100%">
<tbody>
<tr>
<th align="left" width="50%">Pool Hash Rate</th>
<th align="left" width="30%">Pool Hash Rate</th>
<td width="70%"><span id="b-hashrate"></span> {$GLOBAL.hashunits.pool}</td>
</tr>
<tr>
@ -15,6 +15,21 @@
<th align="left">Current Active Workers</td>
<td id="b-workers"></td>
</tr>
{if ! $GLOBAL.website.blockexplorer.disabled}
<tr>
<th align="left">Next Network Block</td>
<td>{$CURRENTBLOCK + 1} &nbsp;&nbsp;<font size="1"> (Current: <a href="{$GLOBAL.website.blockexplorer.url}{$CURRENTBLOCKHASH}" target="_new">{$CURRENTBLOCK})</a></font></td>
</tr>
{else}
<tr>
<th align="left">Next Network Block</td>
<td>{$CURRENTBLOCK + 1} &nbsp;&nbsp; (Current: {$CURRENTBLOCK})</td>
</tr>
{/if}
<tr>
<th align="left">Last Block Found</td>
<td><a href="{$smarty.server.PHP_SELF}?page=statistics&action=round&height={$LASTBLOCK}" target="_new">{$LASTBLOCK|default:"0"}</a></td>
</tr>
<tr>
<th align="left">Current Difficulty</td>
{if ! $GLOBAL.website.chaininfo.disabled}
@ -31,58 +46,12 @@
<th align="left">Est. Shares this Round</td>
<td id="b-target"></td>
</tr>
</tbody>
</table>
</div>
<header><h3>Block Statistics</h3></header>
<div class="module_content">
<table width="100%">
<tbody>
{if ! $GLOBAL.website.blockexplorer.disabled}
<tr>
<th align="left" width="50%">Next Network Block</td>
<td>{$CURRENTBLOCK + 1} &nbsp;&nbsp;<font size="1"> (Current: <a href="{$GLOBAL.website.blockexplorer.url}{$CURRENTBLOCKHASH}" target="_new">{$CURRENTBLOCK})</a></font></td>
</tr>
{else}
<tr>
<th align="left">Next Network Block</td>
<td>{$CURRENTBLOCK + 1} &nbsp;&nbsp; (Current: {$CURRENTBLOCK})</td>
</tr>
{/if}
<tr>
<th align="left">Last Block Found</td>
<td><a href="{$smarty.server.PHP_SELF}?page=statistics&action=round&height={$LASTBLOCK}" target="_new">{$LASTBLOCK|default:"0"}</a></td>
</tr>
<tr>
<th align="left">All Blocks - Found / Valid / Orphan</td>
<td>{$FOUNDALLVALID + $FOUNDALLORPHAN} / {$FOUNDALLVALID} / {$FOUNDALLORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last hour - Found / Valid / Orphan</td>
<td>{$FOUNDLASTHOURVALID + $FOUNDLASTHOURORPHAN} / {$FOUNDLASTHOURVALID} / {$FOUNDLASTHOURORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 24 hours - Found / Valid / Orphan</td>
<td>{$FOUNDLAST24HOURSVALID + $FOUNDLAST24HOURSORPHAN} / {$FOUNDLAST24HOURSVALID} / {$FOUNDLAST24HOURSORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 7 days - Found / Valid / Orphan</td>
<td>{$FOUNDLAST7DAYSVALID + $FOUNDLAST7DAYSORPHAN} / {$FOUNDLAST7DAYSVALID} / {$FOUNDLAST7DAYSORPHAN}</td>
</tr>
<tr>
<th align="left">Blocks last 4 weeks - Found / Valid / Orphan</td>
<td>{$FOUNDLAST4WEEKSVALID + $FOUNDLAST4WEEKSORPHAN} / {$FOUNDLAST4WEEKSVALID} / {$FOUNDLAST4WEEKSORPHAN}</td>
</tr>
<tr>
<th align="left">Time Since Last Block</td>
<td>{$TIMESINCELAST|seconds_to_words}</td>
</tr>
</tbody>
</table>
</div>
<footer>
{if !$GLOBAL.website.api.disabled}<ul><li>These stats are also available in JSON format <a href="{$smarty.server.PHP_SELF}?page=api&action=getpoolstatus&api_key={$GLOBAL.userdata.api_key|default:""}">HERE</a></li></ul>{/if}