1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
|
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC 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 3 of the License, or (at your option) any later version.
//
// BOINC 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.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
// This file is code to print (in ASCII) the stuff returned by GUI RPC.
// Used only by boinccmd.
#if defined(_WIN32) && !defined(__STDWX_H__) && !defined(_BOINC_WIN_) && !defined(_AFX_STDAFX_H_)
#include "boinc_win.h"
#endif
#ifdef _WIN32
#include "../version.h"
#else
#include "config.h"
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <cstdio>
#include <unistd.h>
#include <time.h>
#include <cstdlib>
#include <cstring>
#endif
#include "diagnostics.h"
#include "error_numbers.h"
#include "md5_file.h"
#include "miofile.h"
#include "network.h"
#include "parse.h"
#include "str_util.h"
#include "util.h"
#include "gui_rpc_client.h"
using std::string;
using std::vector;
void DAILY_XFER_HISTORY::print() {
for (unsigned int i=0; i<daily_xfers.size(); i++) {
DAILY_XFER& dx = daily_xfers[i];
char buf[256];
time_t t = dx.when*86400;
struct tm* tm = localtime(&t);
strftime(buf, sizeof(buf)-1, "%d-%b-%Y", tm);
printf("%s: %.0f bytes uploaded, %.0f bytes downloaded\n",
buf, dx.up, dx.down
);
}
}
void GUI_URL::print() {
printf(
"GUI URL:\n"
" name: %s\n"
" description: %s\n"
" URL: %s\n",
name.c_str(), description.c_str(), url.c_str()
);
}
void PROJECT::print_disk_usage() {
printf(" master URL: %s\n", master_url);
printf(" disk usage: %.2fMB\n", disk_usage/MEGA);
}
void PROJECT::print() {
unsigned int i;
printf(" name: %s\n", project_name.c_str());
printf(" master URL: %s\n", master_url);
printf(" user_name: %s\n", user_name.c_str());
printf(" team_name: %s\n", team_name.c_str());
printf(" resource share: %f\n", resource_share);
printf(" user_total_credit: %f\n", user_total_credit);
printf(" user_expavg_credit: %f\n", user_expavg_credit);
printf(" host_total_credit: %f\n", host_total_credit);
printf(" host_expavg_credit: %f\n", host_expavg_credit);
printf(" nrpc_failures: %d\n", nrpc_failures);
printf(" master_fetch_failures: %d\n", master_fetch_failures);
printf(" master fetch pending: %s\n", master_url_fetch_pending?"yes":"no");
printf(" scheduler RPC pending: %s\n", sched_rpc_pending?"yes":"no");
printf(" trickle upload pending: %s\n", trickle_up_pending?"yes":"no");
printf(" attached via Account Manager: %s\n", attached_via_acct_mgr?"yes":"no");
printf(" ended: %s\n", ended?"yes":"no");
printf(" suspended via GUI: %s\n", suspended_via_gui?"yes":"no");
printf(" don't request more work: %s\n", dont_request_more_work?"yes":"no");
printf(" disk usage: %f\n", disk_usage);
time_t foo = (time_t)last_rpc_time;
printf(" last RPC: %s\n", ctime(&foo));
printf(" project files downloaded: %f\n", project_files_downloaded_time);
for (i=0; i<gui_urls.size(); i++) {
gui_urls[i].print();
}
printf(" jobs succeeded: %d\n", njobs_success);
printf(" jobs failed: %d\n", njobs_error);
printf(" elapsed time: %f\n", elapsed_time);
printf(" cross-project ID: %s\n", external_cpid);
}
void APP::print() {
printf(" name: %s\n", name);
printf(" Project: %s\n", project->project_name.c_str());
}
void APP_VERSION::print() {
printf(" project: %s\n", project->project_name.c_str());
printf(" application: %s\n", app->name);
printf(" platform: %s\n", platform);
if (strlen(plan_class)) {
printf(" plan class: %s\n", plan_class);
}
printf(" version: %.2f\n", version_num/100.0);
if (avg_ncpus != 1) {
printf(" avg #CPUS: %.3f\n", avg_ncpus);
}
if (gpu_type != PROC_TYPE_CPU) {
printf(" coprocessor type: %s\n", proc_type_name(gpu_type));
printf(" coprocessor usage: %.3f\n", gpu_usage);
}
printf(" estimated GFLOPS: %.2f\n", flops/1e9);
printf(" filename: %s\n", exec_filename);
}
void WORKUNIT::print() {
printf(" name: %s\n", name);
printf(" FP estimate: %e\n", rsc_fpops_est);
printf(" FP bound: %e\n", rsc_fpops_bound);
printf(" memory bound: %.2f MB\n", rsc_memory_bound/MEGA);
printf(" disk bound: %.2f MB\n", rsc_disk_bound/MEGA);
if (!job_keywords.empty()) {
printf(" keywords:\n");
for (unsigned int i=0; i<job_keywords.keywords.size(); i++) {
KEYWORD &kw = job_keywords.keywords[i];
printf(" %s\n", kw.name.c_str());
}
}
}
void RESULT::print() {
printf(" name: %s\n", name);
printf(" WU name: %s\n", wu_name);
printf(" project URL: %s\n", project_url);
time_t foo = (time_t)received_time;
printf(" received: %s", ctime(&foo));
foo = (time_t)report_deadline;
printf(" report deadline: %s", ctime(&foo));
printf(" ready to report: %s\n", ready_to_report?"yes":"no");
printf(" state: %s\n", result_client_state_string(state));
printf(" scheduler state: %s\n", result_scheduler_state_string(scheduler_state));
printf(" active_task_state: %s\n", active_task_state_string(active_task_state));
//printf(" stderr_out: %s\n", stderr_out.c_str());
printf(" app version num: %d\n", version_num);
printf(" resources: %s\n", strlen(resources)?resources:"1 CPU");
// stuff for jobs that are not yet completed
//
if (state <= RESULT_FILES_DOWNLOADED) {
if (suspended_via_gui) {
printf(" suspended via GUI: yes\n");
}
printf(" estimated CPU time remaining: %f\n", estimated_cpu_time_remaining);
}
// stuff for jobs that are running or have run
//
if (scheduler_state > CPU_SCHED_UNINITIALIZED) {
printf(" CPU time at last checkpoint: %f\n", checkpoint_cpu_time);
printf(" current CPU time: %f\n", current_cpu_time);
printf(" fraction done: %f\n", fraction_done);
printf(" swap size: %.0f MB\n", swap_size/MEGA);
printf(" working set size: %.0f MB\n", working_set_size_smoothed/MEGA);
if (bytes_sent || bytes_received) {
printf(" bytes sent: %.0f received: %.0f\n",
bytes_sent, bytes_received
);
}
}
// stuff for completed jobs
//
if (state > RESULT_FILES_DOWNLOADED) {
printf(" final CPU time: %f\n", final_cpu_time);
printf(" final elapsed time: %f\n", final_elapsed_time);
printf(" exit_status: %d\n", exit_status);
printf(" signal: %d\n", signal);
}
}
void FILE_TRANSFER::print() {
printf(" name: %s\n", name.c_str());
printf(" direction: %s\n", is_upload?"upload":"download");
printf(" sticky: %s\n", sticky?"yes":"no");
printf(" xfer active: %s\n", xfer_active?"yes":"no");
printf(" time_so_far: %f\n", time_so_far);
printf(" bytes_xferred: %f\n", bytes_xferred);
printf(" xfer_speed: %f\n", xfer_speed);
}
void MESSAGE::print() {
printf("%s %d %d %s\n",
project.c_str(), priority, timestamp, body.c_str()
);
}
void GR_PROXY_INFO::print() {
printf("HTTP server name: %s\n",this->http_server_name.c_str());
printf("HTTP server port: %d\n",this->http_server_port);
printf("HTTP user name: %s\n",this->http_user_name.c_str());
//printf("HTTP user password: %s\n",this->http_user_passwd.c_str());
printf("SOCKS server name: %s\n",this->socks_server_name.c_str());
printf("SOCKS server port: %d\n",this->socks_server_port);
printf("SOCKS5 user name: %s\n",this->socks5_user_name.c_str());
//printf("SOCKS5 user password: %s\n",this->socks5_user_passwd.c_str());
printf("no proxy hosts: %s\n",this->noproxy_hosts.c_str());
}
void HOST_INFO::print() {
printf(" timezone: %d\n", timezone);
printf(" domain name: %s\n", domain_name);
printf(" IP addr: %s\n", ip_addr);
printf(" #CPUS: %d\n", p_ncpus);
printf(" CPU vendor: %s\n", p_vendor);
printf(" CPU model: %s\n", p_model);
printf(" CPU FP OPS: %f\n", p_fpops);
printf(" CPU int OPS: %f\n", p_iops);
printf(" CPU mem BW: %f\n", p_membw);
printf(" OS name: %s\n", os_name);
printf(" OS version: %s\n", os_version);
printf(" mem size: %f\n", m_nbytes);
printf(" cache size: %f\n", m_cache);
printf(" swap size: %f\n", m_swap);
printf(" disk size: %f\n", d_total);
printf(" disk free: %f\n", d_free);
}
void SIMPLE_GUI_INFO::print() {
unsigned int i;
printf("======== Projects ========\n");
for (i=0; i<projects.size(); i++) {
printf("%d) -----------\n", i+1);
projects[i]->print();
}
printf("\n======== Tasks ========\n");
for (i=0; i<results.size(); i++) {
printf("%d) -----------\n", i+1);
results[i]->print();
}
}
void TIME_STATS::print() {
printf(" now: %f\n", now);
printf(" on_frac: %f\n", on_frac);
printf(" connected_frac: %f\n", connected_frac);
printf(" cpu_and_network_available_frac: %f\n", cpu_and_network_available_frac);
printf(" active_frac: %f\n", active_frac);
printf(" gpu_active_frac: %f\n", gpu_active_frac);
time_t foo = (time_t)client_start_time;
printf(" client_start_time: %s\n", ctime(&foo));
printf(" previous_uptime: %f\n", previous_uptime);
printf(" session_active_duration: %f\n", session_active_duration);
printf(" session_gpu_active_duration: %f\n", session_gpu_active_duration);
foo = (time_t)total_start_time;
printf(" total_start_time: %s\n", ctime(&foo));
printf(" total_duration: %f\n", total_duration);
printf(" total_active_duration: %f\n", total_active_duration);
printf(" total_gpu_active_duration: %f\n", total_gpu_active_duration);
}
void CC_STATE::print() {
unsigned int i;
printf("======== Projects ========\n");
for (i=0; i<projects.size(); i++) {
printf("%d) -----------\n", i+1);
projects[i]->print();
}
printf("\n======== Applications ========\n");
for (i=0; i<apps.size(); i++) {
printf("%d) -----------\n", i+1);
apps[i]->print();
}
printf("\n======== Application versions ========\n");
for (i=0; i<app_versions.size(); i++) {
printf("%d) -----------\n", i+1);
app_versions[i]->print();
}
printf("\n======== Workunits ========\n");
for (i=0; i<wus.size(); i++) {
printf("%d) -----------\n", i+1);
wus[i]->print();
}
printf("\n======== Tasks ========\n");
for (i=0; i<results.size(); i++) {
printf("%d) -----------\n", i+1);
results[i]->print();
}
printf("\n======== Time stats ========\n");
time_stats.print();
}
void print_status(
const char* name, int reason, int mode, int mode_perm, double delay
) {
printf("%s status\n", name);
if (reason) {
printf(" suspended: %s\n", suspend_reason_string(reason));
} else {
printf(" not suspended\n");
}
printf(
" current mode: %s\n"
" perm mode: %s\n"
" perm becomes current in %.0f sec\n",
run_mode_string(mode),
run_mode_string(mode_perm),
delay
);
}
void CC_STATUS::print() {
printf("network connection status: %s\n",
network_status_string(network_status)
);
print_status("CPU",
task_suspend_reason,
task_mode,
task_mode_perm,
task_mode_delay
);
print_status("GPU",
gpu_suspend_reason,
gpu_mode,
gpu_mode_perm,
gpu_mode_delay
);
print_status("Network",
network_suspend_reason,
network_mode,
network_mode_perm,
network_mode_delay
);
}
void PROJECTS::print() {
unsigned int i;
printf("======== Projects ========\n");
for (i=0; i<projects.size(); i++) {
printf("%d) -----------\n", i+1);
projects[i]->print();
}
}
void PROJECTS::print_urls() {
unsigned int i;
for (i=0; i<projects.size(); i++) {
printf("%s\n", projects[i]->master_url);
}
}
void DISK_USAGE::print() {
unsigned int i;
printf("======== Disk usage ========\n");
printf("total: %f\n", d_total);
printf("free: %f\n", d_free);
for (i=0; i<projects.size(); i++) {
printf("%d) -----------\n", i+1);
projects[i]->print_disk_usage();
}
}
void RESULTS::print() {
unsigned int i;
printf("\n======== Tasks ========\n");
for (i=0; i<results.size(); i++) {
printf("%d) -----------\n", i+1);
results[i]->print();
}
}
void FILE_TRANSFERS::print() {
unsigned int i;
printf("\n======== File transfers ========\n");
for (i=0; i<file_transfers.size(); i++) {
printf("%d) -----------\n", i+1);
file_transfers[i]->print();
}
}
void MESSAGES::print() {
unsigned int i;
printf("\n======== Messages ========\n");
for (i=0; i<messages.size(); i++) {
printf("%d) -----------\n", i+1);
messages[i]->print();
}
}
void PROJECT_CONFIG::print() {
printf(
"uses_username: %d\n"
"name: %s\n"
"min_passwd_length: %d\n",
uses_username,
name.c_str(),
min_passwd_length
);
}
void ACCOUNT_OUT::print() {
if (error_num) {
printf("error in account lookup: %s\n", boincerror(error_num));
} else {
printf("account key: %s\n", authenticator.c_str());
}
}
void OLD_RESULT::print() {
printf(
"task %s:\n"
" project URL: %s\n"
" app name: %s\n"
" exit status: %d\n"
" elapsed time: %f sec\n"
" completed time: %s\n"
" reported time: %s\n",
result_name,
project_url,
app_name,
exit_status,
elapsed_time,
time_to_string(completed_time),
time_to_string(create_time)
);
}
void ACCT_MGR_INFO::print() {
printf(
"Account manager info:\n"
" Name: %s\n"
" URL: %s\n",
acct_mgr_name.c_str(),
acct_mgr_url.c_str()
);
}
|