mirror of https://github.com/BOINC/boinc.git
VBOX: Report CPU Time instead of elapsed time to boinc_report_app_status()
This commit is contained in:
parent
b07ac77aef
commit
c30bd62227
|
@ -1979,6 +1979,14 @@ int VBOX_VM::get_vm_exit_code(unsigned long& exit_code) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
double VBOX_VM::get_vm_cpu_time() {
|
||||
double x = process_tree_cpu_time(vm_pid);
|
||||
if (x > current_cpu_time) {
|
||||
current_cpu_time = x;
|
||||
}
|
||||
return current_cpu_time;
|
||||
}
|
||||
|
||||
int VBOX_VM::get_port_forwarding_port() {
|
||||
sockaddr_in addr;
|
||||
BOINC_SOCKLEN_T addrsize;
|
||||
|
|
|
@ -98,6 +98,7 @@ public:
|
|||
// maximum amount of wall-clock time this VM is allowed to run before
|
||||
// considering itself done.
|
||||
double job_duration;
|
||||
double current_cpu_time;
|
||||
// name of file where app will write its fraction done
|
||||
std::string fraction_done_filename;
|
||||
// is the VM suspended?
|
||||
|
@ -193,6 +194,7 @@ public:
|
|||
int get_vm_network_bytes_received(double& received);
|
||||
int get_vm_process_id();
|
||||
int get_vm_exit_code(unsigned long& exit_code);
|
||||
double get_vm_cpu_time();
|
||||
|
||||
int get_system_log(std::string& log, bool tail_only = true);
|
||||
int get_vm_log(std::string& log, bool tail_only = true);
|
||||
|
|
|
@ -378,6 +378,7 @@ int main(int argc, char** argv) {
|
|||
double trickle_period = 0;
|
||||
double fraction_done = 0;
|
||||
double checkpoint_cpu_time = 0;
|
||||
double current_cpu_time = 0;
|
||||
double last_status_report_time = 0;
|
||||
double last_trickle_report_time = 0;
|
||||
double stopwatch_starttime = 0;
|
||||
|
@ -1000,6 +1001,25 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
}
|
||||
|
||||
// Basic bookkeeping
|
||||
//
|
||||
if ((int)elapsed_time % 10) {
|
||||
current_cpu_time = vm.get_vm_cpu_time();
|
||||
}
|
||||
if (vm.job_duration) {
|
||||
fraction_done = elapsed_time / vm.job_duration;
|
||||
} else if (vm.fraction_done_filename.size() > 0) {
|
||||
read_fraction_done(fraction_done, vm);
|
||||
}
|
||||
if (fraction_done > 1.0) {
|
||||
fraction_done = 1.0;
|
||||
}
|
||||
boinc_report_app_status(
|
||||
current_cpu_time,
|
||||
checkpoint_cpu_time,
|
||||
fraction_done
|
||||
);
|
||||
|
||||
if (boinc_time_to_checkpoint()) {
|
||||
// Only peform a VM checkpoint every ten minutes or so.
|
||||
//
|
||||
|
@ -1009,16 +1029,6 @@ int main(int argc, char** argv) {
|
|||
random_checkpoint_factor = 0.0;
|
||||
}
|
||||
|
||||
// Basic bookkeeping
|
||||
if (vm.job_duration) {
|
||||
fraction_done = elapsed_time / vm.job_duration;
|
||||
} else if (vm.fraction_done_filename.size() > 0) {
|
||||
read_fraction_done(fraction_done, vm);
|
||||
}
|
||||
if (fraction_done > 1.0) {
|
||||
fraction_done = 1.0;
|
||||
}
|
||||
|
||||
if ((elapsed_time - last_status_report_time) >= 6000.0) {
|
||||
last_status_report_time = elapsed_time;
|
||||
if (vm.job_duration) {
|
||||
|
@ -1078,11 +1088,6 @@ int main(int argc, char** argv) {
|
|||
//
|
||||
checkpoint_cpu_time = elapsed_time;
|
||||
write_checkpoint(checkpoint_cpu_time, vm);
|
||||
boinc_report_app_status(
|
||||
elapsed_time,
|
||||
checkpoint_cpu_time,
|
||||
fraction_done
|
||||
);
|
||||
boinc_checkpoint_completed();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue