2005-01-20 23:22:22 +00:00
|
|
|
// Berkeley Open Infrastructure for Network Computing
|
|
|
|
// http://boinc.berkeley.edu
|
|
|
|
// Copyright (C) 2005 University of California
|
2003-08-01 21:20:20 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU Lesser General Public
|
|
|
|
// License as published by the Free Software Foundation;
|
|
|
|
// either version 2.1 of the License, or (at your option) any later version.
|
2003-08-01 21:20:20 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// This software is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
// See the GNU Lesser General Public License for more details.
|
2002-04-30 22:22:54 +00:00
|
|
|
//
|
2005-01-20 23:22:22 +00:00
|
|
|
// To view the GNU Lesser General Public License visit
|
|
|
|
// http://www.gnu.org/copyleft/lesser.html
|
|
|
|
// or write to the Free Software Foundation, Inc.,
|
|
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2002-07-15 05:34:32 +00:00
|
|
|
#ifndef _CLIENT_STATE_
|
|
|
|
#define _CLIENT_STATE_
|
|
|
|
|
2004-03-04 11:41:43 +00:00
|
|
|
#ifndef _WIN32
|
2007-03-13 19:33:27 +00:00
|
|
|
#include <string>
|
2002-04-30 22:22:54 +00:00
|
|
|
#include <vector>
|
2004-07-13 13:54:09 +00:00
|
|
|
#include <ctime>
|
2004-03-04 11:41:43 +00:00
|
|
|
#endif
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2006-02-18 08:33:23 +00:00
|
|
|
using std::string;
|
|
|
|
using std::vector;
|
|
|
|
|
2005-02-06 21:26:21 +00:00
|
|
|
#include "acct_mgr.h"
|
2005-08-05 22:00:19 +00:00
|
|
|
#include "acct_setup.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "app.h"
|
2002-06-21 06:52:47 +00:00
|
|
|
#include "client_types.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "file_xfer.h"
|
2004-01-21 07:07:16 +00:00
|
|
|
#include "gui_rpc_server.h"
|
2005-08-05 18:41:46 +00:00
|
|
|
#include "gui_http.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "hostinfo.h"
|
2004-06-12 04:45:36 +00:00
|
|
|
#include "miofile.h"
|
2002-06-21 06:52:47 +00:00
|
|
|
#include "net_stats.h"
|
2002-08-07 22:52:10 +00:00
|
|
|
#include "pers_file_xfer.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "prefs.h"
|
2002-06-21 06:52:47 +00:00
|
|
|
#include "scheduler_op.h"
|
2003-05-29 23:25:15 +00:00
|
|
|
#include "ss_logic.h"
|
2002-04-30 22:22:54 +00:00
|
|
|
#include "time_stats.h"
|
2005-08-09 22:01:28 +00:00
|
|
|
#include "http_curl.h"
|
|
|
|
|
2005-05-06 19:09:41 +00:00
|
|
|
#define WORK_FETCH_DONT_NEED 0
|
2005-06-07 21:21:35 +00:00
|
|
|
// project: suspended, deferred, or no new work (can't ask for more work)
|
|
|
|
// overall: not work_fetch_ok (from CPU policy)
|
2005-05-09 04:49:56 +00:00
|
|
|
#define WORK_FETCH_OK 1
|
2005-06-07 21:21:35 +00:00
|
|
|
// project: has more than min queue * share, not suspended/def/nonewwork
|
|
|
|
// overall: at least min queue, work fetch OK
|
2005-05-09 04:49:56 +00:00
|
|
|
#define WORK_FETCH_NEED 2
|
2005-06-07 21:21:35 +00:00
|
|
|
// project: less than min queue * resource share of DL/runnable results
|
|
|
|
// overall: less than min queue
|
2005-05-09 04:49:56 +00:00
|
|
|
#define WORK_FETCH_NEED_IMMEDIATELY 3
|
2005-06-07 21:21:35 +00:00
|
|
|
// project: no downloading or runnable results
|
|
|
|
// overall: at least one idle CPU
|
2004-06-30 01:10:22 +00:00
|
|
|
|
2003-10-27 17:10:48 +00:00
|
|
|
// CLIENT_STATE encapsulates the global variables of the core client.
|
|
|
|
// If you add anything here, initialize it in the constructor
|
2002-08-26 22:57:17 +00:00
|
|
|
//
|
2002-04-30 22:22:54 +00:00
|
|
|
class CLIENT_STATE {
|
|
|
|
public:
|
2007-05-07 19:38:27 +00:00
|
|
|
vector<PLATFORM> platforms;
|
2006-02-18 08:33:23 +00:00
|
|
|
vector<PROJECT*> projects;
|
|
|
|
vector<APP*> apps;
|
|
|
|
vector<FILE_INFO*> file_infos;
|
|
|
|
vector<APP_VERSION*> app_versions;
|
|
|
|
vector<WORKUNIT*> workunits;
|
|
|
|
vector<RESULT*> results;
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-07-29 23:26:32 +00:00
|
|
|
PERS_FILE_XFER_SET* pers_file_xfers;
|
2002-04-30 22:22:54 +00:00
|
|
|
HTTP_OP_SET* http_ops;
|
|
|
|
FILE_XFER_SET* file_xfers;
|
|
|
|
ACTIVE_TASK_SET active_tasks;
|
|
|
|
HOST_INFO host_info;
|
2002-09-29 00:32:11 +00:00
|
|
|
GLOBAL_PREFS global_prefs;
|
2002-08-26 22:57:17 +00:00
|
|
|
NET_STATS net_stats;
|
2003-05-09 20:33:57 +00:00
|
|
|
SS_LOGIC ss_logic;
|
2004-01-21 07:07:16 +00:00
|
|
|
GUI_RPC_CONN_SET gui_rpcs;
|
2004-03-04 19:38:31 +00:00
|
|
|
TIME_STATS time_stats;
|
2004-09-26 04:16:52 +00:00
|
|
|
PROXY_INFO proxy_info;
|
2005-08-05 18:41:46 +00:00
|
|
|
GUI_HTTP gui_http;
|
2002-08-26 22:57:17 +00:00
|
|
|
|
2006-12-14 00:42:43 +00:00
|
|
|
VERSION_INFO core_client_version;
|
2006-02-18 08:33:23 +00:00
|
|
|
string statefile_platform_name;
|
2003-03-16 21:59:11 +00:00
|
|
|
int file_xfer_giveup_period;
|
2006-11-10 17:55:22 +00:00
|
|
|
MODE run_mode;
|
|
|
|
MODE network_mode;
|
2003-10-22 18:39:22 +00:00
|
|
|
bool started_by_screensaver;
|
2003-01-07 01:02:08 +00:00
|
|
|
bool exit_when_idle;
|
2007-05-29 21:45:01 +00:00
|
|
|
bool exit_before_start;
|
|
|
|
bool exit_after_finish;
|
2004-06-15 00:46:59 +00:00
|
|
|
bool check_all_logins;
|
2006-09-05 19:00:59 +00:00
|
|
|
bool user_active; // there has been recent mouse/kbd input
|
2003-08-14 00:02:15 +00:00
|
|
|
bool return_results_immediately;
|
2004-06-11 00:04:51 +00:00
|
|
|
bool allow_remote_gui_rpc;
|
2005-12-13 08:04:57 +00:00
|
|
|
int cmdline_gui_rpc_port;
|
2003-05-15 17:10:26 +00:00
|
|
|
bool show_projects;
|
2003-04-08 18:36:03 +00:00
|
|
|
bool requested_exit;
|
2003-05-15 17:10:26 +00:00
|
|
|
char detach_project_url[256];
|
|
|
|
// stores URL for -detach_project option
|
|
|
|
char reset_project_url[256];
|
|
|
|
// stores URL for -reset_project option
|
|
|
|
char update_prefs_url[256];
|
|
|
|
// stores URL for -update_prefs option
|
2004-10-01 08:15:58 +00:00
|
|
|
char main_host_venue[256];
|
|
|
|
// venue from project that gave us general prefs
|
2006-06-02 20:32:20 +00:00
|
|
|
// or from account manager
|
2005-03-23 06:26:19 +00:00
|
|
|
char attach_project_url[256];
|
|
|
|
char attach_project_auth[256];
|
2003-03-31 23:18:55 +00:00
|
|
|
bool exit_before_upload;
|
|
|
|
// exit when about to upload a file
|
2006-06-10 05:36:25 +00:00
|
|
|
#ifndef _WIN32
|
2006-06-10 05:27:28 +00:00
|
|
|
gid_t boinc_project_gid;
|
2006-06-10 05:36:25 +00:00
|
|
|
#endif
|
2005-12-06 03:18:02 +00:00
|
|
|
|
|
|
|
// backoff-related variables
|
|
|
|
//
|
|
|
|
int master_fetch_period;
|
|
|
|
// fetch project's master URL (and stop doing scheduler RPCs)
|
|
|
|
// if get this many successive RPC failures (default 10)
|
|
|
|
int retry_cap;
|
|
|
|
// cap project->nrpc_failures at this number
|
|
|
|
int master_fetch_retry_cap;
|
|
|
|
// after this many master-fetch failures,
|
|
|
|
// move into a state in which we retry master fetch
|
|
|
|
// at the frequency below
|
|
|
|
int master_fetch_interval;
|
|
|
|
// see above
|
|
|
|
|
|
|
|
int sched_retry_delay_min;
|
|
|
|
int sched_retry_delay_max;
|
|
|
|
int pers_retry_delay_min;
|
|
|
|
int pers_retry_delay_max;
|
|
|
|
int pers_giveup;
|
|
|
|
|
2005-12-24 06:32:07 +00:00
|
|
|
bool tasks_suspended;
|
|
|
|
// Don't do CPU. See check_suspend_activities for logic
|
2004-04-01 23:19:13 +00:00
|
|
|
bool network_suspended;
|
2005-12-24 06:32:07 +00:00
|
|
|
// Don't do network. See check_suspend_network for logic
|
2006-08-07 03:56:34 +00:00
|
|
|
int suspend_reason;
|
|
|
|
int network_suspend_reason;
|
2005-01-07 20:47:40 +00:00
|
|
|
bool executing_as_daemon;
|
2005-12-24 06:32:07 +00:00
|
|
|
// true if --daemon is on the commandline
|
|
|
|
// this means we are running as a daemon on unix,
|
|
|
|
// or as a service on Windows
|
2005-02-01 00:54:06 +00:00
|
|
|
bool redirect_io;
|
2005-04-01 08:03:27 +00:00
|
|
|
// redirect stdout, stderr to log files
|
2006-03-16 20:29:44 +00:00
|
|
|
bool disable_graphics;
|
2006-12-13 00:54:27 +00:00
|
|
|
// a condition has occurred in which we know graphics will
|
|
|
|
// not be displayable.
|
|
|
|
// So GUIs shouldn't offer graphics.
|
2005-12-01 08:07:07 +00:00
|
|
|
bool detach_console;
|
2006-12-13 00:54:27 +00:00
|
|
|
bool launched_by_manager;
|
|
|
|
// this affects auto-update
|
2007-04-09 02:17:26 +00:00
|
|
|
bool run_by_updater;
|
2005-06-07 19:22:50 +00:00
|
|
|
double now;
|
2007-05-14 21:45:02 +00:00
|
|
|
double last_wakeup_time;
|
2006-08-03 16:39:57 +00:00
|
|
|
bool initialized;
|
2002-12-09 23:51:55 +00:00
|
|
|
|
2002-08-12 22:26:32 +00:00
|
|
|
private:
|
2002-08-22 21:04:42 +00:00
|
|
|
bool client_state_dirty;
|
2003-05-15 17:10:26 +00:00
|
|
|
int old_major_version;
|
|
|
|
int old_minor_version;
|
2005-09-01 19:27:04 +00:00
|
|
|
int old_release;
|
2003-04-01 03:28:37 +00:00
|
|
|
bool skip_cpu_benchmarks;
|
|
|
|
// if set, use hardwired numbers rather than running benchmarks
|
|
|
|
bool run_cpu_benchmarks;
|
|
|
|
// if set, run benchmarks on client startup
|
2005-07-24 18:23:56 +00:00
|
|
|
bool cpu_benchmarks_pending;
|
|
|
|
// set if a benchmark fails to start because of a process that doesn't stop.
|
|
|
|
// Persists so that the next start of BOINC runs the benchmarks.
|
|
|
|
|
2003-02-12 19:53:46 +00:00
|
|
|
int exit_after_app_start_secs;
|
|
|
|
// if nonzero, exit this many seconds after starting an app
|
2004-10-14 22:01:05 +00:00
|
|
|
double app_started;
|
2003-02-12 19:53:46 +00:00
|
|
|
// when the most recent app was started
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2005-06-21 08:22:18 +00:00
|
|
|
// --------------- acct_mgr.C:
|
|
|
|
public:
|
2005-11-10 06:03:39 +00:00
|
|
|
ACCT_MGR_OP acct_mgr_op;
|
2005-06-21 08:22:18 +00:00
|
|
|
ACCT_MGR_INFO acct_mgr_info;
|
|
|
|
|
2005-09-22 08:46:51 +00:00
|
|
|
// --------------- acct_setup.C:
|
|
|
|
public:
|
|
|
|
PROJECT_INIT project_init;
|
2005-11-10 06:03:39 +00:00
|
|
|
GET_PROJECT_CONFIG_OP get_project_config_op;
|
|
|
|
LOOKUP_ACCOUNT_OP lookup_account_op;
|
|
|
|
CREATE_ACCOUNT_OP create_account_op;
|
|
|
|
LOOKUP_WEBSITE_OP lookup_website_op;
|
|
|
|
PROJECT_ATTACH project_attach;
|
|
|
|
GET_CURRENT_VERSION_OP get_current_version_op;
|
2007-03-04 02:30:48 +00:00
|
|
|
GET_PROJECT_LIST_OP get_project_list_op;
|
2005-11-10 06:03:39 +00:00
|
|
|
void new_version_check();
|
2007-03-19 19:13:40 +00:00
|
|
|
void all_projects_list_check();
|
2005-11-10 06:03:39 +00:00
|
|
|
double new_version_check_time;
|
2007-03-19 19:13:40 +00:00
|
|
|
double all_projects_list_check_time;
|
2006-02-18 08:33:23 +00:00
|
|
|
string newer_version;
|
2005-09-22 08:46:51 +00:00
|
|
|
|
2007-02-21 16:26:51 +00:00
|
|
|
// --------------- app_graphics.C:
|
|
|
|
public:
|
|
|
|
ACTIVE_TASK* get_next_graphics_capable_app();
|
|
|
|
|
2006-12-11 23:42:54 +00:00
|
|
|
// --------------- auto_update.C:
|
|
|
|
public:
|
|
|
|
AUTO_UPDATE auto_update;
|
|
|
|
|
2003-10-19 01:48:32 +00:00
|
|
|
// --------------- client_state.C:
|
|
|
|
public:
|
|
|
|
CLIENT_STATE();
|
2005-07-26 11:55:28 +00:00
|
|
|
void show_host_info();
|
2003-10-19 01:48:32 +00:00
|
|
|
int init();
|
2005-08-16 20:48:21 +00:00
|
|
|
bool poll_slow_events();
|
2003-10-19 01:48:32 +00:00
|
|
|
// Never blocks.
|
|
|
|
// Returns true if it actually did something,
|
|
|
|
// in which case it should be called again immediately.
|
2005-08-16 21:10:28 +00:00
|
|
|
void do_io_or_sleep(double dt);
|
2003-10-19 01:48:32 +00:00
|
|
|
bool time_to_exit();
|
2004-02-28 19:11:40 +00:00
|
|
|
PROJECT* lookup_project(const char*);
|
|
|
|
APP* lookup_app(PROJECT*, const char*);
|
2003-11-02 22:51:49 +00:00
|
|
|
FILE_INFO* lookup_file_info(PROJECT*, const char* name);
|
2004-02-28 19:11:40 +00:00
|
|
|
RESULT* lookup_result(PROJECT*, const char*);
|
|
|
|
WORKUNIT* lookup_workunit(PROJECT*, const char*);
|
2007-05-03 17:14:30 +00:00
|
|
|
APP_VERSION* lookup_app_version(APP*, char* platform, int ver);
|
2003-10-19 01:48:32 +00:00
|
|
|
int detach_project(PROJECT*);
|
2004-10-07 19:18:37 +00:00
|
|
|
int report_result_error(RESULT&, const char *format, ...);
|
2003-10-19 02:54:35 +00:00
|
|
|
int reset_project(PROJECT*);
|
2005-07-23 08:10:39 +00:00
|
|
|
bool no_gui_rpc;
|
2003-10-19 01:48:32 +00:00
|
|
|
private:
|
2002-04-30 22:22:54 +00:00
|
|
|
int link_app(PROJECT*, APP*);
|
2004-09-22 21:08:26 +00:00
|
|
|
int link_file_info(PROJECT*, FILE_INFO*);
|
2002-05-17 22:33:57 +00:00
|
|
|
int link_file_ref(PROJECT*, FILE_REF*);
|
2002-04-30 22:22:54 +00:00
|
|
|
int link_app_version(PROJECT*, APP_VERSION*);
|
|
|
|
int link_workunit(PROJECT*, WORKUNIT*);
|
|
|
|
int link_result(PROJECT*, RESULT*);
|
2003-10-19 01:48:32 +00:00
|
|
|
void print_summary();
|
2005-06-07 19:22:50 +00:00
|
|
|
bool garbage_collect();
|
|
|
|
bool garbage_collect_always();
|
|
|
|
bool update_results();
|
2007-02-23 20:24:52 +00:00
|
|
|
int nresults_for_project(PROJECT*);
|
2003-10-19 01:48:32 +00:00
|
|
|
|
2006-02-08 21:05:51 +00:00
|
|
|
// --------------- cpu_sched.C:
|
|
|
|
private:
|
2006-08-22 20:58:57 +00:00
|
|
|
double debt_interval_start;
|
|
|
|
double total_wall_cpu_time_this_debt_interval;
|
|
|
|
// "wall CPU time" accumulated since last adjust_debts()
|
|
|
|
double total_cpu_time_this_debt_interval;
|
2006-06-19 16:21:35 +00:00
|
|
|
double cpu_shortfall;
|
|
|
|
bool work_fetch_no_new_work;
|
2006-06-15 23:15:27 +00:00
|
|
|
bool must_enforce_cpu_schedule;
|
2006-02-08 21:05:51 +00:00
|
|
|
bool must_schedule_cpus;
|
2006-07-10 00:46:07 +00:00
|
|
|
bool must_check_work_fetch;
|
2006-06-15 23:15:27 +00:00
|
|
|
std::vector <RESULT*> ordered_scheduled_results;
|
2006-02-09 00:56:51 +00:00
|
|
|
void assign_results_to_projects();
|
2006-06-21 17:34:55 +00:00
|
|
|
RESULT* largest_debt_project_best_result();
|
|
|
|
RESULT* earliest_deadline_result();
|
2007-03-15 19:08:22 +00:00
|
|
|
void reset_debt_accounting();
|
2006-02-09 00:56:51 +00:00
|
|
|
void adjust_debts();
|
2006-06-16 18:52:25 +00:00
|
|
|
bool possibly_schedule_cpus();
|
|
|
|
void schedule_cpus();
|
2006-06-15 23:15:27 +00:00
|
|
|
bool enforce_schedule();
|
2006-02-08 21:05:51 +00:00
|
|
|
bool no_work_for_a_cpu();
|
2006-10-03 19:44:54 +00:00
|
|
|
void rr_simulation();
|
2006-06-19 22:20:24 +00:00
|
|
|
void make_running_task_heap(vector<ACTIVE_TASK*>&);
|
2006-06-21 17:34:55 +00:00
|
|
|
void print_deadline_misses();
|
2007-04-03 20:30:44 +00:00
|
|
|
public:
|
2007-06-25 11:46:15 +00:00
|
|
|
double retry_shmem_time;
|
2007-06-25 19:05:29 +00:00
|
|
|
// if we fail to start a task due to no shared-mem segments,
|
|
|
|
// wait until at least this time to try running
|
|
|
|
// another task that needs a shared-mem seg
|
2006-08-23 21:14:47 +00:00
|
|
|
inline double work_buf_min() {
|
|
|
|
return global_prefs.work_buf_min_days * 86400;
|
|
|
|
}
|
2007-03-28 21:30:45 +00:00
|
|
|
inline double work_buf_additional() {
|
|
|
|
return global_prefs.work_buf_additional_days *86400;
|
|
|
|
}
|
2007-04-17 22:24:53 +00:00
|
|
|
inline double work_buf_total() {
|
|
|
|
double x = work_buf_min() + work_buf_additional();
|
|
|
|
if (x < 1) x = 1;
|
|
|
|
return x;
|
|
|
|
}
|
2006-08-03 04:07:18 +00:00
|
|
|
void request_enforce_schedule(const char*);
|
|
|
|
void request_schedule_cpus(const char*);
|
|
|
|
// Check for reschedule CPUs ASAP. Called when:
|
|
|
|
// - core client starts (CS::init())
|
|
|
|
// - an app exits (ATS::check_app_exited())
|
|
|
|
// - Tasks are killed (ATS::exit_tasks())
|
|
|
|
// - a result's input files finish downloading (CS::update_results())
|
|
|
|
// - an app fails to start (CS::schedule_cpus())
|
|
|
|
// - any project op is done via RPC (suspend/resume)
|
|
|
|
// - any result op is done via RPC (suspend/resume)
|
2006-02-08 21:05:51 +00:00
|
|
|
|
2003-10-19 01:48:32 +00:00
|
|
|
// --------------- cs_account.C:
|
2003-10-19 02:54:35 +00:00
|
|
|
public:
|
2005-12-09 22:29:21 +00:00
|
|
|
int add_project(
|
|
|
|
const char* master_url, const char* authenticator,
|
2006-12-26 00:37:25 +00:00
|
|
|
const char* project_name, bool attached_via_acct_mgr
|
2005-12-09 22:29:21 +00:00
|
|
|
);
|
2003-10-19 01:48:32 +00:00
|
|
|
private:
|
|
|
|
int parse_account_files();
|
2006-07-14 21:08:12 +00:00
|
|
|
int parse_account_files_venue();
|
2003-11-02 22:51:49 +00:00
|
|
|
int parse_preferences_for_user_files();
|
2005-04-04 06:02:36 +00:00
|
|
|
int parse_statistics_files();
|
|
|
|
// should be move to a new file, but this will do it for testing
|
2005-01-20 18:50:49 +00:00
|
|
|
|
2003-10-19 01:48:32 +00:00
|
|
|
// --------------- cs_apps.C:
|
2005-04-14 04:25:56 +00:00
|
|
|
private:
|
2005-10-04 21:44:58 +00:00
|
|
|
double total_resource_share();
|
|
|
|
double potentially_runnable_resource_share();
|
2006-06-15 23:15:27 +00:00
|
|
|
double nearly_runnable_resource_share();
|
2007-04-11 21:49:57 +00:00
|
|
|
double fetchable_resource_share();
|
2005-04-14 04:25:56 +00:00
|
|
|
public:
|
2006-01-30 20:01:47 +00:00
|
|
|
double runnable_resource_share();
|
2006-07-10 00:46:07 +00:00
|
|
|
void request_work_fetch(const char*);
|
|
|
|
// Check if work fetch needed. Called when:
|
|
|
|
// - core client starts (CS::init())
|
|
|
|
// - task is completed or fails
|
|
|
|
// - tasks are killed
|
|
|
|
// - an RPC completes
|
|
|
|
// - project suspend/detch/attach/reset GUI RPC
|
|
|
|
// - result suspend/abort GUI RPC
|
2004-05-05 17:48:39 +00:00
|
|
|
int quit_activities();
|
2004-06-30 01:10:22 +00:00
|
|
|
void set_ncpus();
|
2003-10-19 01:48:32 +00:00
|
|
|
double estimate_cpu_time(WORKUNIT&);
|
2004-04-07 06:51:42 +00:00
|
|
|
double get_fraction_done(RESULT* result);
|
2006-06-20 19:34:42 +00:00
|
|
|
int input_files_available(RESULT*, bool);
|
2007-02-21 16:26:51 +00:00
|
|
|
ACTIVE_TASK* lookup_active_task_by_result(RESULT*);
|
2004-06-30 01:10:22 +00:00
|
|
|
int ncpus;
|
2007-01-25 21:36:27 +00:00
|
|
|
// number of usable cpus
|
2005-06-25 00:15:56 +00:00
|
|
|
private:
|
2003-10-19 01:48:32 +00:00
|
|
|
int nslots;
|
|
|
|
|
2007-05-03 17:14:30 +00:00
|
|
|
int latest_version(APP*, char*);
|
2002-04-30 22:22:54 +00:00
|
|
|
int app_finished(ACTIVE_TASK&);
|
2006-01-28 00:17:26 +00:00
|
|
|
bool start_apps();
|
2005-06-07 19:22:50 +00:00
|
|
|
bool handle_finished_apps();
|
2006-01-28 00:17:26 +00:00
|
|
|
public:
|
2006-08-07 00:31:28 +00:00
|
|
|
ACTIVE_TASK* get_task(RESULT*);
|
2003-10-19 01:48:32 +00:00
|
|
|
|
|
|
|
// --------------- cs_benchmark.C:
|
|
|
|
public:
|
|
|
|
bool should_run_cpu_benchmarks();
|
2004-03-21 00:10:15 +00:00
|
|
|
void start_cpu_benchmarks();
|
|
|
|
bool cpu_benchmarks_poll();
|
|
|
|
void abort_cpu_benchmarks();
|
|
|
|
bool are_cpu_benchmarks_running();
|
2006-08-24 20:33:46 +00:00
|
|
|
bool cpu_benchmarks_done();
|
|
|
|
void cpu_benchmarks_set_defaults();
|
2006-11-09 17:01:08 +00:00
|
|
|
void print_benchmark_results();
|
2003-10-19 01:48:32 +00:00
|
|
|
|
|
|
|
// --------------- cs_cmdline.C:
|
|
|
|
public:
|
|
|
|
void parse_cmdline(int argc, char** argv);
|
|
|
|
void parse_env_vars();
|
|
|
|
void do_cmdline_actions();
|
|
|
|
|
|
|
|
// --------------- cs_files.C:
|
|
|
|
public:
|
2006-07-25 16:45:21 +00:00
|
|
|
void check_file_existence();
|
2003-12-02 22:47:32 +00:00
|
|
|
bool start_new_file_xfer(PERS_FILE_XFER&);
|
2003-10-19 01:48:32 +00:00
|
|
|
private:
|
|
|
|
int make_project_dirs();
|
2005-06-07 19:22:50 +00:00
|
|
|
bool handle_pers_file_xfers();
|
2003-10-19 01:48:32 +00:00
|
|
|
|
2007-05-02 17:53:35 +00:00
|
|
|
// --------------- cs_platforms.C:
|
|
|
|
public:
|
|
|
|
const char* get_primary_platform();
|
|
|
|
private:
|
2007-05-06 20:22:39 +00:00
|
|
|
void add_platform(const char*);
|
|
|
|
void detect_platforms();
|
|
|
|
void write_platforms(PROJECT*, MIOFILE&);
|
|
|
|
bool is_supported_platform(const char*);
|
2007-05-02 17:53:35 +00:00
|
|
|
|
2003-10-19 01:48:32 +00:00
|
|
|
// --------------- cs_prefs.C:
|
|
|
|
public:
|
|
|
|
int project_disk_usage(PROJECT*, double&);
|
2003-11-04 22:22:06 +00:00
|
|
|
int total_disk_usage(double&);
|
2003-10-19 01:48:32 +00:00
|
|
|
// returns the total disk usage of BOINC on this host
|
2007-03-27 18:36:22 +00:00
|
|
|
double allowed_disk_usage();
|
2004-08-05 21:42:26 +00:00
|
|
|
int allowed_project_disk_usage(double&);
|
2005-12-24 06:32:07 +00:00
|
|
|
int suspend_tasks(int reason);
|
2006-05-21 22:03:36 +00:00
|
|
|
int resume_tasks(int reason=0);
|
2004-04-01 23:19:13 +00:00
|
|
|
int suspend_network(int reason);
|
|
|
|
int resume_network();
|
2006-06-01 20:53:59 +00:00
|
|
|
void read_global_prefs();
|
2006-06-01 19:03:00 +00:00
|
|
|
int save_global_prefs(char* prefs, char* url, char* sched);
|
2006-10-02 23:42:38 +00:00
|
|
|
double available_ram();
|
|
|
|
double max_available_ram();
|
2006-02-06 21:16:23 +00:00
|
|
|
private:
|
|
|
|
void check_suspend_activities(int&);
|
|
|
|
void check_suspend_network(int&);
|
2003-02-26 00:47:57 +00:00
|
|
|
void install_global_prefs();
|
2004-10-01 08:15:58 +00:00
|
|
|
PROJECT* global_prefs_source_project();
|
2004-03-30 23:05:34 +00:00
|
|
|
void show_global_prefs_source(bool);
|
2002-07-15 05:34:32 +00:00
|
|
|
|
2003-10-19 01:48:32 +00:00
|
|
|
// --------------- cs_scheduler.C:
|
2002-07-15 05:34:32 +00:00
|
|
|
public:
|
2005-05-31 23:43:34 +00:00
|
|
|
int make_scheduler_request(PROJECT*);
|
2003-01-02 23:12:05 +00:00
|
|
|
int handle_scheduler_reply(PROJECT*, char* scheduler_url, int& nresults);
|
2003-10-19 01:48:32 +00:00
|
|
|
SCHEDULER_OP* scheduler_op;
|
2006-01-16 05:24:39 +00:00
|
|
|
private:
|
2003-10-19 01:48:32 +00:00
|
|
|
bool contacted_sched_server;
|
2005-06-07 21:21:35 +00:00
|
|
|
int overall_work_fetch_urgency;
|
2003-10-19 01:48:32 +00:00
|
|
|
|
2005-06-07 19:22:50 +00:00
|
|
|
bool scheduler_rpc_poll();
|
2005-06-14 20:31:15 +00:00
|
|
|
double avg_proc_rate();
|
2005-05-09 04:49:56 +00:00
|
|
|
bool should_get_work();
|
2002-04-30 22:22:54 +00:00
|
|
|
|
2003-10-19 01:48:32 +00:00
|
|
|
// --------------- cs_statefile.C:
|
2002-04-30 22:22:54 +00:00
|
|
|
public:
|
2005-02-16 23:17:43 +00:00
|
|
|
void set_client_state_dirty(const char*);
|
2003-10-19 01:48:32 +00:00
|
|
|
int parse_state_file();
|
2004-06-12 04:45:36 +00:00
|
|
|
int write_state(MIOFILE&);
|
2003-10-19 01:48:32 +00:00
|
|
|
int write_state_file();
|
|
|
|
int write_state_file_if_needed();
|
2004-01-26 19:42:39 +00:00
|
|
|
void check_anonymous();
|
|
|
|
int parse_app_info(PROJECT*, FILE*);
|
2004-07-13 23:51:09 +00:00
|
|
|
int write_state_gui(MIOFILE&);
|
|
|
|
int write_file_transfers_gui(MIOFILE&);
|
2006-08-23 22:16:19 +00:00
|
|
|
int write_tasks_gui(MIOFILE&);
|
2003-07-21 12:42:41 +00:00
|
|
|
|
2004-05-12 21:21:09 +00:00
|
|
|
// --------------- cs_trickle.C:
|
|
|
|
private:
|
|
|
|
int read_trickle_files(PROJECT*, FILE*);
|
|
|
|
int remove_trickle_files(PROJECT*);
|
|
|
|
public:
|
|
|
|
int handle_trickle_down(PROJECT*, FILE*);
|
|
|
|
|
2003-10-19 01:48:32 +00:00
|
|
|
// --------------- check_state.C:
|
|
|
|
// stuff related to data-structure integrity checking
|
|
|
|
//
|
|
|
|
public:
|
2003-07-21 12:42:41 +00:00
|
|
|
void check_project_pointer(PROJECT*);
|
|
|
|
void check_app_pointer(APP*);
|
|
|
|
void check_file_info_pointer(FILE_INFO*);
|
|
|
|
void check_app_version_pointer(APP_VERSION*);
|
|
|
|
void check_workunit_pointer(WORKUNIT*);
|
|
|
|
void check_result_pointer(RESULT*);
|
|
|
|
void check_pers_file_xfer_pointer(PERS_FILE_XFER*);
|
|
|
|
void check_file_xfer_pointer(FILE_XFER*);
|
|
|
|
|
|
|
|
void check_app(APP&);
|
|
|
|
void check_file_info(FILE_INFO&);
|
|
|
|
void check_file_ref(FILE_REF&);
|
|
|
|
void check_app_version(APP_VERSION&);
|
|
|
|
void check_workunit(WORKUNIT&);
|
|
|
|
void check_result(RESULT&);
|
|
|
|
void check_active_task(ACTIVE_TASK&);
|
|
|
|
void check_pers_file_xfer(PERS_FILE_XFER&);
|
|
|
|
void check_file_xfer(FILE_XFER&);
|
|
|
|
|
|
|
|
void check_all();
|
2006-02-18 08:33:23 +00:00
|
|
|
void free_mem();
|
2007-02-23 17:29:19 +00:00
|
|
|
|
|
|
|
// --------------- work_fetch.C:
|
|
|
|
public:
|
|
|
|
int proj_min_results(PROJECT*, double);
|
|
|
|
void check_project_timeout();
|
|
|
|
PROJECT* next_project_master_pending();
|
|
|
|
PROJECT* next_project_sched_rpc_pending();
|
|
|
|
PROJECT* next_project_trickle_up_pending();
|
|
|
|
PROJECT* next_project_need_work();
|
|
|
|
PROJECT* find_project_with_overdue_results();
|
|
|
|
double overall_cpu_frac();
|
|
|
|
double time_until_work_done(PROJECT*, int, double);
|
|
|
|
bool compute_work_requests();
|
|
|
|
void scale_duration_correction_factors(double);
|
|
|
|
void generate_new_host_cpid();
|
|
|
|
void compute_nuploading_results();
|
|
|
|
|
2002-04-30 22:22:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern CLIENT_STATE gstate;
|
2002-07-15 05:34:32 +00:00
|
|
|
|
2006-06-07 00:09:05 +00:00
|
|
|
#ifdef SANDBOX
|
|
|
|
#define BOINC_PROJECT_GROUP_NAME "boinc_project"
|
|
|
|
#endif
|
|
|
|
|
2005-10-27 20:03:51 +00:00
|
|
|
// return a random double in the range [MIN,min(e^n,MAX))
|
|
|
|
//
|
|
|
|
extern double calculate_exponential_backoff(
|
2005-12-06 03:18:02 +00:00
|
|
|
int n, double MIN, double MAX
|
2005-10-27 20:03:51 +00:00
|
|
|
);
|
|
|
|
|
2006-05-21 22:03:36 +00:00
|
|
|
#define POLL_INTERVAL 1.0
|
2007-05-14 21:45:02 +00:00
|
|
|
// the client will handle I/O (including GUI RPCs)
|
|
|
|
// for up to POLL_INTERVAL seconds before calling poll_slow_events()
|
|
|
|
// to call the polling functions
|
|
|
|
|
2002-07-15 05:34:32 +00:00
|
|
|
#endif
|