diff --git a/api.cpp b/api.cpp index a83c7cd..d473add 100644 --- a/api.cpp +++ b/api.cpp @@ -124,7 +124,6 @@ static void gpustatus(int thr_id) struct cgpu_info *cgpu = &thr_info[thr_id].gpu; int gpuid = cgpu->gpu_id; char buf[512]; *buf = '\0'; - char pstate[8]; char* card; #ifdef USE_WRAPNVML @@ -132,7 +131,6 @@ static void gpustatus(int thr_id) cgpu->gpu_bus = gpu_busid(cgpu); cgpu->gpu_temp = gpu_temp(cgpu); cgpu->gpu_fan = gpu_fanpercent(cgpu); - cgpu->gpu_pstate = gpu_pstate(cgpu); #endif gpu_clocks(cgpu); @@ -153,16 +151,12 @@ static void gpustatus(int thr_id) cgpu->khashes = stats_get_speed(cgpu->gpu_id, 0.0) / 1000.0; - memset(pstate, 0, sizeof(pstate)); - if (cgpu->gpu_pstate != -1) - snprintf(pstate, sizeof(pstate), "P%hu", cgpu->gpu_pstate); - card = device_name[gpuid]; snprintf(buf, sizeof(buf), "GPU=%d;BUS=%hd;CARD=%s;" - "TEMP=%.1f;FAN=%d;FREQ=%d;PST=%s;KHS=%.2f;HWF=%d;I=%d|", + "TEMP=%.1f;FAN=%d;FREQ=%d;KHS=%.2f;HWF=%d;I=%d|", gpuid, cgpu->gpu_bus, card, cgpu->gpu_temp, cgpu->gpu_fan, - cgpu->gpu_clock, pstate, cgpu->khashes, + cgpu->gpu_clock, cgpu->khashes, cgpu->hw_errors, cgpu->intensity); // append to buffer for multi gpus diff --git a/api/index.php b/api/index.php index de15c8d..c232398 100644 --- a/api/index.php +++ b/api/index.php @@ -42,7 +42,7 @@ function translateField($key) $intl['ALGO'] = 'Algorithm'; $intl['GPUS'] = 'GPUs'; $intl['CPUS'] = 'Threads'; - $intl['KHS'] = 'Hash rate (kH/s)'; + $intl['KHS'] = 'Hash rate'; $intl['ACC'] = 'Accepted shares'; $intl['ACCMN'] = 'Accepted / mn'; $intl['REJ'] = 'Rejected'; @@ -59,6 +59,12 @@ function translateField($key) $intl['FREQ'] = 'Freq.'; $intl['PST'] = 'P-State'; + // pool infos + $intl['POOL'] = 'Pool'; + $intl['PING'] = 'Ping (ms)'; + $intl['DISCO'] = 'Disconnects'; + $intl['USER'] = 'User'; + if (isset($intl[$key])) return $intl[$key]; else @@ -87,15 +93,44 @@ function translateValue($key,$val,$data=array()) case 'TS': $val = strftime("%H:%M:%S", (int) $val); break; + case 'KHS': + $val = ''.$val.' kH/s'; + break; + case 'NAME': + case 'POOL'; + case 'USER': + // long fields + $val = ''.$val.''; + break; } return $val; } +function filterPoolInfos($stats) +{ + $keys = array('USER','H','PING','DISCO'); + $data = array(); + $pool = array_pop($stats); + // simplify URL to host only + $data['POOL'] = $pool['URL']; + if (strstr($pool['URL'],'://')) { + $parts = explode(':', $pool['URL']); + $data['POOL'] = substr($parts[1],2); + } + foreach ($pool as $key=>$val) { + if (in_array($key, $keys)) + $data[$key] = $val; + } + return $data; +} + function displayData($data) { $htm = ''; $totals = array(); foreach ($data as $name => $stats) { + if (!isset($stats['summary'])) + continue; $htm .= ''."\n"; $htm .= '\n"; if (!empty($stats)) { @@ -107,6 +142,17 @@ function displayData($data) } if (isset($summary['KHS'])) @ $totals[$summary['ALGO']] += floatval($summary['KHS']); + + if (isset($stats['pool']) && !empty($stats['pool']) ) { + $pool = filterPoolInfos($stats['pool']); + $htm .= ''."\n"; + foreach ($pool as $key=>$val) { + if (!empty($val) && !ignoreField($key)) + $htm .= ''. + '\n"; + } + } + foreach ($stats['threads'] as $g=>$gpu) { $card = isset($gpu['CARD']) ? $gpu['CARD'] : ''; $htm .= '\n"; @@ -133,7 +179,6 @@ function displayData($data) $data = getdataFromPeers(); ?> - ccminer rig api sample @@ -186,6 +231,8 @@ div.totals h2 { color: darkcyan; font-size: 16px; margin-bottom: 4px; } div.totals li { list-style-type: none; font-size: 16px; margin-left: 4px; margin-bottom: 8px; } li span.algo { display: inline-block; width: 100px; max-width: 180px; } +span.bold { color: #bb99aa; } +span.elipsis { display: inline-block; max-width: 130px; overflow: hidden; } diff --git a/api/local-sample.php b/api/local-sample.php index 3d3b2e8..33ed49c 100644 --- a/api/local-sample.php +++ b/api/local-sample.php @@ -127,11 +127,11 @@ error_reporting(0); $summary = request('summary'); $threads = request('threads'); -$histo = request('histo'); +$pool = request('pool'); ob_end_clean(); /* swap to debug */ //echo ob_get_clean()."\n"; header("Content-Type: application/json"); -echo json_encode(compact('summary', 'threads', 'histo'))."\n"; +echo json_encode(compact('summary', 'threads', 'pool'))."\n"; ?>
'.$name."
POOL
'.translateField($key).''.translateValue($key, $val)."
'.$g." $card