]> AND Private Git Repository - loba.git/blobdiff - process.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
Move sleep between iterations in a better place.
[loba.git] / process.cpp
index 0f535763510940caae9cf9373b36a83b4c1f0694..80fd618e2e2f2153af4b44269a771d89a41de88b 100644 (file)
@@ -72,18 +72,13 @@ int process::run()
     VERB0("Starting...");
     comp_iter = lb_iter = 0;
     while (true) {
     VERB0("Starting...");
     comp_iter = lb_iter = 0;
     while (true) {
-        if (opt::min_iter_duration) {
+        double ld = lb_load();
+        if (ld > 0.0) {
             double now = MSG_get_clock();
             double now = MSG_get_clock();
-            if (now < next_iter_after_date){
-                double delay = next_iter_after_date - now;
-                DEBUG1("sleeping for %g s", delay);
-                MSG_process_sleep(delay);
-            }
+            if (now < next_iter_after_date)
+                MSG_process_sleep(next_iter_after_date - now);
             next_iter_after_date = MSG_get_clock() + opt::min_iter_duration;
             next_iter_after_date = MSG_get_clock() + opt::min_iter_duration;
-        }
 
 
-        double ld = lb_load();
-        if (ld > 0.0) {
             ++lb_iter;
 
             if (opt::log_rate && lb_iter % opt::log_rate == 0) {
             ++lb_iter;
 
             if (opt::log_rate && lb_iter % opt::log_rate == 0) {