Browse Source

stats: fix multi gpu value + add average parameter (-N)

master
Tanguy Pruvot 10 years ago
parent
commit
e1c84da07f
  1. 2
      configure.ac
  2. 13
      cpu-miner.c
  3. 6
      cpuminer-config.h
  4. 8
      stats.cpp

2
configure.ac

@ -1,4 +1,4 @@ @@ -1,4 +1,4 @@
AC_INIT([ccminer], [1.4.7])
AC_INIT([ccminer], [1.4.8])
AC_PREREQ([2.59c])
AC_CANONICAL_SYSTEM

13
cpu-miner.c

@ -235,6 +235,7 @@ static unsigned long accepted_count = 0L; @@ -235,6 +235,7 @@ static unsigned long accepted_count = 0L;
static unsigned long rejected_count = 0L;
static double *thr_hashrates;
uint64_t global_hashrate = 0;
int opt_statsavg = 20;
uint32_t opt_work_size = 0; /* default */
@ -299,6 +300,7 @@ Options:\n\ @@ -299,6 +300,7 @@ Options:\n\
-T, --timeout=N network timeout, in seconds (default: 270)\n\
-s, --scantime=N upper bound on time spent scanning current work when\n\
long polling is unavailable, in seconds (default: 5)\n\
-N, --statsavg number of samples used to display hashrate (default: 20)\n\
--no-longpoll disable X-Long-Polling support\n\
--no-stratum disable X-Stratum support\n\
-q, --quiet disable per-thread hashmeter output\n\
@ -328,7 +330,7 @@ static char const short_options[] = @@ -328,7 +330,7 @@ static char const short_options[] =
#ifdef HAVE_SYSLOG_H
"S"
#endif
"a:c:i:Dhp:Px:qr:R:s:t:T:o:u:O:Vd:f:mv:";
"a:c:i:Dhp:Px:qr:R:s:t:T:o:u:O:Vd:f:mv:N:";
static struct option const options[] = {
{ "algo", 1, NULL, 'a' },
@ -352,6 +354,7 @@ static struct option const options[] = { @@ -352,6 +354,7 @@ static struct option const options[] = {
{ "retries", 1, NULL, 'r' },
{ "retry-pause", 1, NULL, 'R' },
{ "scantime", 1, NULL, 's' },
{ "statsavg", 1, NULL, 'N' },
#ifdef HAVE_SYSLOG_H
{ "syslog", 0, NULL, 'S' },
#endif
@ -1566,7 +1569,7 @@ out: @@ -1566,7 +1569,7 @@ out:
return NULL;
}
#define PROGRAM_VERSION "1.4.7"
#define PROGRAM_VERSION "1.4.8"
static void show_version_and_exit(void)
{
printf("%s v%s\n"
@ -1637,6 +1640,12 @@ static void parse_arg(int key, char *arg) @@ -1637,6 +1640,12 @@ static void parse_arg(int key, char *arg)
case 'D':
opt_debug = true;
break;
case 'N':
v = atoi(arg);
if (v < 1)
opt_statsavg = INT_MAX;
opt_statsavg = v;
break;
case 'q':
opt_quiet = true;
break;

6
cpuminer-config.h

@ -156,7 +156,7 @@ @@ -156,7 +156,7 @@
#define PACKAGE_NAME "ccminer"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "ccminer 1.4.7"
#define PACKAGE_STRING "ccminer 1.4.8"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ccminer"
@ -165,7 +165,7 @@ @@ -165,7 +165,7 @@
#define PACKAGE_URL ""
/* Define to the version of this package. */
#define PACKAGE_VERSION "1.4.7"
#define PACKAGE_VERSION "1.4.8"
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
@ -188,7 +188,7 @@ @@ -188,7 +188,7 @@
#define USE_XOP 1
/* Version number of package */
#define VERSION "1.4.7"
#define VERSION "1.4.8"
/* Define curl_free() as free() if our version of curl lacks curl_free. */
/* #undef curl_free */

8
stats.cpp

@ -25,10 +25,11 @@ static std::map<uint64_t, stats_data> tlastscans; @@ -25,10 +25,11 @@ static std::map<uint64_t, stats_data> tlastscans;
static uint64_t uid = 0;
#define STATS_AVG_SAMPLES 20
#define STATS_PURGE_TIMEOUT 5*60
#define STATS_PURGE_TIMEOUT 180*60 /* 180 mn */
extern uint64_t global_hashrate;
extern int opt_n_threads;
extern int opt_statsavg;
extern int device_map[8];
/**
@ -75,7 +76,7 @@ extern "C" double stats_get_speed(int thr_id) @@ -75,7 +76,7 @@ extern "C" double stats_get_speed(int thr_id)
int records = 0;
std::map<uint64_t, stats_data>::reverse_iterator i = tlastscans.rbegin();
while (i != tlastscans.rend() && records < STATS_AVG_SAMPLES) {
while (i != tlastscans.rend() && records < opt_statsavg) {
if (!i->second.ignored)
if (thr_id == -1 || (keypfx & i->first) == keypfx) {
if (i->second.hashcount > 1000) {
@ -87,6 +88,9 @@ extern "C" double stats_get_speed(int thr_id) @@ -87,6 +88,9 @@ extern "C" double stats_get_speed(int thr_id)
}
if (records)
speed /= (double)(records);
if (thr_id == -1)
speed *= (double)(opt_n_threads);
return speed;
}

Loading…
Cancel
Save