- VBOX: Do not count the sleep time as part of the elapsed time when the VM is supposed to be suspended.

This commit is contained in:
Rom Walton 2012-11-04 22:18:04 -05:00 committed by Oliver Bock
parent 42756406f5
commit edfa1deae1
2 changed files with 17 additions and 7 deletions

View File

@ -6626,3 +6626,10 @@ David 2 Nov 2012
sched_send.cpp
tools/
upgrade
Rom 4 Nov 2012
- VBOX: Do not count the sleep time as part of the elapsed time when
the VM is supposed to be suspended.
samples\vboxwrapper\
vboxwrapper.cpp

View File

@ -792,17 +792,20 @@ int main(int argc, char** argv) {
stopwatch_endtime = dtime();
// Calculate the elapsed time after all potiential commands have been executed
// and base it off of wall clock time instead of a fixed interval.
if (!boinc_status.suspended) {
elapsed_time += stopwatch_endtime - stopwatch_time;
}
// Sleep for the remainder of the polling period
sleep_time = POLL_PERIOD - (stopwatch_endtime - stopwatch_time);
if (sleep_time > 0) {
boinc_sleep(sleep_time);
elapsed_time += sleep_time;
}
// Calculate the elapsed time after all potiential commands have been executed
// and base it off of wall clock time instead of a fixed interval.
if (!boinc_status.suspended) {
if (sleep_time > 0) {
elapsed_time += sleep_time;
} else {
elapsed_time += stopwatch_endtime - stopwatch_time;
}
}
}