From ba7c4892fb0bcc3682421f50815add39ce74f105 Mon Sep 17 00:00:00 2001 From: Jan Berdajs Date: Mon, 30 Jun 2014 21:44:44 +0200 Subject: [PATCH] Remove obsolete benchmark mode This mode/setting is unusable left-over from SHA-256 cgminer. It does not work with Scrypt or other algorithms that are used in sgminer. Removed in single commit so it can be used as reference, if benchmark mode is added in the future. --- doc/configuration.md | 17 -------------- sgminer.c | 54 +------------------------------------------- 2 files changed, 1 insertion(+), 70 deletions(-) diff --git a/doc/configuration.md b/doc/configuration.md index caabd13f..30fc9ef0 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -431,7 +431,6 @@ sgminer 4.2.1-116-g2e8b-dirty * [worksize](#worksize) * [xintensity](#xintensity) * [Miscellaneous Options](#miscellaneous-options) - * [benchmark](#benchmark) * [compact](#compact) * [debug](#debug) * [default-profile](#default-profile) @@ -1709,22 +1708,6 @@ See [xintensity](#xintensity). ## Miscellaneous Options -### benchmark - -Runs sgminer in benchmark mode. **This does not produce any shares.** - -*Available*: Global - -*Config File Syntax:* `"benchmark":true` - -*Command Line Syntax:* `--benchmark` - -*Argument:* None - -*Default:* `false` - -[Top](#configuration-and-command-line-options) :: [Config-file and CLI options](#config-file-and-cli-options) :: [Miscellaneous Options](#miscellaneous-options) - ### compact Use a compact display, without per device statistics. diff --git a/sgminer.c b/sgminer.c index 8c4619e9..493ff78b 100644 --- a/sgminer.c +++ b/sgminer.c @@ -168,7 +168,6 @@ static int init_pool; //pool used to initialize gpus bool opt_work_update; bool opt_protocol; -static bool opt_benchmark; bool have_longpoll; bool want_per_device_stats; bool use_syslog; @@ -1385,9 +1384,6 @@ 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, @@ -3352,24 +3348,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) { @@ -3881,9 +3859,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; @@ -7320,8 +7295,7 @@ 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); + reap_curl(pool); /* Get a rolling utility per pool over 10 mins */ if (intervals > 19) { @@ -8386,21 +8360,6 @@ int main(int argc, char *argv[]) //apply pool-specific config from profiles apply_pool_profiles(); - 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; @@ -8538,9 +8497,6 @@ int main(int argc, char *argv[]) // restart_mining_threads(mining_threads); - if (opt_benchmark) - goto begin_bench; - /* Set pool state */ for (i = 0; i < total_pools; i++) { struct pool *pool = pools[i]; @@ -8612,7 +8568,6 @@ int main(int argc, char *argv[]) if(slept >= 60) applog(LOG_WARNING, "GPUs did not become initialized in 60 seconds..."); -begin_bench: total_mhashes_done = 0; for (i = 0; i < total_devices; i++) { struct cgpu_info *cgpu = devices[i]; @@ -8746,13 +8701,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;