benchs: add some power cost values

This commit is contained in:
Tanguy Pruvot 2016-08-22 00:40:45 +02:00
parent defe4f9036
commit 6606c6f3b0
4 changed files with 41 additions and 2 deletions

View file

@ -14,6 +14,7 @@ if (!defined('YAAMP_DBPASSWORD')) define('YAAMP_DBPASSWORD', '');
if (!defined('YIIMP_PUBLIC_EXPLORER')) define('YIIMP_PUBLIC_EXPLORER', true);
if (!defined('YIIMP_PUBLIC_BENCHMARK')) define('YIIMP_PUBLIC_BENCHMARK', false);
if (!defined('YIIMP_FIAT_ALTERNATIVE')) define('YIIMP_FIAT_ALTERNATIVE', 'EUR');
if (!defined('YIIMP_KWH_USD_PRICE')) define('YIIMP_KWH_USD_PRICE', 0.25);
if (!defined('YAAMP_FEES_MINING')) define('YAAMP_FEES_MINING', 0.5);
if (!defined('YAAMP_FEES_EXCHANGE')) define('YAAMP_FEES_EXCHANGE', 2);
@ -56,3 +57,4 @@ if (!defined('NICEHASH_API_ID')) define('NICEHASH_API_ID','0000');
if (!defined('NICEHASH_DEPOSIT')) define('NICEHASH_DEPOSIT','');
if (!defined('NICEHASH_DEPOSIT_AMOUNT')) define('NICEHASH_DEPOSIT_AMOUNT','0.01');

View file

@ -75,12 +75,21 @@ echo <<<END
<th data-sorter="text" width="70">Chip</th>
<th data-sorter="numeric" width="220">Hashrate</th>
<th data-sorter="numeric" width="220">Power</th>
<th data-sorter="currency" title="mBTC/day">Cost*</th>
<th data-sorter="currency" title="mBTC/day">Reward</th>
<th data-sorter="currency" title="mBTC/day">Profit**</th>
<th data-sorter="numeric" width="220">Int</th>
<th data-sorter="numeric" width="220">Freq</th>
</tr>
</thead><tbody>
END;
if ($algo != 'all') {
$t1 = time() - 24*60*60;
$algo_24E = dboscalar("SELECT avg(price) FROM hashrate WHERE time>$t1 AND algo=:algo", array(':algo'=>$algo));
$algo_24E = $algo_24E / (1000 * yaamp_algo_mBTC_factor($algo)); // mBTC per kHs
}
foreach ($in_db as $row) {
echo '<tr class="ssrow">';
@ -90,8 +99,22 @@ foreach ($in_db as $row) {
$chip = CHtml::link($row['chip'], '/bench?chip='.$row['idchip'].'&algo='.$algo);
echo '<td>'.$chip.'</td>';
$cost = powercost_mBTC($row['power']);
$reward = $row['khps']*$algo_24E;
echo '<td data="'.$row['khps'].'">'.Itoa2(1000*round($row['khps'],3),3).'H</td>';
echo '<td>'.($power>0 ? round($power) : '-').'</td>';
echo '<td>'.($power>0 ? mbitcoinvaluetoa($cost) : '-').'</td>';
if (isset($algo_24E)) {
echo '<td>'.mbitcoinvaluetoa($reward).'</td>';
if ($reward < $cost)
echo '<td class="red">'.($power>0 ? mbitcoinvaluetoa($reward - $cost) : '-').'</td>';
else
echo '<td>'.($power>0 ? mbitcoinvaluetoa($reward - $cost) : '-').'</td>';
} else {
echo '<td>-</td>';
echo '<td>-</td>';
}
echo '<td>'.($row['intensity']>0 ? round($row['intensity']) : '-').'</td>';
echo '<td>'.($row['freq']>0 ? round($row['freq']) : '-').'</td>';
@ -100,7 +123,10 @@ foreach ($in_db as $row) {
echo '</tbody></table><br/>';
echo '<a href="/bench/devices">Show current state of the database (devices/algos)</a><br/>';
echo '* Device power cost per day based on '.YIIMP_KWH_USD_PRICE.' USD per kWh<br/>';
echo '** Reward and profit are based on the average estimates from the last 24 hours<br/><br/>';
echo '<a href="/bench/devices">Show current devices in the database</a><br/>';
echo '<a href="/site/benchmarks">Learn how to submit your results</a>';
echo '<br/><br/>';

View file

@ -165,3 +165,10 @@ function formatClientName($version)
{
return $version;
}
function powercost_mBTC($watts)
{
$btcusd = (double) controller()->memcache->get_database_scalar("btc_in_usd", "SELECT usdbtc FROM mining LIMIT 1");
if (!$btcusd) $btcusd = 500;
return (YIIMP_KWH_USD_PRICE * 24 * $watts) / $btcusd;
}

View file

@ -115,6 +115,7 @@ echo <<<END
<th data-sorter="numeric" title="Intensity (-i) for GPU or Threads (-t) for CPU miners">Int.</th>
<th data-sorter="numeric" title="MHz">Freq</th>
<th data-sorter="numeric" title="Watts if available">W</th>
<th data-sorter="currency" title="mBTC/day">Cost</th>
<th data-sorter="text">Client</th>
<th data-sorter="text">OS</th>
<th data-sorter="text">Driver / Compiler</th>
@ -156,6 +157,7 @@ foreach ($db_rows as $row) {
echo '<td>'.($row['freq'] ? $row['freq'] : '-').'</td>';
echo '<td>'.(empty($row['power']) ? '-' : $row['power']).'</td>';
echo '<td>'.(empty($row['power']) ? '-' : mbitcoinvaluetoa(powercost_mBTC($row['power']))).'</td>';
echo '<td>'.formatClientName($row['client']).'</td>';
echo '<td>'.$row['os'].'</td>';
echo '<td>'.$row['driver'].'</td>';
@ -198,6 +200,7 @@ if (!empty($algo)) {
echo '<th>'.($avg['intensity'] ? round($avg['intensity'],1) : '').'</td>';
echo '<th>'.($avg['freq'] ? round($avg['freq']) : '').'</td>';
echo '<th>'.($avg['power'] ? round($avg['power']) : '').'</td>';
echo '<th>'.($avg['power'] ? mbitcoinvaluetoa(powercost_mBTC($avg['power'])) : '').'</td>';
$hpw = 0;
if (floatval($avg['power']) > 0) {
@ -216,7 +219,8 @@ echo'</table><br/>';
echo <<<end
<p style="margin: 0; padding: 0 4px;">
<a href="/bench/devices">Show current state of the database (devices/algos)</a><br/>
<a href="/bench/devices">Show current devices in the database</a><br/>
<a href="/site/benchmarks">Learn how to submit your results</a><br/>
<br/>
</p>