Skip to content
Snippets Groups Projects
Commit c30bd622 authored by Rom Walton's avatar Rom Walton
Browse files

VBOX: Report CPU Time instead of elapsed time to boinc_report_app_status()

parent b07ac77a
Branches
Tags
No related merge requests found
......@@ -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,16 +1001,11 @@ int main(int argc, char** argv) {
}
}
if (boinc_time_to_checkpoint()) {
// Only peform a VM checkpoint every ten minutes or so.
// Basic bookkeeping
//
if (elapsed_time >= checkpoint_cpu_time + random_checkpoint_factor + 600.0) {
// Basic interleave factor is only needed once.
if (random_checkpoint_factor > 0) {
random_checkpoint_factor = 0.0;
if ((int)elapsed_time % 10) {
current_cpu_time = vm.get_vm_cpu_time();
}
// Basic bookkeeping
if (vm.job_duration) {
fraction_done = elapsed_time / vm.job_duration;
} else if (vm.fraction_done_filename.size() > 0) {
......@@ -1018,6 +1014,20 @@ int main(int argc, char** argv) {
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.
//
if (elapsed_time >= checkpoint_cpu_time + random_checkpoint_factor + 600.0) {
// Basic interleave factor is only needed once.
if (random_checkpoint_factor > 0) {
random_checkpoint_factor = 0.0;
}
if ((elapsed_time - last_status_report_time) >= 6000.0) {
last_status_report_time = elapsed_time;
......@@ -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();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment