From 2d781448cdf027d99008818072d63cd6ef62c594 Mon Sep 17 00:00:00 2001 From: Rom Walton Date: Wed, 6 Nov 2013 18:14:04 -0500 Subject: [PATCH] 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. --- samples/vboxwrapper/vboxwrapper.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/samples/vboxwrapper/vboxwrapper.cpp b/samples/vboxwrapper/vboxwrapper.cpp index 3393922dbe..97482d1179 100644 --- a/samples/vboxwrapper/vboxwrapper.cpp +++ b/samples/vboxwrapper/vboxwrapper.cpp @@ -367,10 +367,10 @@ int main(int argc, char** argv) { APP_INIT_DATA aid; double elapsed_time = 0; double trickle_period = 0; - double trickle_cpu_time = 0; double fraction_done = 0; double checkpoint_cpu_time = 0; double last_status_report_time = 0; + double last_trickle_report_time = 0; double stopwatch_time = 0; double stopwatch_endtime = 0; double sleep_time = 0; @@ -883,16 +883,15 @@ int main(int argc, char** argv) { } if (trickle_period) { - trickle_cpu_time += POLL_PERIOD; - if (trickle_cpu_time >= trickle_period) { + if ((elapsed_time - last_trickle_report_time) >= trickle_period) { fprintf( stderr, "%s Status Report: Send Trickle-Up Event.\n", vboxwrapper_msg_prefix(buf, sizeof(buf)) ); - sprintf(buf, "%f", trickle_cpu_time); + last_trickle_report_time = elapsed_time; + sprintf(buf, "%f", last_trickle_report_time); boinc_send_trickle_up(const_cast("cpu_time"), buf); - trickle_cpu_time = 0; } }