// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2022 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 .
// This file is code to print (in ASCII) the stuff returned by GUI RPC.
// Used only by boinccmd.
#if defined(_WIN32)
#include "boinc_win.h"
#include "../version.h"
#else
#include "config.h"
#include
#include
#include
#include
#include
#include
#include
#include
#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; iproject_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 CPU_SCHED_UNINITIALIZED) {
printf(" slot: %d\n", slot);
printf(" PID: %d\n", pid);
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);
if (xfer_active) printf(" estimated_xfer_time_remaining: %f\n", estimated_xfer_time_remaining);
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);
// Show GPU info.
// This is harder than it should be,
// because the structures aren't populated like they were
// at GPU detection time.
// Would be better for the client to export the description strings.
//
char buf[256];
COPROC_NVIDIA& cn = coprocs.nvidia;
if (cn.count) {
cn.description(buf, sizeof(buf));
printf(" NVIDIA GPU: %s\n", buf);
if (cn.count > 1) {
printf(" Count: %d\n", cn.count);
}
if (cn.have_opencl) {
cn.opencl_prop.is_used = COPROC_USED;
cn.opencl_prop.peak_flops = cn.peak_flops;
cn.opencl_prop.opencl_available_ram = cn.available_ram;
cn.opencl_prop.description(buf, sizeof(buf), "NVIDIA");
printf(" %s\n", buf);
}
}
COPROC_ATI &ca = coprocs.ati;
if (ca.count) {
ca.description(buf, sizeof(buf));
printf(" AMD GPU: %s\n", buf);
if (ca.count > 1) {
printf(" Count: %d\n", ca.count);
}
if (ca.have_opencl) {
ca.opencl_prop.peak_flops = ca.peak_flops;
ca.opencl_prop.opencl_available_ram = ca.available_ram;
ca.opencl_prop.is_used = COPROC_USED;
ca.opencl_prop.description(buf, sizeof(buf), "AMD");
printf(" %s\n", buf);
}
}
COPROC_INTEL &ci = coprocs.intel_gpu;
if (ci.count) {
printf(" Intel GPU\n");
if (ci.count > 1) {
printf(" Count: %d\n", ci.count);
}
if (ci.have_opencl) {
ci.opencl_prop.peak_flops = ci.peak_flops;
ci.opencl_prop.opencl_available_ram = ci.opencl_prop.global_mem_size;
ci.opencl_prop.is_used = COPROC_USED;
ci.opencl_prop.description(buf, sizeof(buf), "Intel GPU");
printf(" %s\n", buf);
}
}
}
void SIMPLE_GUI_INFO::print() {
unsigned int i;
printf("======== Projects ========\n");
for (i=0; iprint();
}
printf("\n======== Tasks ========\n");
for (i=0; iprint();
}
}
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; iprint();
}
printf("\n======== Applications ========\n");
for (i=0; iprint();
}
printf("\n======== Application versions ========\n");
for (i=0; iprint();
}
printf("\n======== Workunits ========\n");
for (i=0; iprint();
}
printf("\n======== Tasks ========\n");
for (i=0; iprint();
}
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; iprint();
}
}
void PROJECTS::print_urls() {
unsigned int i;
for (i=0; imaster_url);
}
}
void DISK_USAGE::print() {
unsigned int i;
printf("======== Disk usage ========\n");
printf("total: %.2fMB\n", d_total/MEGA);
printf("free: %.2fMB\n", d_free/MEGA);
for (i=0; iprint_disk_usage();
}
}
void RESULTS::print() {
unsigned int i;
printf("\n======== Tasks ========\n");
for (i=0; iprint();
}
}
void FILE_TRANSFERS::print() {
unsigned int i;
printf("\n======== File transfers ========\n");
for (i=0; iprint();
}
}
void MESSAGES::print() {
unsigned int i;
printf("\n======== Messages ========\n");
for (i=0; iprint();
}
}
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()
);
}