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

Private GIT Repository
Add statistics about idle duration.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 14 Oct 2011 15:02:32 +0000 (17:02 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Fri, 14 Oct 2011 15:02:32 +0000 (17:02 +0200)
main.cpp
process.cpp
process.h

index c37355396cc93b135aa8d9bbfb4725fb76dc7b99..45c58cede87dd13f559b1a144cfc42aefa154a70 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -61,6 +61,7 @@ namespace {
     statistics ctrl_recv_amount;
     statistics ctrl_send_count;
     statistics ctrl_recv_count;
+    statistics idle_duration;
     statistics convergence;
 
 }
@@ -91,6 +92,7 @@ static int simulation_main(int argc, char* argv[])
         ctrl_recv_amount.push(proc->get_ctrl_recv_amount());
         ctrl_send_count.push(proc->get_ctrl_send_count());
         ctrl_recv_count.push(proc->get_ctrl_recv_count());
+        idle_duration.push(proc->get_idle_duration());
         double c = proc->get_convergence();
         if (c != -1.0)
             convergence.push(c);
@@ -329,6 +331,7 @@ 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("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);
index b6a6d28de457655c88540d934e6be255ed4c83fc..eac87d1d3de4cff4bbf9206499ab33fd9f92cc30 100644 (file)
@@ -67,6 +67,7 @@ process::process(int argc, char* argv[])
     total_load_init += real_load;
     received_load = 0.0;
 
+    idle_duration = 0.0;
     convergence = -1.0;
 
     process_counter++;
@@ -202,6 +203,7 @@ void process::compute_loop()
     using std::placeholders::_1;
 
     double next_iter_after_date = MSG_get_clock() + opt::min_comp_iter_duration;
+    double idle_since_date = 0.0;
     while (still_running()) {
 
         do {
@@ -226,6 +228,7 @@ void process::compute_loop()
         convergence_check();
 
         // compute
+        idle_duration += MSG_get_clock() - idle_since_date;
         ++comp_iter;
         double flops = opt::comp_cost(real_load);
         m_task_t task = MSG_task_create("computation", flops, 0.0, NULL);
@@ -235,6 +238,8 @@ void process::compute_loop()
         add_comp_amount(flops);
         MSG_task_destroy(task);
 
+        idle_since_date = MSG_get_clock();
+
         sleep_until_date(next_iter_after_date, opt::min_comp_iter_duration);
     }
 
index d2f12292caaf9c62c65115ad5b667133604cd9f4..f2e5a45455674ad2ff40c2fa7831787399a75761 100644 (file)
--- a/process.h
+++ b/process.h
@@ -44,6 +44,7 @@ public:
     double get_ctrl_recv_amount() const    { return acc.ctrl_recv.amount; }
     unsigned get_ctrl_send_count() const   { return acc.ctrl_send.count;  }
     unsigned get_ctrl_recv_count() const   { return acc.ctrl_recv.count;  }
+    double get_idle_duration() const       { return idle_duration;        }
     double get_convergence() const         { return convergence;          }
 
     int run();
@@ -113,6 +114,7 @@ private:
     double expected_load;       // expected load in bookkeeping mode
     double received_load;       // load received from neighbors
 
+    double idle_duration;       // how long we had nothing to compute
     double convergence;         // date when convergence was achieved, or -1.0
 
     mutex_t mutex;              // synchronization between threads