mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-25 14:04:34 +00:00
api: fix histo gpu/thr id mismatch
This commit is contained in:
parent
b4ef7b981f
commit
582c971f2b
20
api.cpp
20
api.cpp
@ -8,7 +8,7 @@
|
|||||||
* Software Foundation; either version 2 of the License, or (at your option)
|
* Software Foundation; either version 2 of the License, or (at your option)
|
||||||
* any later version. See COPYING for more details.
|
* any later version. See COPYING for more details.
|
||||||
*/
|
*/
|
||||||
#define APIVERSION "1.1"
|
#define APIVERSION "1.2"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# define _WINSOCK_DEPRECATED_NO_WARNINGS
|
# define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
@ -120,12 +120,11 @@ static void gpustatus(int thr_id)
|
|||||||
{
|
{
|
||||||
if (thr_id >= 0 && thr_id < gpu_threads) {
|
if (thr_id >= 0 && thr_id < gpu_threads) {
|
||||||
struct cgpu_info *cgpu = &thr_info[thr_id].gpu;
|
struct cgpu_info *cgpu = &thr_info[thr_id].gpu;
|
||||||
|
int gpuid = cgpu->gpu_id;
|
||||||
char buf[512]; *buf = '\0';
|
char buf[512]; *buf = '\0';
|
||||||
char pstate[8];
|
char pstate[8];
|
||||||
char* card;
|
char* card;
|
||||||
|
|
||||||
cgpu->thr_id = thr_id;
|
|
||||||
|
|
||||||
#ifdef USE_WRAPNVML
|
#ifdef USE_WRAPNVML
|
||||||
cgpu->has_monitoring = true;
|
cgpu->has_monitoring = true;
|
||||||
cgpu->gpu_temp = gpu_temp(cgpu);
|
cgpu->gpu_temp = gpu_temp(cgpu);
|
||||||
@ -149,13 +148,13 @@ static void gpustatus(int thr_id)
|
|||||||
cgpu->accepted = accepted_count;
|
cgpu->accepted = accepted_count;
|
||||||
cgpu->rejected = rejected_count;
|
cgpu->rejected = rejected_count;
|
||||||
|
|
||||||
cgpu->khashes = stats_get_speed(thr_id, 0.0) / 1000.0;
|
cgpu->khashes = stats_get_speed(cgpu->gpu_id, 0.0) / 1000.0;
|
||||||
|
|
||||||
snprintf(pstate, sizeof(pstate), "P%u", cgpu->gpu_pstate);
|
snprintf(pstate, sizeof(pstate), "P%u", cgpu->gpu_pstate);
|
||||||
if (cgpu->gpu_pstate == -1)
|
if (cgpu->gpu_pstate == -1)
|
||||||
*pstate= '\0';
|
*pstate= '\0';
|
||||||
|
|
||||||
card = device_name[device_map[thr_id]];
|
card = device_name[gpuid];
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "GPU=%d;CARD=%s;TEMP=%.1f;FAN=%d;"
|
snprintf(buf, sizeof(buf), "GPU=%d;CARD=%s;TEMP=%.1f;FAN=%d;"
|
||||||
"FREQ=%d;PST=%s;KHS=%.2f;HWF=%d;I=%d|",
|
"FREQ=%d;PST=%s;KHS=%.2f;HWF=%d;I=%d|",
|
||||||
@ -211,15 +210,16 @@ static char *getthreads(char *params)
|
|||||||
static char *gethistory(char *params)
|
static char *gethistory(char *params)
|
||||||
{
|
{
|
||||||
struct stats_data data[20];
|
struct stats_data data[20];
|
||||||
int thr = params ? atoi(params) : -1;
|
int thrid = params ? atoi(params) : -1;
|
||||||
|
int gpuid = params ? device_map[(thrid & 0x7)] : -1;
|
||||||
char *p = buffer;
|
char *p = buffer;
|
||||||
*buffer = '\0';
|
*buffer = '\0';
|
||||||
int records = stats_get_history(thr, data, ARRAY_SIZE(data));
|
int records = stats_get_history(gpuid, data, ARRAY_SIZE(data));
|
||||||
for (int i = 0; i < records; i++) {
|
for (int i = 0; i < records; i++) {
|
||||||
time_t ts = data[i].tm_stat;
|
time_t ts = data[i].tm_stat;
|
||||||
p += sprintf(p, "GPU=%d;KHS=%.2f;DIFF=%.6f;"
|
p += sprintf(p, "THR=%d|GPU=%d;KHS=%.2f;DIFF=%.6f;"
|
||||||
"COUNT=%u;FOUND=%u;TS=%u|",
|
"COUNT=%u;FOUND=%u;TS=%u|",
|
||||||
data[i].gpu_id, data[i].hashrate, data[i].difficulty,
|
data[i].thr_id, data[i].gpu_id, data[i].hashrate, data[i].difficulty,
|
||||||
data[i].hashcount, data[i].hashfound, (uint32_t)ts);
|
data[i].hashcount, data[i].hashfound, (uint32_t)ts);
|
||||||
}
|
}
|
||||||
return buffer;
|
return buffer;
|
||||||
@ -238,7 +238,7 @@ static char *getmeminfo(char *params)
|
|||||||
totmem = smem + hmem;
|
totmem = smem + hmem;
|
||||||
|
|
||||||
*buffer = '\0';
|
*buffer = '\0';
|
||||||
sprintf(buffer, "STATS=%u;HASHLOG=%u;MEM=%llu|",
|
sprintf(buffer, "STATS=%u;HASHLOG=%u;MEM=%lu|",
|
||||||
srec, hrec, totmem);
|
srec, hrec, totmem);
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
@ -26,7 +26,7 @@ function getdataFromPears()
|
|||||||
|
|
||||||
function ignoreField($key)
|
function ignoreField($key)
|
||||||
{
|
{
|
||||||
$ignored = array('API','VER','GPU','CARD','GPUS','CPU');
|
$ignored = array('API','VER','GPU','CARD','GPUS','CPU','TS');
|
||||||
return in_array($key, $ignored);
|
return in_array($key, $ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,6 +47,8 @@ function translateField($key)
|
|||||||
$intl['UPTIME'] = 'Miner up time';
|
$intl['UPTIME'] = 'Miner up time';
|
||||||
$intl['TS'] = 'Last update';
|
$intl['TS'] = 'Last update';
|
||||||
|
|
||||||
|
$intl['I'] = 'Intensity';
|
||||||
|
|
||||||
$intl['TEMP'] = 'T°c';
|
$intl['TEMP'] = 'T°c';
|
||||||
$intl['FAN'] = 'Fan %';
|
$intl['FAN'] = 'Fan %';
|
||||||
$intl['FREQ'] = 'Freq.';
|
$intl['FREQ'] = 'Freq.';
|
||||||
|
@ -2186,6 +2186,8 @@ int main(int argc, char *argv[])
|
|||||||
thr = &thr_info[i];
|
thr = &thr_info[i];
|
||||||
|
|
||||||
thr->id = i;
|
thr->id = i;
|
||||||
|
thr->gpu.gpu_id = device_map[i];
|
||||||
|
thr->gpu.thr_id = i;
|
||||||
thr->q = tq_new();
|
thr->q = tq_new();
|
||||||
if (!thr->q)
|
if (!thr->q)
|
||||||
return 1;
|
return 1;
|
||||||
|
14
miner.h
14
miner.h
@ -112,6 +112,11 @@ typedef unsigned char uchar;
|
|||||||
# define min(a, b) ((a) < (b) ? (a) : (b))
|
# define min(a, b) ((a) < (b) ? (a) : (b))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef UINT32_MAX
|
||||||
|
/* for gcc 4.4 */
|
||||||
|
#define UINT32_MAX UINT_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
#if ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
||||||
#define WANT_BUILTIN_BSWAP
|
#define WANT_BUILTIN_BSWAP
|
||||||
#else
|
#else
|
||||||
@ -363,21 +368,20 @@ extern int scanhash_x17(int thr_id, uint32_t *pdata,
|
|||||||
void *api_thread(void *userdata);
|
void *api_thread(void *userdata);
|
||||||
|
|
||||||
struct cgpu_info {
|
struct cgpu_info {
|
||||||
int thr_id;
|
uint8_t gpu_id;
|
||||||
|
uint8_t thr_id;
|
||||||
int accepted;
|
int accepted;
|
||||||
int rejected;
|
int rejected;
|
||||||
int hw_errors;
|
int hw_errors;
|
||||||
double khashes;
|
double khashes;
|
||||||
int intensity;
|
uint8_t intensity;
|
||||||
#ifdef USE_WRAPNVML
|
uint8_t has_monitoring;
|
||||||
bool has_monitoring;
|
|
||||||
float gpu_temp;
|
float gpu_temp;
|
||||||
int gpu_fan;
|
int gpu_fan;
|
||||||
int gpu_clock;
|
int gpu_clock;
|
||||||
int gpu_memclock;
|
int gpu_memclock;
|
||||||
int gpu_pstate;
|
int gpu_pstate;
|
||||||
double gpu_vddc;
|
double gpu_vddc;
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct thr_api {
|
struct thr_api {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user