1 // This file is part of BOINC.
2 // http://boinc.berkeley.edu
3 // Copyright (C) 2008 University of California
4 //
5 // BOINC is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Lesser General Public License
7 // as published by the Free Software Foundation,
8 // either version 3 of the License, or (at your option) any later version.
9 //
10 // BOINC is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 // See the GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
17 
18 // flags determining what is written to standard out.
19 // (errors go to stderr)
20 //
21 // NOTE: all writes to stdout should have an if (log_flags.*) {} around them.
22 //
23 
24 #ifndef BOINC_CC_CONFIG_H
25 #define BOINC_CC_CONFIG_H
26 
27 #include <vector>
28 #include <string>
29 
30 #include "proxy_info.h"
31 #include "coproc.h"
32 
33 #define DEFAULT_MAX_EVENT_LOG_LINES 2000
34 
35 struct XML_PARSER;
36 struct PROJECT;
37 struct RESULT;
38 
39 #define MAX_FILE_XFERS_PER_PROJECT      2
40 #define MAX_FILE_XFERS                  8
41     // kind of arbitrary
42 
43 struct LOG_FLAGS {
44     // If you add anything, you must add it to parse() and write()
45 
46     // on by default; intended for all users
47     //
48     bool file_xfer;
49         // file transfer start and finish
50     bool sched_ops;
51         // interactions with schedulers
52     bool task;
53         // task start and finish, and suspend/resume
54 
55     // off by default; intended for developers and testers
56     //
57     bool android_debug;
58         // show Android-specific info (battery etc.)
59     bool app_msg_receive;
60         // show shared-mem message from apps
61     bool app_msg_send;
62         // show shared-mem message to apps
63     bool async_file_debug;
64         // show asynchronous file operations (copy, MD5, decompress)
65     bool benchmark_debug;
66         // debug CPU benchmarks
67     bool checkpoint_debug;
68     bool coproc_debug;
69         // show coproc reserve/free and startup msgs
70     bool cpu_sched;
71         // preemption and resumption
72     bool cpu_sched_debug;
73         // explain scheduler decisions
74     bool cpu_sched_status;
75         // show what's running
76     bool dcf_debug;
77         // show changes to duration correction factors
78     bool disk_usage_debug;
79         // disk usage and project share info
80     bool priority_debug;
81         // info related to REC and scheduling priority
82     bool file_xfer_debug;
83         // show completion of FILE_XFER
84     bool gui_rpc_debug;
85     bool heartbeat_debug;
86     bool http_debug;
87     bool http_xfer_debug;
88     bool idle_detection_debug;
89         // show details leading to idle/not-idle determinations.
90     bool mem_usage_debug;
91         // memory usage
92     bool network_status_debug;
93     bool notice_debug;
94     bool poll_debug;
95         // show what polls are responding
96     bool proxy_debug;
97     bool rr_simulation;
98         // results of RR sim
99     bool rrsim_detail;
100         // details of RR sim
101     bool sched_op_debug;
102     bool scrsave_debug;
103     bool slot_debug;
104         // allocation of slots
105     bool state_debug;
106         // print textual summary of CLIENT_STATE initially
107         // and after each scheduler RPC and garbage collect
108         // also show actions of garbage collector
109     bool statefile_debug;
110         // show when and why state file is written
111     bool suspend_debug;
112         // details of processing and network suspend/resume
113     bool task_debug;
114         // task start and control details, and when apps checkpoint
115     bool time_debug;
116         // changes in on_frac, active_frac, connected_frac
117     bool trickle_debug;
118         // show trickle messages
119     bool unparsed_xml;
120         // show unparsed XML lines
121     bool work_fetch_debug;
122         // work fetch policy
123 
124     LOG_FLAGS();
125     void init();
126     int parse(XML_PARSER&);
127     void show();
128     int write(MIOFILE& out);
129 };
130 
131 struct EXCLUDE_GPU {
132     std::string url;
133     std::string type;       // empty means all types
134     std::string appname;    // empty means all apps
135     int device_num;         // -1 means all instances
136 
137     int parse(XML_PARSER&);
138     void write(MIOFILE&);
139 };
140 
141 // if you add anything, you must add it to
142 // defaults(), parse_options(), and write()
143 //
144 struct CC_CONFIG {
145     bool abort_jobs_on_exit;
146     bool allow_multiple_clients;
147     bool allow_remote_gui_rpc;
148     std::vector<std::string> alt_platforms;
149     std::string client_download_url;
150     std::string client_new_version_text;
151     std::string client_version_check_url;
152     COPROCS config_coprocs;
153     bool disallow_attach;
154     bool dont_check_file_sizes;
155     bool dont_contact_ref_site;
156     bool dont_suspend_nci;
157     bool dont_use_vbox;
158     std::vector<EXCLUDE_GPU> exclude_gpus;
159     std::vector<std::string> exclusive_apps;
160     std::vector<std::string> exclusive_gpu_apps;
161     bool exit_after_finish;
162     bool exit_before_start;
163     bool exit_when_idle;
164     bool fetch_minimal_work;
165     bool fetch_on_update;
166     std::string force_auth;
167     bool http_1_0;
168     int http_transfer_timeout_bps;
169     int http_transfer_timeout;
170     std::vector<int> ignore_gpu_instance[NPROC_TYPES];
171     bool lower_client_priority;
172     int max_event_log_lines;
173     int max_file_xfers;
174     int max_file_xfers_per_project;
175     int max_stderr_file_size;
176     int max_stdout_file_size;
177     int max_tasks_reported;
178     int ncpus;
179     std::string network_test_url;
180     bool no_alt_platform;
181     bool no_gpus;
182     bool no_info_fetch;
183     bool no_opencl;
184     bool no_priority_change;
185     bool os_random_only;
186     int process_priority;
187     int process_priority_special;
188     PROXY_INFO proxy_info;
189     double rec_half_life;
190     bool report_results_immediately;
191     bool run_apps_manually;
192     int save_stats_days;
193     bool skip_cpu_benchmarks;
194     bool simple_gui_only;
195     double start_delay;
196     bool stderr_head;
197     bool suppress_net_info;
198     bool unsigned_apps_ok;
199     bool use_all_gpus;
200     bool use_certs;
201     bool use_certs_only;
202         // overrides use_certs
203     bool vbox_window;
204 
205     CC_CONFIG();
206     void defaults();
207 	int parse(FILE*);
208 	int parse(XML_PARSER&, LOG_FLAGS&);
209     int parse_client(FILE*);
210 	int parse_options(XML_PARSER&);
211     int parse_options_client(XML_PARSER&);
212     int write(MIOFILE&, LOG_FLAGS&);
213     void show();
214 };
215 
216 //  Stuff related to app_config.xml
217 
218 typedef std::vector<std::string> MSG_VEC;
219 
220 struct APP_CONFIG {
221     char name[256];
222     int max_concurrent;
223     double gpu_gpu_usage;
224     double gpu_cpu_usage;
225     bool fraction_done_exact;
226     bool report_results_immediately;
227 
228     int parse(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
229     int parse_gpu_versions(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
230 };
231 
232 struct APP_VERSION_CONFIG {
233     char app_name[256];
234     char plan_class[256];
235     char cmdline[256];
236     double avg_ncpus;
237     double ngpus;
238 
239     int parse(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
240 };
241 
242 struct APP_CONFIGS {
243     std::vector<APP_CONFIG> app_configs;
244     std::vector<APP_VERSION_CONFIG> app_version_configs;
245     int project_max_concurrent;
246     bool report_results_immediately;
247 
248     int parse(XML_PARSER&, MSG_VEC&, LOG_FLAGS&);
249     int parse_file(FILE*, MSG_VEC&, LOG_FLAGS&);
250     int config_app_versions(PROJECT*, bool show_warnings);
251     void write(MIOFILE&);
clearAPP_CONFIGS252     void clear() {
253         app_configs.clear();
254         app_version_configs.clear();
255         project_max_concurrent = 0;
256         report_results_immediately = false;
257     }
258 };
259 
260 #endif
261