mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-22 20:44:19 +00:00
Merge pull request #104 from kanoi/master
Return last accepted share pool/time for devices
This commit is contained in:
commit
4301351402
3
README
3
README
@ -595,6 +595,9 @@ The list of requests and replies are:
|
|||||||
|
|
||||||
devs DEVS Each available CPU and GPU with their details
|
devs DEVS Each available CPU and GPU with their details
|
||||||
e.g. GPU=0,Accepted=NN,MHS av=NNN,...,Intensity=D|
|
e.g. GPU=0,Accepted=NN,MHS av=NNN,...,Intensity=D|
|
||||||
|
Last Share Time=NNN, <- standand long time in seconds
|
||||||
|
(or 0 if none) of last accepted share
|
||||||
|
Last Share Pool=N, <- pool number (or -1 if none)
|
||||||
Will not report CPUs if CPU mining is disabled
|
Will not report CPUs if CPU mining is disabled
|
||||||
|
|
||||||
gpu|N GPU The details of a single GPU number N in the same
|
gpu|N GPU The details of a single GPU number N in the same
|
||||||
|
28
api.c
28
api.c
@ -146,7 +146,7 @@ static const char *COMMA = ",";
|
|||||||
static const char SEPARATOR = '|';
|
static const char SEPARATOR = '|';
|
||||||
static const char GPUSEP = ',';
|
static const char GPUSEP = ',';
|
||||||
|
|
||||||
static const char *APIVERSION = "1.0";
|
static const char *APIVERSION = "1.1";
|
||||||
static const char *DEAD = "Dead";
|
static const char *DEAD = "Dead";
|
||||||
static const char *SICK = "Sick";
|
static const char *SICK = "Sick";
|
||||||
static const char *NOSTART = "NoStart";
|
static const char *NOSTART = "NoStart";
|
||||||
@ -526,20 +526,24 @@ static void gpustatus(int gpu, bool isjson)
|
|||||||
if (cgpu->dynamic)
|
if (cgpu->dynamic)
|
||||||
strcpy(intensity, DYNAMIC);
|
strcpy(intensity, DYNAMIC);
|
||||||
else
|
else
|
||||||
sprintf(intensity, "%d", gpus->intensity);
|
sprintf(intensity, "%d", cgpu->intensity);
|
||||||
|
|
||||||
if (isjson)
|
if (isjson)
|
||||||
sprintf(buf, "{\"GPU\":%d,\"Enabled\":\"%s\",\"Status\":\"%s\",\"Temperature\":%.2f,\"Fan Speed\":%d,\"Fan Percent\":%d,\"GPU Clock\":%d,\"Memory Clock\":%d,\"GPU Voltage\":%.3f,\"GPU Activity\":%d,\"Powertune\":%d,\"MHS av\":%.2f,\"MHS %ds\":%.2f,\"Accepted\":%d,\"Rejected\":%d,\"Hardware Errors\":%d,\"Utility\":%.2f,\"Intensity\":\"%s\"}",
|
sprintf(buf, "{\"GPU\":%d,\"Enabled\":\"%s\",\"Status\":\"%s\",\"Temperature\":%.2f,\"Fan Speed\":%d,\"Fan Percent\":%d,\"GPU Clock\":%d,\"Memory Clock\":%d,\"GPU Voltage\":%.3f,\"GPU Activity\":%d,\"Powertune\":%d,\"MHS av\":%.2f,\"MHS %ds\":%.2f,\"Accepted\":%d,\"Rejected\":%d,\"Hardware Errors\":%d,\"Utility\":%.2f,\"Intensity\":\"%s\",\"Last Share Pool\":%d,\"Last Share Time\":%lu}",
|
||||||
gpu, enabled, status, gt, gf, gp, gc, gm, gv, ga, pt,
|
gpu, enabled, status, gt, gf, gp, gc, gm, gv, ga, pt,
|
||||||
cgpu->total_mhashes / total_secs, opt_log_interval, cgpu->rolling,
|
cgpu->total_mhashes / total_secs, opt_log_interval, cgpu->rolling,
|
||||||
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
|
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
|
||||||
cgpu->utility, intensity);
|
cgpu->utility, intensity,
|
||||||
|
((unsigned long)(cgpu->last_share_pool_time) > 0) ? cgpu->last_share_pool : -1,
|
||||||
|
(unsigned long)(cgpu->last_share_pool_time));
|
||||||
else
|
else
|
||||||
sprintf(buf, "GPU=%d,Enabled=%s,Status=%s,Temperature=%.2f,Fan Speed=%d,Fan Percent=%d,GPU Clock=%d,Memory Clock=%d,GPU Voltage=%.3f,GPU Activity=%d,Powertune=%d,MHS av=%.2f,MHS %ds=%.2f,Accepted=%d,Rejected=%d,Hardware Errors=%d,Utility=%.2f,Intensity=%s%c",
|
sprintf(buf, "GPU=%d,Enabled=%s,Status=%s,Temperature=%.2f,Fan Speed=%d,Fan Percent=%d,GPU Clock=%d,Memory Clock=%d,GPU Voltage=%.3f,GPU Activity=%d,Powertune=%d,MHS av=%.2f,MHS %ds=%.2f,Accepted=%d,Rejected=%d,Hardware Errors=%d,Utility=%.2f,Intensity=%s,Last Share Pool=%d,Last Share Time=%lu%c",
|
||||||
gpu, enabled, status, gt, gf, gp, gc, gm, gv, ga, pt,
|
gpu, enabled, status, gt, gf, gp, gc, gm, gv, ga, pt,
|
||||||
cgpu->total_mhashes / total_secs, opt_log_interval, cgpu->rolling,
|
cgpu->total_mhashes / total_secs, opt_log_interval, cgpu->rolling,
|
||||||
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
|
cgpu->accepted, cgpu->rejected, cgpu->hw_errors,
|
||||||
cgpu->utility, intensity, SEPARATOR);
|
cgpu->utility, intensity,
|
||||||
|
((unsigned long)(cgpu->last_share_pool_time) > 0) ? cgpu->last_share_pool : -1,
|
||||||
|
(unsigned long)(cgpu->last_share_pool_time), SEPARATOR);
|
||||||
|
|
||||||
strcat(io_buffer, buf);
|
strcat(io_buffer, buf);
|
||||||
}
|
}
|
||||||
@ -556,17 +560,21 @@ static void cpustatus(int cpu, bool isjson)
|
|||||||
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
|
cgpu->utility = cgpu->accepted / ( total_secs ? total_secs : 1 ) * 60;
|
||||||
|
|
||||||
if (isjson)
|
if (isjson)
|
||||||
sprintf(buf, "{\"CPU\":%d,\"MHS av\":%.2f,\"MHS %ds\":%.2f,\"Accepted\":%d,\"Rejected\":%d,\"Utility\":%.2f}",
|
sprintf(buf, "{\"CPU\":%d,\"MHS av\":%.2f,\"MHS %ds\":%.2f,\"Accepted\":%d,\"Rejected\":%d,\"Utility\":%.2f,\"Last Share Pool\":%d,\"Last Share Time\":%lu}",
|
||||||
cpu, cgpu->total_mhashes / total_secs,
|
cpu, cgpu->total_mhashes / total_secs,
|
||||||
opt_log_interval, cgpu->rolling,
|
opt_log_interval, cgpu->rolling,
|
||||||
cgpu->accepted, cgpu->rejected,
|
cgpu->accepted, cgpu->rejected,
|
||||||
cgpu->utility);
|
cgpu->utility,
|
||||||
|
((unsigned long)(cgpu->last_share_pool_time) > 0) ? cgpu->last_share_pool : -1,
|
||||||
|
(unsigned long)(cgpu->last_share_pool_time));
|
||||||
else
|
else
|
||||||
sprintf(buf, "CPU=%d,MHS av=%.2f,MHS %ds=%.2f,Accepted=%d,Rejected=%d,Utility=%.2f%c",
|
sprintf(buf, "CPU=%d,MHS av=%.2f,MHS %ds=%.2f,Accepted=%d,Rejected=%d,Utility=%.2f,Last Share Pool=%d,Last Share Time=%lu%c",
|
||||||
cpu, cgpu->total_mhashes / total_secs,
|
cpu, cgpu->total_mhashes / total_secs,
|
||||||
opt_log_interval, cgpu->rolling,
|
opt_log_interval, cgpu->rolling,
|
||||||
cgpu->accepted, cgpu->rejected,
|
cgpu->accepted, cgpu->rejected,
|
||||||
cgpu->utility, SEPARATOR);
|
cgpu->utility,
|
||||||
|
((unsigned long)(cgpu->last_share_pool_time) > 0) ? cgpu->last_share_pool : -1,
|
||||||
|
(unsigned long)(cgpu->last_share_pool_time), SEPARATOR);
|
||||||
|
|
||||||
strcat(io_buffer, buf);
|
strcat(io_buffer, buf);
|
||||||
}
|
}
|
||||||
|
77
miner.php
77
miner.php
@ -18,6 +18,7 @@ td.sta { color:green; font-family:verdana,arial,sans; font-size:14pt; }
|
|||||||
<script type='text/javascript'>
|
<script type='text/javascript'>
|
||||||
function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location="<? echo $here ?>"+a}
|
function pr(a,m){if(m!=null){if(!confirm(m+'?'))return}window.location="<? echo $here ?>"+a}
|
||||||
function prs(a){var c=a.substr(3);var z=c.split('|',2);var m=z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' GPU '+z[1];pr('?arg='+a,m)}
|
function prs(a){var c=a.substr(3);var z=c.split('|',2);var m=z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' GPU '+z[1];pr('?arg='+a,m)}
|
||||||
|
function prs2(a,n){var v=document.getElementById('gi'+n).value;var c=a.substr(3);var z=c.split('|',2);var m='Set GPU '+z[1]+' '+z[0].substr(0,1).toUpperCase()+z[0].substr(1)+' to '+v;pr('?arg='+a+','+v,m)}
|
||||||
</script>
|
</script>
|
||||||
<table width=100% height=100% border=0 cellpadding=0 cellspacing=0 summary='Mine'>
|
<table width=100% height=100% border=0 cellpadding=0 cellspacing=0 summary='Mine'>
|
||||||
<tr><td align=center valign=top>
|
<tr><td align=center valign=top>
|
||||||
@ -156,6 +157,9 @@ function fmt($section, $name, $value)
|
|||||||
|
|
||||||
switch ($section.'.'.$name)
|
switch ($section.'.'.$name)
|
||||||
{
|
{
|
||||||
|
case 'GPU0.Last Share Time':
|
||||||
|
return date('H:i:s', $value);
|
||||||
|
break;
|
||||||
case 'SUMMARY.Elapsed':
|
case 'SUMMARY.Elapsed':
|
||||||
$s = $value % 60;
|
$s = $value % 60;
|
||||||
$value -= $s;
|
$value -= $s;
|
||||||
@ -258,33 +262,69 @@ function details($list)
|
|||||||
echo $te;
|
echo $te;
|
||||||
}
|
}
|
||||||
#
|
#
|
||||||
function gpubuttons($count)
|
global $devs;
|
||||||
|
$devs = null;
|
||||||
|
#
|
||||||
|
function gpubuttons($count, $info)
|
||||||
{
|
{
|
||||||
|
global $devs;
|
||||||
|
|
||||||
|
$basic = array( 'GPU', 'Enable', 'Disable', 'Restart' );
|
||||||
|
|
||||||
|
$options = array( 'intensity' => 'Intensity',
|
||||||
|
'fan' => 'Fan Percent',
|
||||||
|
'engine' => 'GPU Clock',
|
||||||
|
'mem' => 'Memory Clock',
|
||||||
|
'vddc' => 'GPU Voltage' );
|
||||||
|
|
||||||
$tb = '<tr><td><table border=1 cellpadding=5 cellspacing=0>';
|
$tb = '<tr><td><table border=1 cellpadding=5 cellspacing=0>';
|
||||||
$te = '</table></td></tr>';
|
$te = '</table></td></tr>';
|
||||||
|
|
||||||
echo $tb.'<tr>';
|
echo $tb.'<tr>';
|
||||||
|
|
||||||
for ($i = 0; $i < 4; $i++)
|
foreach ($basic as $head)
|
||||||
{
|
echo "<td>$head</td>";
|
||||||
echo '<td>';
|
|
||||||
|
|
||||||
if ($i == 0)
|
foreach ($options as $name => $des)
|
||||||
echo 'GPU';
|
echo "<td nowrap>$des</td>";
|
||||||
else
|
|
||||||
echo ' ';
|
|
||||||
|
|
||||||
echo '</td>';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
$n = 0;
|
||||||
for ($c = 0; $c < $count; $c++)
|
for ($c = 0; $c < $count; $c++)
|
||||||
{
|
{
|
||||||
echo '</tr><tr>';
|
echo '</tr><tr>';
|
||||||
|
|
||||||
echo "<td>$c</td>";
|
foreach ($basic as $name)
|
||||||
echo "<td><input type=button value='Enable $c' onclick='prs(\"gpuenable|$c\")'></td>";
|
{
|
||||||
echo "<td><input type=button value='Disable $c' onclick='prs(\"gpudisable|$c\")'></td>";
|
echo '<td>';
|
||||||
echo "<td><input type=button value='Restart $c' onclick='prs(\"gpurestart|$c\")'></td>";
|
|
||||||
|
if ($name == 'GPU')
|
||||||
|
echo $c;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
echo "<input type=button value='$name $c' onclick='prs(\"gpu";
|
||||||
|
echo strtolower($name);
|
||||||
|
echo "|$c\")'>";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($options as $name => $des)
|
||||||
|
{
|
||||||
|
echo '<td>';
|
||||||
|
if (!isset($devs["GPU$c"][$des]))
|
||||||
|
echo ' ';
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$value = $devs["GPU$c"][$des];
|
||||||
|
echo "<input type=button value='Set $c:' onclick='prs2(\"gpu$name|$c\",$n)'>";
|
||||||
|
echo "<input size=7 type=text name=gi$n value='$value' id=gi$n>";
|
||||||
|
$n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '</td>';
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</tr>'.$te;
|
echo '</tr>'.$te;
|
||||||
@ -315,7 +355,7 @@ function processgpus($rd, $ro)
|
|||||||
#
|
#
|
||||||
function process($cmds, $rd, $ro)
|
function process($cmds, $rd, $ro)
|
||||||
{
|
{
|
||||||
global $error;
|
global $error, $devs;
|
||||||
|
|
||||||
foreach ($cmds as $cmd => $des)
|
foreach ($cmds as $cmd => $des)
|
||||||
{
|
{
|
||||||
@ -331,6 +371,8 @@ function process($cmds, $rd, $ro)
|
|||||||
{
|
{
|
||||||
details($process);
|
details($process);
|
||||||
echo '<tr><td><br><br></td></tr>';
|
echo '<tr><td><br><br></td></tr>';
|
||||||
|
if ($cmd == 'devs')
|
||||||
|
$devs = $process;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -356,7 +398,8 @@ function display()
|
|||||||
|
|
||||||
$cmds = array( 'devs' => 'device list',
|
$cmds = array( 'devs' => 'device list',
|
||||||
'summary' => 'summary information',
|
'summary' => 'summary information',
|
||||||
'pools' => 'pool list');
|
'pools' => 'pool list',
|
||||||
|
'config' => 'cgminer config');
|
||||||
|
|
||||||
process($cmds, $rd, $ro);
|
process($cmds, $rd, $ro);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user