Browse Source

core: remove benchmark mode.

It cannot be used as-is. It should probably  be implemented as a
standalone "fake pool" application anyway, to properly gauge the effect
of queue/scantime/expiry and network latency.

If someone really needs this, they can revert this commit.
refactor
Noel Maersk 11 years ago
parent
commit
a7d2356cef
  1. 2
      Makefile.am
  2. 2
      README.md
  3. 39
      bench_block.h
  4. 82
      miner.c
  5. 1
      miner.h
  6. 1
      winbuild/sgminer.vcxproj
  7. 3
      winbuild/sgminer.vcxproj.filters

2
Makefile.am

@ -33,7 +33,7 @@ endif @@ -33,7 +33,7 @@ endif
sgminer_SOURCES := miner.c miner.h
sgminer_SOURCES += api.c
sgminer_SOURCES += elist.h compat.h bench_block.h
sgminer_SOURCES += elist.h compat.h
sgminer_SOURCES += util.c util.h uthash.h
sgminer_SOURCES += sha2.c sha2.h
sgminer_SOURCES += logging.c logging.h

2
README.md

@ -431,7 +431,7 @@ displayed for Accepted or Rejected work done. An example would be: @@ -431,7 +431,7 @@ displayed for Accepted or Rejected work done. An example would be:
The first 2 hex codes are the previous block hash, the rest are reported in
seconds unless stated otherwise:
The previous hash is followed by the getwork mode used M:X where X is one of
P:Pool, T:Test Pool, L:LP or B:Benchmark,
P:Pool, T:Test Pool or L:LP,
then D:d.ddd is the difficulty required to get a share from the work,
then G:hh:mm:ss:n.nnn, which is when the getwork or LP was sent to the pool and
the n.nnn is how long it took to reply,

39
bench_block.h

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
#if !defined(__BENCH_BLOCK_H__)
#define __BENCH_BLOCK_H__ 1
// Random work pulled from a pool
#define SGMINER_BENCHMARK_BLOCK \
0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0xD8, 0x07, 0x17, 0xC9, 0x13, 0x6F, 0xDC, 0xBE, 0xDE, 0xB7, \
0xB2, 0x14, 0xEF, 0xD1, 0x72, 0x7F, 0xA3, 0x72, 0xB2, 0x5D, 0x88, 0xF0, 0x00, 0x00, 0x05, 0xAA, \
0x00, 0x00, 0x00, 0x00, 0x92, 0x8B, 0x4C, 0x77, 0xF5, 0xB2, 0xE6, 0x56, 0x96, 0x27, 0xE0, 0x66, \
0x3C, 0x5B, 0xDD, 0xDC, 0x88, 0x6A, 0x7D, 0x7C, 0x7B, 0x8C, 0xE4, 0x92, 0x38, 0x92, 0x58, 0x2E, \
0x18, 0x4D, 0x95, 0x9E, 0x4E, 0x44, 0xF1, 0x5F, 0x1A, 0x08, 0xE1, 0xE5, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, \
0x86, 0x7E, 0x3A, 0xAF, 0x37, 0x83, 0xAF, 0xA0, 0xB5, 0x33, 0x2C, 0x28, 0xED, 0xA9, 0x89, 0x3E, \
0x0A, 0xB6, 0x46, 0x81, 0xC2, 0x71, 0x4F, 0x34, 0x5A, 0x74, 0x89, 0x0E, 0x2B, 0x04, 0xB3, 0x16, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, \
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xA0, 0xF6, 0x09, 0x02, 0x00, 0x00, 0x00, 0x00, \
0x55, 0xF1, 0x44, 0x4E, 0x00, 0x00, 0x00, 0x00, 0x79, 0x63, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
#endif // !defined(__BENCH_BLOCK_H__)

82
miner.c

@ -53,7 +53,6 @@ char *curly = ":D"; @@ -53,7 +53,6 @@ char *curly = ":D";
#include "findnonce.h"
#include "adl.h"
#include "driver-opencl.h"
#include "bench_block.h"
#include "algorithm.h"
#include "scrypt.h"
@ -82,7 +81,6 @@ static char packagename[256]; @@ -82,7 +81,6 @@ static char packagename[256];
bool opt_work_update;
bool opt_protocol;
static bool opt_benchmark;
bool have_longpoll;
bool want_per_device_stats;
bool use_syslog;
@ -1182,9 +1180,6 @@ static struct opt_table opt_config_table[] = { @@ -1182,9 +1180,6 @@ static struct opt_table opt_config_table[] = {
OPT_WITHOUT_ARG("--balance",
set_balance, &pool_strategy,
"Change multipool strategy from failover to even share balance"),
OPT_WITHOUT_ARG("--benchmark",
opt_set_bool, &opt_benchmark,
"Run sgminer in benchmark mode - produces no shares"),
#ifdef HAVE_CURSES
OPT_WITHOUT_ARG("--compact",
opt_set_bool, &opt_compact,
@ -3098,24 +3093,6 @@ static void calc_diff(struct work *work, double known) @@ -3098,24 +3093,6 @@ static void calc_diff(struct work *work, double known)
}
}
static void get_benchmark_work(struct work *work)
{
// Use a random work block pulled from a pool
static uint8_t bench_block[] = { SGMINER_BENCHMARK_BLOCK };
size_t bench_size = sizeof(*work);
size_t work_size = sizeof(bench_block);
size_t min_size = (work_size < bench_size ? work_size : bench_size);
memset(work, 0, sizeof(*work));
memcpy(work, &bench_block, min_size);
work->mandatory = true;
work->pool = pools[0];
cgtime(&work->tv_getwork);
copy_time(&work->tv_getwork_reply, &work->tv_getwork);
work->getwork_mode = GETWORK_MODE_BENCHMARK;
calc_diff(work, 0);
}
#ifdef HAVE_CURSES
static void disable_curses_windows(void)
{
@ -3624,9 +3601,6 @@ static bool stale_work(struct work *work, bool share) @@ -3624,9 +3601,6 @@ static bool stale_work(struct work *work, bool share)
struct pool *pool;
int getwork_delay;
if (opt_benchmark)
return false;
if (work->work_block != work_block) {
applog(LOG_DEBUG, "Work stale due to block mismatch");
return true;
@ -7057,33 +7031,6 @@ void reinit_device(struct cgpu_info *cgpu) @@ -7057,33 +7031,6 @@ void reinit_device(struct cgpu_info *cgpu)
static struct timeval rotate_tv;
/* We reap curls if they are unused for over a minute */
static void reap_curl(struct pool *pool)
{
struct curl_ent *ent, *iter;
struct timeval now;
int reaped = 0;
cgtime(&now);
mutex_lock(&pool->pool_lock);
list_for_each_entry_safe(ent, iter, &pool->curlring, node) {
if (pool->curls < 2)
break;
if (now.tv_sec - ent->tv.tv_sec > 300) {
reaped++;
pool->curls--;
list_del(&ent->node);
curl_easy_cleanup(ent->curl);
free(ent);
}
}
mutex_unlock(&pool->pool_lock);
if (reaped)
applog(LOG_DEBUG, "Reaped %d curl%s from %s", reaped, reaped > 1 ? "s" : "", pool->name);
}
static void *watchpool_thread(void __maybe_unused *userdata)
{
int intervals = 0;
@ -7105,9 +7052,6 @@ static void *watchpool_thread(void __maybe_unused *userdata) @@ -7105,9 +7052,6 @@ static void *watchpool_thread(void __maybe_unused *userdata)
for (i = 0; i < total_pools; i++) {
struct pool *pool = pools[i];
if (!opt_benchmark)
reap_curl(pool);
/* Get a rolling utility per pool over 10 mins */
if (intervals > 19) {
int shares = pool->diff1 - pool->last_shares;
@ -8041,21 +7985,6 @@ int main(int argc, char *argv[]) @@ -8041,21 +7985,6 @@ int main(int argc, char *argv[])
if (!config_loaded)
load_default_config();
if (opt_benchmark) {
struct pool *pool;
// FIXME: executes always (leftover from SHA256d days)
quit(1, "Cannot use benchmark mode with scrypt");
pool = add_pool();
pool->rpc_url = (char *)malloc(255);
strcpy(pool->rpc_url, "Benchmark");
pool->rpc_user = pool->rpc_url;
pool->rpc_pass = pool->rpc_url;
enable_pool(pool);
pool->idle = false;
successful_connect = true;
}
#ifdef HAVE_CURSES
if (opt_realquiet || opt_display_devs)
use_curses = false;
@ -8233,9 +8162,6 @@ int main(int argc, char *argv[]) @@ -8233,9 +8162,6 @@ int main(int argc, char *argv[])
}
}
if (opt_benchmark)
goto begin_bench;
/* Set pool state */
for (i = 0; i < total_pools; i++) {
struct pool *pool = pools[i];
@ -8297,7 +8223,6 @@ int main(int argc, char *argv[]) @@ -8297,7 +8223,6 @@ int main(int argc, char *argv[])
}
} while (!pools_active);
begin_bench:
total_mhashes_done = 0;
for (i = 0; i < total_devices; i++) {
struct cgpu_info *cgpu = devices[i];
@ -8426,13 +8351,6 @@ retry: @@ -8426,13 +8351,6 @@ retry:
continue;
}
if (opt_benchmark) {
get_benchmark_work(work);
applog(LOG_DEBUG, "Generated benchmark work");
stage_work(work);
continue;
}
#ifdef HAVE_LIBCURL
struct curl_ent *ce;

1
miner.h

@ -1301,7 +1301,6 @@ struct pool { @@ -1301,7 +1301,6 @@ struct pool {
#define GETWORK_MODE_TESTPOOL 'T'
#define GETWORK_MODE_POOL 'P'
#define GETWORK_MODE_LP 'L'
#define GETWORK_MODE_BENCHMARK 'B'
#define GETWORK_MODE_STRATUM 'S'
#define GETWORK_MODE_GBT 'G'

1
winbuild/sgminer.vcxproj

@ -272,7 +272,6 @@ exit 0</Command> @@ -272,7 +272,6 @@ exit 0</Command>
<ClInclude Include="..\adl.h" />
<ClInclude Include="..\algorithm.h" />
<ClInclude Include="..\arg-nonnull.h" />
<ClInclude Include="..\bench_block.h" />
<ClInclude Include="..\c++defs.h" />
<ClInclude Include="..\compat.h" />
<ClInclude Include="..\compat\jansson-2.5\src\hashtable.h" />

3
winbuild/sgminer.vcxproj.filters

@ -106,9 +106,6 @@ @@ -106,9 +106,6 @@
<ClInclude Include="..\arg-nonnull.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\bench_block.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\c++defs.h">
<Filter>Header Files</Filter>
</ClInclude>

Loading…
Cancel
Save