From 5c7f583e42e8fa1cf2beec4f86e5bc7cef699085 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 12 Feb 2013 18:21:21 -0800 Subject: [PATCH] - client: suspend_reason is not a bitmap; fix code that acted like it is. --- client/app_control.cpp | 2 +- client/client_state.cpp | 5 +++-- client/client_state.h | 3 ++- client/cs_benchmark.cpp | 8 -------- client/cs_prefs.cpp | 2 +- client/time_stats.cpp | 2 +- doc/links.php | 2 +- 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/client/app_control.cpp b/client/app_control.cpp index 03432607c8..18874ca3bd 100644 --- a/client/app_control.cpp +++ b/client/app_control.cpp @@ -710,7 +710,7 @@ bool ACTIVE_TASK_SET::check_app_exited() { // if we're running benchmarks, exited process // is probably a benchmark process; don't show error // - if (!gstate.are_cpu_benchmarks_running() && log_flags.task_debug) { + if (!gstate.benchmarks_running && log_flags.task_debug) { msg_printf(NULL, MSG_INTERNAL_ERROR, "Process %d not found\n", pid ); diff --git a/client/client_state.cpp b/client/client_state.cpp index 6e32dcf329..c8ffe41522 100644 --- a/client/client_state.cpp +++ b/client/client_state.cpp @@ -131,6 +131,7 @@ CLIENT_STATE::CLIENT_STATE() redirect_io = false; disable_graphics = false; cant_write_state_file = false; + benchmarks_running = false; debt_interval_start = 0; retry_shmem_time = 0; @@ -763,7 +764,7 @@ bool CLIENT_STATE::poll_slow_events() { last_wakeup_time = now; } - if (should_run_cpu_benchmarks() && !are_cpu_benchmarks_running()) { + if (should_run_cpu_benchmarks() && !benchmarks_running) { run_cpu_benchmarks = false; start_cpu_benchmarks(); } @@ -851,7 +852,7 @@ bool CLIENT_STATE::poll_slow_events() { } tasks_suspended = (suspend_reason != 0); - if (suspend_reason & SUSPEND_REASON_BENCHMARKS) { + if (benchmarks_running) { cpu_benchmarks_poll(); } diff --git a/client/client_state.h b/client/client_state.h index d27ffebd70..b02e8ae16d 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -351,11 +351,12 @@ struct CLIENT_STATE { ACTIVE_TASK* get_task(RESULT*); // --------------- cs_benchmark.cpp: + bool benchmarks_running; + bool should_run_cpu_benchmarks(); void start_cpu_benchmarks(); bool cpu_benchmarks_poll(); void abort_cpu_benchmarks(); - bool are_cpu_benchmarks_running(); bool cpu_benchmarks_done(); void cpu_benchmarks_set_defaults(); void print_benchmark_results(); diff --git a/client/cs_benchmark.cpp b/client/cs_benchmark.cpp index 1103112dbf..fd706da6f8 100644 --- a/client/cs_benchmark.cpp +++ b/client/cs_benchmark.cpp @@ -117,7 +117,6 @@ struct BENCHMARK_DESC { }; static BENCHMARK_DESC* benchmark_descs=0; -static bool benchmarks_running=false; // at least 1 benchmark thread running static double cpu_benchmarks_start; static int bm_ncpus; // user might change ncpus during benchmarks. @@ -560,10 +559,3 @@ void CLIENT_STATE::cpu_benchmarks_set_defaults() { if (!host_info.p_membw) host_info.p_membw = DEFAULT_MEMBW; if (!host_info.m_cache) host_info.m_cache = DEFAULT_CACHE; } - -// return true if any CPU benchmark thread/process is running -// -bool CLIENT_STATE::are_cpu_benchmarks_running() { - return benchmarks_running; -} - diff --git a/client/cs_prefs.cpp b/client/cs_prefs.cpp index 74bd444e05..8934a42636 100644 --- a/client/cs_prefs.cpp +++ b/client/cs_prefs.cpp @@ -204,7 +204,7 @@ void CLIENT_STATE::get_disk_shares() { // and if it's zero set gpu_suspend_reason // int CLIENT_STATE::check_suspend_processing() { - if (are_cpu_benchmarks_running()) { + if (benchmarks_running) { return SUSPEND_REASON_BENCHMARKS; } diff --git a/client/time_stats.cpp b/client/time_stats.cpp index 67170461ac..fa23d858a7 100644 --- a/client/time_stats.cpp +++ b/client/time_stats.cpp @@ -155,7 +155,7 @@ void CLIENT_TIME_STATS::get_log_after(double t, MIOFILE& mf) { void CLIENT_TIME_STATS::update(int suspend_reason, int _gpu_suspend_reason) { double dt, w1, w2; - bool is_active = !(suspend_reason & ~SUSPEND_REASON_CPU_THROTTLE); + bool is_active = (suspend_reason == 0) || (suspend_reason == SUSPEND_REASON_CPU_THROTTLE); bool is_gpu_active = is_active && !_gpu_suspend_reason; if (last_update == 0) { // this is the first time this client has executed. diff --git a/doc/links.php b/doc/links.php index 343cc925ea..f64720afba 100644 --- a/doc/links.php +++ b/doc/links.php @@ -258,7 +258,7 @@ language("Finnish", array( //), )); language("French", array( - //site("http://boinc.starwars-holonet.com/", "Star Wars [FR]"), + site("http://boinc.starwars-holonet.com/", "Star Wars [FR]"), //site("http://wwww.boinc-2tf.org", "2TF Asso"), //site("http://boincfrance.org", "BOINCFRANCE.ORG"), site("http://www.boinc-af.org", "L'Alliance Francophone"),