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

Private GIT Repository
Use static instead of volatile for variables that may be clobbered by a TRY..CATCH.
[loba.git] / main.cpp
index 7a5ccce58615531f850610a530c92cf95d1d3cbd..011b25829306cca025a1f482c66e56291f2f94fa 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -194,9 +194,10 @@ static void install_signal_handler()
 
 int main(int argc, char* argv[])
 {
-    // Note: variables used after THROW must be declared as volatile.
-    volatile int exit_status = 0;   // global exit status
-    volatile double simulated_time = -1.0;
+    // Note: variables modified between TRY (setjmp) and THROW (longjmp)
+    // must be declared as static or volatile.
+    static int exit_status = 0;   // global exit status
+    static double simulated_time = -1.0;
     timestamp elapsed_time(timestamp::wallclock_time);
     timestamp simulation_time(timestamp::cpu_time);
     xbt_ex_t ex;
@@ -333,8 +334,6 @@ int main(int argc, char* argv[])
         PR_STATS("Computation", comps);
         PR_STATS("Comp. iterations", comp_iterations);
         PR_STATS("X-Comp. iterations", all_comp_iterations);
-        PR_STATS("Supernumer. comp. iter.", iter_deviation);
-        PR_STATS("Idle duration", idle_duration);
         PR_STATS("Data send amount", data_send_amount);
         PR_STATS("Data recv amount", data_recv_amount);
         PR_STATS("Data send count", data_send_count);
@@ -362,6 +361,8 @@ int main(int argc, char* argv[])
         PR_VALUE("Times of convergence (min/max/avg/dev)", "%g / %g / %g / %g",
                  convergence.get_min(), convergence.get_max(),
                  convergence.get_mean(), convergence.get_stddev());
+        PR_STATS("Idle duration", idle_duration);
+        PR_STATS("Supernumer. comp. iter.", iter_deviation);
         XBT_INFO("`----");
 
     }