Esempio n. 1
0
function process_host_disp($desmhash, $summary_data_array, $dev_data_array)
{
    global $data_totals;
    global $config, $sigdigs;
    $devs = $activedevs = $max_temp = $fivesmhash = $fivesmhashper = $avgmhper = 0;
    $fivesmhashcol = $avgmhpercol = $rejectscol = $discardscol = $stalescol = $getfailscol = $remfailscol = "";
    $rejects = $discards = $stales = $getfails = $remfails = '---';
    $row = "";
    if ($summary_data_array != null) {
        if ($dev_data_array != null) {
            $devs = process_host_devs($dev_data_array, $activedevs, $fivesmhash, $max_temp);
        }
        $avgmhash = $summary_data_array['SUMMARY'][0]['MHS av'];
        $accepted = $summary_data_array['SUMMARY'][0]['Accepted'];
        $rejected = $summary_data_array['SUMMARY'][0]['Rejected'];
        $discarded = $summary_data_array['SUMMARY'][0]['Discarded'];
        $stale = $summary_data_array['SUMMARY'][0]['Stale'];
        $getfail = $summary_data_array['SUMMARY'][0]['Get Failures'];
        $remfail = $summary_data_array['SUMMARY'][0]['Remote Failures'];
        $utility = $summary_data_array['SUMMARY'][0]['Utility'];
        $Wutility = $summary_data_array['SUMMARY'][0]['Work Utility'];
        $getworks = $summary_data_array['SUMMARY'][0]['Getworks'];
        if (isset($accepted) && $accepted !== 0) {
            $efficency = number_format(100 / $getworks * $accepted, $sigdigs, ".", "") . " %";
            $rejects = number_format(100 / ($accepted + $rejected) * $rejected, $sigdigs, ".", "") . " %";
            $discards = number_format(100 / $accepted * $discarded, $sigdigs, ".", "") . " %";
            $stales = number_format(100 / $accepted * $stale, $sigdigs, ".", "") . " %";
            $getfails = number_format(100 / $accepted * $getfail, $sigdigs, ".", "") . " %";
            $remfails = number_format(100 / $accepted * $remfail, $sigdigs, ".", "") . " %";
            $rejectscol = set_color_high($rejects, $config->yellowrejects, $config->maxrejects);
            // Rejects
            $discardscol = set_color_high($discards, $config->yellowdiscards, $config->maxdiscards);
            // Discards
            $stalescol = set_color_high($stales, $config->yellowstales, $config->maxstales);
            // Stales
            $getfailscol = set_color_high($getfails, $config->yellowgetfails, $config->maxgetfails);
            // Get fails
            $remfailscol = set_color_high($remfails, $config->yellowremfails, $config->maxremfails);
            // Rem fails
        }
        if ($desmhash > 0) {
            // Desired Mhash vs. 5s mhash
            $fivesmhashper = number_format(100 / $desmhash * $fivesmhash, $sigdigs, ".", "");
            $fivesmhashcol = set_color_low($fivesmhashper, $config->yellowgessper, $config->maxgessper);
            // Desired Mhash vs. avg mhash
            $avgmhper = number_format(100 / $desmhash * $avgmhash, $sigdigs, ".", "");
            $avgmhpercol = set_color_low($avgmhper, $config->yellowavgmhper, $config->maxavgmhper);
        }
        // Temperature
        // Set red on zero value
        if ($max_temp == 0) {
            $max_temp = $config->maxtemp;
        }
        if ($config->yellowtemp == 0 and $config->maxtemp == 0) {
            $tempcol = "class=green";
        } else {
            $tempcol = set_color_high($max_temp, $config->yellowtemp, $config->maxtemp);
        }
        // host status
        $thisstatuscol = $thisstatus == "S" ? "class=green" : "class=yellow";
        // active devs
        $thisdevcol = $activedevs == $devs ? "class=green" : "class=red";
        $row = "\n      <td {$thisdevcol}>{$activedevs}/{$devs}</td>\n      <td {$tempcol}>{$max_temp}&deg;C</td>\n      <td>{$desmhash}</td>\n      <td>{$utility}<br>({$Wutility})</td>\n      <td {$fivesmhashcol}>{$fivesmhash}<BR>{$fivesmhashper} %</td>\n      <td {$avgmhpercol}>{$avgmhash}<BR>{$avgmhper} %</td>\n      <td>{$getworks}</td>\n      <td>{$accepted}<BR>{$efficency}</td>\n      <td {$rejectscol}>{$rejected}<BR>{$rejects}</td>\n      <td {$discardscol}>{$discarded}<BR>{$discards}</td>\n      <td {$stalescol}>{$stale}<BR>{$stales}</td>\n      <td {$getfailscol}>{$getfail}<BR>{$getfails}</td>\n      <td {$remfailscol}>{$remfail}<BR>{$remfails}</td>";
        // Sum Stuff
        $data_totals['hosts']++;
        $data_totals['devs'] += $devs;
        $data_totals['activedevs'] += $activedevs;
        $data_totals['maxtemp'] = $data_totals['maxtemp'] > $max_temp ? $data_totals['maxtemp'] : $max_temp;
        $data_totals['desmhash'] += $desmhash;
        $data_totals['utility'] += $utility;
        $data_totals['Wutility'] += $Wutility;
        $data_totals['fivesmhash'] += $fivesmhash;
        $data_totals['avemhash'] += $avgmhash;
        $data_totals['accepts'] += $accepted;
        $data_totals['getworks'] += $getworks;
        $data_totals['rejects'] += $rejects;
        $data_totals['discards'] += $discards;
        $data_totals['stales'] += $stales;
        $data_totals['getfails'] += $getfails;
        $data_totals['remfails'] += $remfails;
    }
    return $row;
}
Esempio n. 2
0
function process_host_disp($desmhash, $summary_data_array, $dev_data_array)
{
    global $config;
    global $data_totals;
    global $Hash_Method;
    $devs = $activedevs = $max_temp = $fivesmhash = $fivesmhashper = $avgmhper = 0;
    $fivesmhashcol = $avgmhpercol = $rejectscol = $discardscol = $stalescol = $getfailscol = $remfailscol = "";
    $rejects = $discards = $stales = $getfails = $remfails = '---';
    $row = "";
    if ($summary_data_array != null) {
        if ($dev_data_array != null) {
            $devs = process_host_devs($dev_data_array, $activedevs, $fivesmhash, $max_temp);
        }
        if ($Hash_Method == 'scrypt') {
            $avgmhash = $summary_data_array['SUMMARY'][0]['MHS av'] * 1000;
            $fivesmhash = $summary_data_array['SUMMARY'][0]['MHS 5s'] * 1000;
        } else {
            $avgmhash = $summary_data_array['SUMMARY'][0]['MHS av'];
            $fivesmhash = $summary_data_array['SUMMARY'][0]['MHS 5s'];
        }
        $accepted = $summary_data_array['SUMMARY'][0]['Accepted'];
        $rejected = $summary_data_array['SUMMARY'][0]['Rejected'];
        $discarded = $summary_data_array['SUMMARY'][0]['Discarded'];
        $stale = $summary_data_array['SUMMARY'][0]['Stale'];
        $getfail = $summary_data_array['SUMMARY'][0]['Get Failures'];
        $remfail = $summary_data_array['SUMMARY'][0]['Remote Failures'];
        $utility = $summary_data_array['SUMMARY'][0]['Utility'];
        $Wutility = $summary_data_array['SUMMARY'][0]['Work Utility'];
        $getworks = $summary_data_array['SUMMARY'][0]['Getworks'];
        $Diff1Accept = $summary_data_array['SUMMARY'][0]['Difficulty Accepted'];
        if (isset($accepted) && $accepted !== 0) {
            $difficulty = (int) ($Diff1Accept / $accepted);
            $rejects = $summary_data_array['SUMMARY'][0]['Pool Rejected%'] . " %";
            $discards = round(100 / $getworks * $discarded, 1) . " %";
            $stales = $summary_data_array['SUMMARY'][0]['Pool Stale%'] . " %";
            $getfails = round(100 / $accepted * $getfail, 1) . " %";
            $remfails = round(100 / $accepted * $remfail, 1) . " %";
            $rejectscol = set_color_high($rejects, $config->yellowrejects, $config->maxrejects);
            // Rejects
            $discardscol = set_color_high($discards, $config->yellowdiscards, $config->maxdiscards);
            // Discards
            $stalescol = set_color_high($stales, $config->yellowstales, $config->maxstales);
            // Stales
            $getfailscol = set_color_high($getfails, $config->yellowgetfails, $config->maxgetfails);
            // Get fails
            $remfailscol = set_color_high($remfails, $config->yellowremfails, $config->maxremfails);
            // Rem fails
        }
        if ($desmhash > 0) {
            // Desired Mhash vs. 5s mhash
            if ($Hash_Method == 'scrypt') {
                $fivesmhashper = round(100 / $desmhash * $fivesmhash * 1000, 1);
            } else {
                $fivesmhashper = (int) round(100 / $desmhash * $fivesmhash, 1);
            }
            $fivesmhashcol = set_color_low($fivesmhashper, $config->yellowgessper, $config->maxgessper);
            // Desired Mhash vs. avg mhash
            $avgmhper = (int) round(100 / $desmhash * $avgmhash, 1);
            $avgmhpercol = set_color_low($avgmhper, $config->yellowavgmhper, $config->maxavgmhper);
        }
        $tempcol = set_color_high($max_temp, $config->yellowtemp, $config->maxtemp);
        // Temperature
        $thisdevcol = $activedevs == $devs ? "class=green" : "class=red";
        // active devs
        $row = "\r\n      <td {$thisdevcol}>{$activedevs}/{$devs}</td>\r\n      <td {$tempcol}>{$max_temp}</td>\r\n      <td>{$desmhash}</td>\r\n      <td>{$utility}<br>({$Wutility})</td>\r\n      <td {$fivesmhashcol}>{$fivesmhash}<BR>{$fivesmhashper} %</td>\r\n      <td {$avgmhpercol}>{$avgmhash}<BR>{$avgmhper} %</td>\r\n      <td>{$getworks}</td>\r\n      <td>{$accepted}</td>\r\n      <td>{$difficulty}</td>\r\n      <td {$rejectscol}>{$rejected}<BR>{$rejects}</td>\r\n      <td {$discardscol}>{$discarded}<BR>{$discards}</td>\r\n      <td {$stalescol}>{$stale}<BR>{$stales}</td>\r\n      <td {$getfailscol}>{$getfail}<BR>{$getfails}</td>\r\n      <td {$remfailscol}>{$remfail}<BR>{$remfails}</td>";
        // Sum Stuff
        $data_totals['hosts']++;
        $data_totals['devs'] += $devs;
        $data_totals['activedevs'] += $activedevs;
        $data_totals['maxtemp'] = $data_totals['maxtemp'] > $max_temp ? $data_totals['maxtemp'] : $max_temp;
        $data_totals['desmhash'] += $desmhash;
        $data_totals['utility'] += $utility;
        $data_totals['Wutility'] += $Wutility;
        $data_totals['fivesmhash'] += $fivesmhash;
        $data_totals['avemhash'] += $avgmhash;
        $data_totals['VarDiffAccepts'] += $accepted;
        $data_totals['Diff1Accepts'] += $Diff1Accept;
        $data_totals['getworks'] += $getworks;
        $data_totals['rejects'] += $rejects;
        $data_totals['discards'] += $discards;
        $data_totals['stales'] += $stales;
        $data_totals['getfails'] += $getfails;
        $data_totals['remfails'] += $remfails;
    }
    return $row;
}