VBOX: Use the same technique for calculating when to report a trickle as we use for performing checkpoints.

Deleting previous checkpoints take progressively longer the longer the VM has been running.  The previous method just added 1 second of elapsed time to a variable instead of the real amount of wall clock time to the variable.
This commit is contained in:
Rom Walton 2013-11-06 18:14:04 -05:00
parent 9f7fafa1f3
commit 2d781448cd
1 changed files with 4 additions and 5 deletions

View File

@ -367,10 +367,10 @@ int main(int argc, char** argv) {
APP_INIT_DATA aid; APP_INIT_DATA aid;
double elapsed_time = 0; double elapsed_time = 0;
double trickle_period = 0; double trickle_period = 0;
double trickle_cpu_time = 0;
double fraction_done = 0; double fraction_done = 0;
double checkpoint_cpu_time = 0; double checkpoint_cpu_time = 0;
double last_status_report_time = 0; double last_status_report_time = 0;
double last_trickle_report_time = 0;
double stopwatch_time = 0; double stopwatch_time = 0;
double stopwatch_endtime = 0; double stopwatch_endtime = 0;
double sleep_time = 0; double sleep_time = 0;
@ -883,16 +883,15 @@ int main(int argc, char** argv) {
} }
if (trickle_period) { if (trickle_period) {
trickle_cpu_time += POLL_PERIOD; if ((elapsed_time - last_trickle_report_time) >= trickle_period) {
if (trickle_cpu_time >= trickle_period) {
fprintf( fprintf(
stderr, stderr,
"%s Status Report: Send Trickle-Up Event.\n", "%s Status Report: Send Trickle-Up Event.\n",
vboxwrapper_msg_prefix(buf, sizeof(buf)) vboxwrapper_msg_prefix(buf, sizeof(buf))
); );
sprintf(buf, "<cpu_time>%f</cpu_time>", trickle_cpu_time); last_trickle_report_time = elapsed_time;
sprintf(buf, "<cpu_time>%f</cpu_time>", last_trickle_report_time);
boinc_send_trickle_up(const_cast<char*>("cpu_time"), buf); boinc_send_trickle_up(const_cast<char*>("cpu_time"), buf);
trickle_cpu_time = 0;
} }
} }