~ubuntu-branches/ubuntu/precise/boinc/precise

« back to all changes in this revision

Viewing changes to client/client_state.h

Tags: 6.12.8+dfsg-1
* New upstream release.
* Simplified debian/rules

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
using std::string;
28
28
using std::vector;
29
29
 
 
30
#include "coproc.h"
 
31
 
30
32
#include "acct_mgr.h"
31
33
#include "acct_setup.h"
32
34
#include "app.h"
33
35
#include "client_types.h"
 
36
#include "current_version.h"
34
37
#include "file_xfer.h"
35
38
#include "gui_rpc_server.h"
36
39
#include "gui_http.h"
41
44
#include "prefs.h"
42
45
#include "scheduler_op.h"
43
46
#include "time_stats.h"
44
 
#include "http_curl.h"
45
 
#include "coproc.h"
 
47
 
 
48
#ifdef SIM
 
49
#include "../sched/edf_sim.h"
 
50
#endif
46
51
 
47
52
#define WORK_FETCH_DONT_NEED 0
48
53
    // project: suspended, deferred, or no new work (can't ask for more work)
57
62
    // project: no downloading or runnable results
58
63
    // overall: at least one idle CPU
59
64
 
60
 
/// encapsulates the global variables of the core client.
 
65
// encapsulates the global variables of the core client.
61
66
// If you add anything here, initialize it in the constructor
62
67
//
63
 
class CLIENT_STATE {
64
 
public:
 
68
struct CLIENT_STATE {
65
69
    vector<PLATFORM> platforms;
66
70
    vector<PROJECT*> projects;
67
71
    vector<APP*> apps;
69
73
    vector<APP_VERSION*> app_versions;
70
74
    vector<WORKUNIT*> workunits;
71
75
    vector<RESULT*> results;
 
76
        // list of jobs, ordered by increasing arrival time
72
77
 
73
78
    PERS_FILE_XFER_SET* pers_file_xfers;
74
79
    HTTP_OP_SET* http_ops;
75
80
    FILE_XFER_SET* file_xfers;
 
81
#ifndef SIM
 
82
    GUI_RPC_CONN_SET gui_rpcs;
 
83
#endif
 
84
    GUI_HTTP gui_http;
 
85
    AUTO_UPDATE auto_update;
 
86
    LOOKUP_WEBSITE_OP lookup_website_op;
 
87
    GET_CURRENT_VERSION_OP get_current_version_op;
 
88
    GET_PROJECT_LIST_OP get_project_list_op;
 
89
    ACCT_MGR_OP acct_mgr_op;
 
90
 
 
91
    TIME_STATS time_stats;
 
92
    GLOBAL_PREFS global_prefs;
 
93
    NET_STATS net_stats;
76
94
    ACTIVE_TASK_SET active_tasks;
77
95
    HOST_INFO host_info;
78
 
    GLOBAL_PREFS global_prefs;
79
 
    NET_STATS net_stats;
80
 
    GUI_RPC_CONN_SET gui_rpcs;
81
 
    TIME_STATS time_stats;
82
 
    PROXY_INFO proxy_info;
83
 
    GUI_HTTP gui_http;
84
 
    COPROCS coprocs;
85
96
 
86
97
    VERSION_INFO core_client_version;
87
98
    string statefile_platform_name;
88
99
    int file_xfer_giveup_period;
89
100
    MODE run_mode;
 
101
    MODE gpu_mode;
90
102
    MODE network_mode;
91
103
    bool started_by_screensaver;
92
 
    bool exit_when_idle;
93
104
    bool exit_before_start;
94
 
    bool exit_after_finish;
95
105
    bool check_all_logins;
96
106
    bool user_active;       // there has been recent mouse/kbd input
97
 
    bool allow_remote_gui_rpc;
98
107
    int cmdline_gui_rpc_port;
99
108
    bool show_projects;
100
109
    bool requested_exit;
101
 
        /// stores URL for -detach_project option
 
110
    bool requested_suspend;
 
111
    bool requested_resume;
 
112
    bool cleanup_completed;
 
113
    bool in_abort_sequence;
 
114
        // Determine when it is safe to leave the quit_client() handler
 
115
        // and to finish cleaning up.
102
116
    char detach_project_url[256];
103
 
        /// stores URL for -reset_project option
 
117
        // stores URL for -detach_project option
104
118
    char reset_project_url[256];
105
 
        /// stores URL for -update_prefs option
 
119
        // stores URL for -reset_project option
106
120
    char update_prefs_url[256];
107
 
        /// venue from project or AMS that gave us general prefs
 
121
        // stores URL for -update_prefs option
108
122
    char main_host_venue[256];
 
123
        // venue from project or AMS that gave us general prefs
109
124
    char attach_project_url[256];
110
125
    char attach_project_auth[256];
111
 
        /// exit when about to upload a file
112
126
    bool exit_before_upload;
 
127
        // exit when about to upload a file
113
128
#ifndef _WIN32
114
129
    gid_t boinc_project_gid;
115
130
#endif
116
131
 
117
132
    // backoff-related variables
118
133
    //
119
 
        /// fetch project's master URL (and stop doing scheduler RPCs)
120
 
        /// if get this many successive RPC failures (default 10)
121
134
    int master_fetch_period;
122
 
        /// cap project->nrpc_failures at this number
 
135
        // fetch project's master URL (and stop doing scheduler RPCs)
 
136
        // if get this many successive RPC failures (default 10)
123
137
    int retry_cap;
124
 
        /// after this many master-fetch failures,
125
 
        /// move into a state in which we retry master fetch
126
 
        /// at the frequency below
 
138
        // cap project->nrpc_failures at this number
127
139
    int master_fetch_retry_cap;
128
 
        /// see above
 
140
        // after this many master-fetch failures,
 
141
        // move into a state in which we retry master fetch
 
142
        // at the frequency below
129
143
    int master_fetch_interval;
 
144
        // see above
130
145
 
131
146
    int sched_retry_delay_min;
132
147
    int sched_retry_delay_max;
134
149
    int pers_retry_delay_max;
135
150
    int pers_giveup;
136
151
 
137
 
        /// Don't use CPU.  See check_suspend_activities for logic
138
152
    bool tasks_suspended;
139
 
        /// Don't use network.  See check_suspend_network for logic
 
153
        // Don't run apps.
 
154
    int suspend_reason;
 
155
 
140
156
    bool network_suspended;
141
 
    int suspend_reason;
 
157
        // Don't use network.
 
158
    bool file_xfers_suspended;
 
159
        // Don't do file xfers (but allow other network activity).
142
160
    int network_suspend_reason;
143
 
        /// true if --daemon is on the commandline
144
161
 
145
 
        /// this means we are running as a daemon on unix,
146
 
        /// or as a service on Windows
147
 
        bool executing_as_daemon;
148
 
        /// redirect stdout, stderr to log files
 
162
    bool executing_as_daemon;
 
163
        // true if --daemon is on the commandline
 
164
        // this means we are running as a daemon on unix,
 
165
        // or as a service on Windows
149
166
    bool redirect_io;
150
 
        /// a condition has occurred in which we know graphics will
151
 
        /// not be displayable, so GUIs shouldn't offer graphics.
 
167
        // redirect stdout, stderr to log files
152
168
    bool disable_graphics;
 
169
        // a condition has occurred in which we know graphics will
 
170
        // not be displayable, so GUIs shouldn't offer graphics.
153
171
    bool detach_console;
154
 
        /// this affects auto-update
155
172
    bool launched_by_manager;
 
173
        // this affects auto-update
156
174
    bool run_by_updater;
157
175
    double now;
158
176
    double client_start_time;
159
177
    double last_wakeup_time;
160
178
    bool initialized;
161
 
        /// failed to write state file.
162
 
 
163
 
        /// In this case we continue to run for 1 minute,
164
 
        /// handling GUI RPCs but doing nothing else,
165
 
        /// so that the Manager can tell the user what the problem is
166
179
    bool cant_write_state_file;
167
 
private:
 
180
        // failed to write state file.
 
181
        // In this case we continue to run for 1 minute,
 
182
        // handling GUI RPCs but doing nothing else,
 
183
        // so that the Manager can tell the user what the problem is
 
184
 
168
185
    bool client_state_dirty;
169
186
    int old_major_version;
170
187
    int old_minor_version;
171
188
    int old_release;
172
 
        /// if set, use hardwired numbers rather than running benchmarks
173
 
    bool skip_cpu_benchmarks;
174
 
        /// if set, run benchmarks on client startup
175
189
    bool run_cpu_benchmarks;
176
 
        /// set if a benchmark fails to start because of a process that doesn't stop.
177
 
        /// Persists so that the next start of BOINC runs the benchmarks.
 
190
        // if set, run benchmarks on client startup
178
191
    bool cpu_benchmarks_pending;
 
192
        // set if a benchmark fails to start because of a job that doesn't exit
 
193
        // Persists so that the next start of BOINC runs the benchmarks.
179
194
 
180
 
        /// if nonzero, exit this many seconds after starting an app
181
195
    int exit_after_app_start_secs;
182
 
        /// when the most recent app was started
 
196
        // if nonzero, exit this many seconds after starting an app
183
197
    double app_started;
 
198
        // when the most recent app was started
184
199
 
185
200
// --------------- acct_mgr.cpp:
186
 
public:
187
 
    ACCT_MGR_OP acct_mgr_op;
188
201
    ACCT_MGR_INFO acct_mgr_info;
189
202
 
190
203
// --------------- acct_setup.cpp:
191
 
public:
192
204
    PROJECT_INIT project_init;
193
205
    PROJECT_ATTACH project_attach;
194
 
    LOOKUP_WEBSITE_OP lookup_website_op;
195
 
    GET_CURRENT_VERSION_OP get_current_version_op;
196
 
    GET_PROJECT_LIST_OP get_project_list_op;
197
206
    void new_version_check();
198
207
    void all_projects_list_check();
199
208
    double new_version_check_time;
200
209
    double all_projects_list_check_time;
201
210
    string newer_version;
202
211
 
203
 
// --------------- auto_update.cpp:
204
 
public:
205
 
    AUTO_UPDATE auto_update;
206
 
 
207
212
// --------------- client_state.cpp:
208
 
public:
209
213
    CLIENT_STATE();
210
214
    void show_host_info();
211
 
    void show_proxy_info();
212
215
    int init();
213
 
        /// Never blocks.
214
 
        /// Returns true if it actually did something,
215
 
        /// in which case it should be called again immediately.
216
216
    bool poll_slow_events();
 
217
        // Never blocks.
 
218
        // Returns true if it actually did something,
 
219
        // in which case it should be called again immediately.
217
220
    void do_io_or_sleep(double dt);
218
221
    bool time_to_exit();
219
222
    PROJECT* lookup_project(const char*);
228
231
    int report_result_error(RESULT&, const char *format, ...);
229
232
    int reset_project(PROJECT*, bool detaching);
230
233
    bool no_gui_rpc;
231
 
private:
 
234
    void start_abort_sequence();
 
235
    bool abort_sequence_done();
 
236
    int quit_activities();
 
237
 
232
238
    int link_app(PROJECT*, APP*);
233
239
    int link_file_info(PROJECT*, FILE_INFO*);
234
240
    int link_file_ref(PROJECT*, FILE_REF*);
236
242
    int link_workunit(PROJECT*, WORKUNIT*);
237
243
    int link_result(PROJECT*, RESULT*);
238
244
    void print_summary();
 
245
    bool abort_unstarted_late_jobs();
239
246
    bool garbage_collect();
240
247
    bool garbage_collect_always();
241
248
    bool update_results();
243
250
    void check_clock_reset();
244
251
 
245
252
// --------------- cpu_sched.cpp:
246
 
private:
 
253
    double total_resource_share();
 
254
    double potentially_runnable_resource_share();
 
255
    double nearly_runnable_resource_share();
 
256
    double fetchable_resource_share();
247
257
    double debt_interval_start;
248
 
    double total_wall_cpu_time_this_debt_interval;
249
 
        // "wall CPU time" accumulated since last adjust_debts()
250
258
    double total_cpu_time_this_debt_interval;
251
 
    double cpu_shortfall;
252
 
        bool work_fetch_no_new_work;
253
259
    bool must_enforce_cpu_schedule;
254
260
    bool must_schedule_cpus;
255
261
    bool must_check_work_fetch;
256
262
    void assign_results_to_projects();
257
263
    RESULT* largest_debt_project_best_result();
258
 
    RESULT* earliest_deadline_result();
259
264
    void reset_debt_accounting();
260
 
    void adjust_debts();
261
265
    bool possibly_schedule_cpus();
262
266
    void schedule_cpus();
263
267
    bool enforce_schedule();
264
 
    bool no_work_for_a_cpu();
265
 
    void make_preemptable_task_list(vector<ACTIVE_TASK*>&, double&);
266
 
public:
 
268
    void append_unfinished_time_slice(vector<RESULT*>&);
 
269
 
 
270
    double runnable_resource_share(int);
 
271
    void adjust_debts();
267
272
    std::vector <RESULT*> ordered_scheduled_results;
268
 
        /// if we fail to start a task due to no shared-mem segments,
269
 
        /// wait until at least this time to try running
270
 
        /// another task that needs a shared-mem seg
271
273
    double retry_shmem_time;
272
 
        inline double work_buf_min() {
273
 
                return global_prefs.work_buf_min_days * 86400;
274
 
        }
 
274
        // if we fail to start a task due to no shared-mem segments,
 
275
        // wait until at least this time to try running
 
276
        // another task that needs a shared-mem seg
 
277
    inline double work_buf_min() {
 
278
        return global_prefs.work_buf_min_days * 86400;
 
279
    }
275
280
    inline double work_buf_additional() {
276
281
        return global_prefs.work_buf_additional_days *86400;
277
282
    }
280
285
        if (x < 1) x = 1;
281
286
        return x;
282
287
    }
283
 
    void request_enforce_schedule(const char*);
284
 
        /// Check for reschedule CPUs ASAP.
285
288
 
286
 
        /// Called when:
287
 
        /// - core client starts (CS::init())
288
 
        /// - an app exits (ATS::check_app_exited())
289
 
        /// - Tasks are killed (ATS::exit_tasks())
290
 
        /// - a result's input files finish downloading (CS::update_results())
291
 
        /// - an app fails to start (CS::schedule_cpus())
292
 
        /// - any project op is done via RPC (suspend/resume)
293
 
        /// - any result op is done via RPC (suspend/resume)
294
289
    void request_schedule_cpus(const char*);
 
290
        // Reschedule CPUs ASAP.
 
291
        // Called when:
 
292
        // - core client starts (CS::init())
 
293
        // - an app exits (ATS::check_app_exited())
 
294
        // - Tasks are killed (ATS::exit_tasks())
 
295
        // - a result's input files finish downloading (CS::update_results())
 
296
        // - an app fails to start (CS::schedule_cpus())
 
297
        // - any project op is done via RPC (suspend/resume)
 
298
        // - any result op is done via RPC (suspend/resume)
 
299
    void set_ncpus();
295
300
 
296
301
// --------------- cs_account.cpp:
297
 
public:
298
302
    int add_project(
299
303
        const char* master_url, const char* authenticator,
300
304
        const char* project_name, bool attached_via_acct_mgr
301
305
    );
302
 
private:
 
306
 
303
307
    int parse_account_files();
304
308
    int parse_account_files_venue();
305
309
    int parse_preferences_for_user_files();
307
311
        // should be move to a new file, but this will do it for testing
308
312
 
309
313
// --------------- cs_apps.cpp:
310
 
private:
311
 
    double total_resource_share();
312
 
    double potentially_runnable_resource_share();
313
 
    double nearly_runnable_resource_share();
314
 
    double fetchable_resource_share();
315
 
public:
316
 
    double runnable_resource_share();
317
 
        /// Check if work fetch needed.
318
 
 
319
 
        /// Called when:
320
 
        /// - core client starts (CS::init())
321
 
        /// - task is completed or fails
322
 
        /// - tasks are killed
323
 
        /// - an RPC completes
324
 
        /// - project suspend/detch/attach/reset GUI RPC
325
 
        /// - result suspend/abort GUI RPC
326
 
    void request_work_fetch(const char*);
327
 
    int quit_activities();
328
 
    void set_ncpus();
329
 
    double estimate_cpu_time(WORKUNIT&);
330
314
    double get_fraction_done(RESULT* result);
331
315
    int input_files_available(RESULT*, bool, FILE_INFO** f=0);
332
316
    ACTIVE_TASK* lookup_active_task_by_result(RESULT*);
333
 
        /// number of usable cpus
334
317
    int ncpus;
335
 
private:
336
 
    int nslots;
 
318
        // Act like there are this many CPUs.
 
319
        // By default this is the # of physical CPUs,
 
320
        // but it can be changed in two ways:
 
321
        // - type <ncpus>N</ncpus> in the config file
 
322
        // - type the max_ncpus_pct pref
337
323
 
338
324
    int latest_version(APP*, char*);
339
325
    int app_finished(ACTIVE_TASK&);
340
326
    bool start_apps();
341
327
    bool handle_finished_apps();
342
 
public:
 
328
 
343
329
    ACTIVE_TASK* get_task(RESULT*);
344
330
 
345
331
// --------------- cs_benchmark.cpp:
346
 
public:
347
332
    bool should_run_cpu_benchmarks();
348
 
        void start_cpu_benchmarks();
 
333
    void start_cpu_benchmarks();
349
334
    bool cpu_benchmarks_poll();
350
335
    void abort_cpu_benchmarks();
351
336
    bool are_cpu_benchmarks_running();
352
 
        bool cpu_benchmarks_done();
353
 
        void cpu_benchmarks_set_defaults();
 
337
    bool cpu_benchmarks_done();
 
338
    void cpu_benchmarks_set_defaults();
354
339
    void print_benchmark_results();
355
340
 
356
341
// --------------- cs_cmdline.cpp:
357
 
public:
358
342
    void parse_cmdline(int argc, char** argv);
359
343
    void parse_env_vars();
360
344
    void do_cmdline_actions();
361
345
 
362
346
// --------------- cs_files.cpp:
363
 
public:
364
347
    void check_file_existence();
365
348
    bool start_new_file_xfer(PERS_FILE_XFER&);
366
 
private:
 
349
 
367
350
    int make_project_dirs();
368
351
    bool handle_pers_file_xfers();
369
352
 
370
353
// --------------- cs_platforms.cpp:
371
 
public:
372
354
    const char* get_primary_platform();
373
 
private:
374
355
    void add_platform(const char*);
375
356
    void detect_platforms();
376
357
    void write_platforms(PROJECT*, MIOFILE&);
377
358
    bool is_supported_platform(const char*);
378
359
 
379
360
// --------------- cs_prefs.cpp:
380
 
public:
381
361
    int project_disk_usage(PROJECT*, double&);
382
 
        /// returns the total disk usage of BOINC on this host
383
362
    int total_disk_usage(double&);
 
363
        // returns the total disk usage of BOINC on this host
384
364
    double allowed_disk_usage(double boinc_total);
385
365
    int allowed_project_disk_usage(double&);
386
366
    int suspend_tasks(int reason);
387
367
    int resume_tasks(int reason=0);
388
 
    int suspend_network(int reason);
389
 
    int resume_network();
390
368
    void read_global_prefs();
391
369
    int save_global_prefs(char* prefs, char* url, char* sched);
392
 
        double available_ram();
393
 
        double max_available_ram();
394
 
private:
 
370
    double available_ram();
 
371
    double max_available_ram();
395
372
    int check_suspend_processing();
396
 
    int check_suspend_network();
 
373
    void check_suspend_network();
397
374
    void install_global_prefs();
398
375
    PROJECT* global_prefs_source_project();
399
376
    void show_global_prefs_source(bool);
400
377
 
401
378
// --------------- cs_scheduler.cpp:
402
 
public:
 
379
    void request_work_fetch(const char*);
 
380
        // Called when:
 
381
        // - core client starts (CS::init())
 
382
        // - task is completed or fails
 
383
        // - tasks are killed
 
384
        // - an RPC completes
 
385
        // - project suspend/detch/attach/reset GUI RPC
 
386
        // - result suspend/abort GUI RPC
403
387
    int make_scheduler_request(PROJECT*);
404
 
    int handle_scheduler_reply(PROJECT*, char* scheduler_url, int& nresults);
 
388
    int handle_scheduler_reply(PROJECT*, char* scheduler_url);
405
389
    SCHEDULER_OP* scheduler_op;
406
 
private:
407
 
    bool contacted_sched_server;
408
 
    int overall_work_fetch_urgency;
409
 
 
 
390
    PROJECT* next_project_master_pending();
 
391
    PROJECT* next_project_sched_rpc_pending();
 
392
    PROJECT* next_project_trickle_up_pending();
 
393
    PROJECT* find_project_with_overdue_results();
 
394
    bool had_or_requested_work;
410
395
    bool scheduler_rpc_poll();
411
 
    double avg_proc_rate();
412
 
    bool should_get_work();
413
396
 
414
397
// --------------- cs_statefile.cpp:
415
 
public:
416
398
    void set_client_state_dirty(const char*);
417
399
    int parse_state_file();
418
400
    int write_state(MIOFILE&);
419
401
    int write_state_file();
420
402
    int write_state_file_if_needed();
421
 
        void check_anonymous();
422
 
        int parse_app_info(PROJECT*, FILE*);
 
403
    void check_anonymous();
 
404
    int parse_app_info(PROJECT*, FILE*);
423
405
    int write_state_gui(MIOFILE&);
424
406
    int write_file_transfers_gui(MIOFILE&);
425
 
    int write_tasks_gui(MIOFILE&);
 
407
    int write_tasks_gui(MIOFILE&, bool);
 
408
    void sort_results();
426
409
 
427
410
// --------------- cs_trickle.cpp:
428
 
private:
429
411
    int read_trickle_files(PROJECT*, FILE*);
430
412
    int remove_trickle_files(PROJECT*);
431
 
public:
432
413
    int handle_trickle_down(PROJECT*, FILE*);
433
414
 
434
415
// --------------- check_state.cpp:
435
416
// stuff related to data-structure integrity checking
436
417
//
437
 
public:
438
418
    void check_project_pointer(PROJECT*);
439
419
    void check_app_pointer(APP*);
440
420
    void check_file_info_pointer(FILE_INFO*);
462
442
    void print_deadline_misses();
463
443
 
464
444
// --------------- work_fetch.cpp:
465
 
public:
466
445
    int proj_min_results(PROJECT*, double);
467
 
        void check_project_timeout();
468
 
    PROJECT* next_project_master_pending();
469
 
    PROJECT* next_project_sched_rpc_pending();
470
 
    PROJECT* next_project_trickle_up_pending();
471
 
    PROJECT* next_project_need_work();
472
 
    PROJECT* find_project_with_overdue_results();
473
 
        double overall_cpu_frac();
 
446
    void check_project_timeout();
 
447
    double overall_cpu_frac();
 
448
    double overall_gpu_frac();
474
449
    double time_until_work_done(PROJECT*, int, double);
475
450
    bool compute_work_requests();
476
451
    void scale_duration_correction_factors(double);
477
452
    void generate_new_host_cpid();
478
453
    void compute_nuploading_results();
479
454
 
 
455
#ifdef SIM
 
456
    RANDOM_PROCESS available;
 
457
    RANDOM_PROCESS idle;
 
458
    FILE* html_out;
 
459
    double connection_interval;
 
460
        // don't connect more often than this
 
461
 
 
462
    void html_start(bool);
 
463
    void html_rec();
 
464
    void html_end(bool);
 
465
    std::string html_msg;
 
466
    double share_violation();
 
467
    double monotony();
 
468
 
 
469
    void do_client_simulation();
 
470
    void handle_completed_results(PROJECT*);
 
471
    void get_workload(vector<IP_RESULT>&);
 
472
    void simulate();
 
473
    bool simulate_rpc(PROJECT*);
 
474
    void print_project_results(FILE*);
 
475
#endif
480
476
};
481
477
 
482
478
extern CLIENT_STATE gstate;
483
479
 
484
 
/// return a random double in the range [MIN,min(e^n,MAX))
 
480
extern bool gpus_usable;
 
481
 
 
482
// return a random double in the range [MIN,min(e^n,MAX))
485
483
 
486
484
extern double calculate_exponential_backoff(
487
485
    int n, double MIN, double MAX
489
487
 
490
488
extern void print_suspend_tasks_message(int);
491
489
 
 
490
//////// TIME-RELATED CONSTANTS ////////////
 
491
 
 
492
//////// CLIENT INTERNAL
 
493
 
492
494
#define POLL_INTERVAL   1.0
493
495
    // the client will handle I/O (including GUI RPCs)
494
496
    // for up to POLL_INTERVAL seconds before calling poll_slow_events()
495
497
    // to call the polling functions
496
498
 
497
 
#define CPU_PESSIMISM_FACTOR 0.9
498
 
    // assume actual CPU utilization will be this multiple
499
 
    // of what we've actually measured recently
 
499
#define GARBAGE_COLLECT_PERIOD  10
 
500
    // how often to garbage collect
 
501
 
 
502
#define TASK_POLL_PERIOD    1.0
 
503
 
 
504
#define UPDATE_RESULTS_PERIOD   1.0
 
505
 
 
506
#define HANDLE_FINISHED_APPS_PERIOD 1.0
 
507
 
 
508
#define BENCHMARK_POLL_PERIOD   1.0
 
509
 
 
510
#define PERS_FILE_XFER_START_PERIOD  1.0
 
511
#define PERS_FILE_XFER_POLL_PERIOD  1.0
 
512
 
 
513
#define SCHEDULER_RPC_POLL_PERIOD   5.0
 
514
 
 
515
#define FILE_XFER_POLL_PERIOD   1.0
 
516
 
 
517
#define GUI_HTTP_POLL_PERIOD    1.0
 
518
 
 
519
//////// WORK FETCH
 
520
 
 
521
#define WORK_FETCH_PERIOD   60
 
522
    // see if we need to fetch work at least this often
 
523
#define WF_MIN_BACKOFF_INTERVAL    600
 
524
#define WF_MAX_BACKOFF_INTERVAL    86400
 
525
    // if we ask a project for work for a resource and don't get it,
 
526
    // we do exponential backoff.
 
527
    // This constant is an upper bound for this.
 
528
    // E.g., if we need GPU work, we'll end up asking once a day,
 
529
    // so if the project develops a GPU app,
 
530
    // we'll find out about it within a day.
 
531
 
 
532
//////// CPU SCHEDULING
 
533
 
 
534
#define CPU_SCHED_PERIOD    60
 
535
    // do CPU schedule at least this often
 
536
 
 
537
#define DEBT_ADJUST_PERIOD CPU_SCHED_PERIOD
 
538
    // debt is adjusted at least this often,
 
539
    // since adjust_debts() is called from enforce_schedule()
 
540
 
 
541
//////// NETWORK
 
542
 
 
543
#define CONNECT_ERROR_PERIOD    600.0
 
544
 
 
545
#define ALLOW_NETWORK_IF_RECENT_RPC_PERIOD  300
 
546
    // if there has been a GUI RPC within this period
 
547
    // that requires network access (e.g. attach to project)
 
548
    // allow it even if setting is "no access"
 
549
 
 
550
//////// MISC
 
551
 
 
552
#define DAILY_XFER_HISTORY_PERIOD   60
 
553
 
 
554
#define MAX_STD   (86400)
 
555
    // maximum short-term debt
 
556
 
 
557
#define ACCT_MGR_MIN_BACKOFF    600
 
558
#define ACCT_MGR_MAX_BACKOFF    86400
 
559
    // min/max account manager RPC backoff
500
560
 
501
561
#endif