mirror of https://github.com/BOINC/boinc.git
Added estimated transfer time remaining
This commit is contained in:
parent
0f3e0dc6d4
commit
57a6e3ac29
|
@ -1,6 +1,6 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2008 University of California
|
||||
// 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
|
||||
|
@ -446,11 +446,13 @@ int PERS_FILE_XFER::write(MIOFILE& fout) {
|
|||
if (fxp) {
|
||||
fout.printf(
|
||||
" <file_xfer>\n"
|
||||
" <estimated_xfer_time_remaining>%f</estimated_xfer_time_remaining>\n"
|
||||
" <bytes_xferred>%f</bytes_xferred>\n"
|
||||
" <file_offset>%f</file_offset>\n"
|
||||
" <xfer_speed>%f</xfer_speed>\n"
|
||||
" <url>%s</url>\n"
|
||||
" </file_xfer>\n",
|
||||
estimated_xfer_time_remaining(),
|
||||
fxp->bytes_xferred,
|
||||
fxp->file_offset,
|
||||
fxp->xfer_speed,
|
||||
|
@ -476,6 +478,24 @@ void PERS_FILE_XFER::suspend() {
|
|||
fip->upload_offset = -1;
|
||||
}
|
||||
|
||||
// Determines the amount of time for a pfx to complete. Returns time in seconds.
|
||||
//
|
||||
double PERS_FILE_XFER::estimated_xfer_time_remaining() {
|
||||
// The estimated transfer duration will be set to 0 (or, '---' as displayed in the Manager) in three conditions:
|
||||
// 1. The pfx is complete.
|
||||
// 2. The file has not started transferring.
|
||||
// 3. If the transfer speed is 0. This is for conditions when xfer_speed has not been calculated yet
|
||||
// (either from the transfer returning from suspension or the BOINC starting up).
|
||||
if (pers_xfer_done || fxp==0 || fxp->xfer_speed==0) {
|
||||
return 0;
|
||||
}
|
||||
double bytes_remaining = (fip->nbytes - last_bytes_xferred);
|
||||
double est_duration = bytes_remaining / fxp->xfer_speed;
|
||||
if (est_duration <= 0) est_duration = 1;
|
||||
return est_duration;
|
||||
}
|
||||
|
||||
|
||||
PERS_FILE_XFER_SET::PERS_FILE_XFER_SET(FILE_XFER_SET* p) {
|
||||
file_xfers = p;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file is part of BOINC.
|
||||
// http://boinc.berkeley.edu
|
||||
// Copyright (C) 2008 University of California
|
||||
// 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
|
||||
|
@ -115,6 +115,7 @@ public:
|
|||
int create_xfer();
|
||||
int start_xfer();
|
||||
void suspend();
|
||||
double estimated_xfer_time_remaining();
|
||||
};
|
||||
|
||||
class PERS_FILE_XFER_SET {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file is part of BOINC.
|
||||
// https://boinc.berkeley.edu
|
||||
// Copyright (C) 2020 University of California
|
||||
// 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
|
||||
|
@ -329,6 +329,7 @@ struct FILE_TRANSFER {
|
|||
double next_request_time;
|
||||
int status;
|
||||
double time_so_far;
|
||||
double estimated_xfer_time_remaining;
|
||||
double bytes_xferred;
|
||||
double file_offset;
|
||||
double xfer_speed;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// This file is part of BOINC.
|
||||
// https://boinc.berkeley.edu
|
||||
// Copyright (C) 2020 University of California
|
||||
// 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
|
||||
|
@ -784,6 +784,7 @@ int FILE_TRANSFER::parse(XML_PARSER& xp) {
|
|||
if (xp.parse_double("next_request_time", next_request_time)) continue;
|
||||
if (xp.parse_int("status", status)) continue;
|
||||
if (xp.parse_double("time_so_far", time_so_far)) continue;
|
||||
if (xp.parse_double("estimated_xfer_time_remaining", estimated_xfer_time_remaining)) continue;
|
||||
if (xp.parse_double("last_bytes_xferred", bytes_xferred)) continue;
|
||||
if (xp.parse_double("file_offset", file_offset)) continue;
|
||||
if (xp.parse_double("xfer_speed", xfer_speed)) continue;
|
||||
|
@ -809,6 +810,7 @@ void FILE_TRANSFER::clear() {
|
|||
next_request_time = 0;
|
||||
status = 0;
|
||||
time_so_far = 0;
|
||||
estimated_xfer_time_remaining = 0;
|
||||
bytes_xferred = 0;
|
||||
file_offset = 0;
|
||||
xfer_speed = 0;
|
||||
|
@ -1965,7 +1967,7 @@ int RPC_CLIENT::run_benchmarks() {
|
|||
// start or stop a graphics app on behalf of the screensaver.
|
||||
// (needed for Mac OS X 10.15+)
|
||||
//
|
||||
// <operaton can be "run", "runfullscreen" or "stop"
|
||||
// <operation can be "run", "runfullscreen" or "stop"
|
||||
// operand is slot number (for run or runfullscreen) or pid (for stop)
|
||||
// if slot = -1, start the default screensaver
|
||||
// screensaverLoginUser is the login name of the user running the screensaver
|
||||
|
|
Loading…
Reference in New Issue