+ // ok, benchmarking this loop is over
+ xbt_os_timer_stop(smpi_process_timer());
+
+ // update the stats
+ double sample, n;
+ data->count++;
+ sample = xbt_os_timer_elapsed(smpi_process_timer());
+ data->sum += sample;
+ data->sum_pow2 += sample * sample;
+ n = (double)data->count;
+ data->mean = data->sum / n;
+ data->relstderr = sqrt((data->sum_pow2 / n - data->mean * data->mean) / n) / data->mean;
+ if (!sample_enough_benchs(data)) {
+ data->mean = sample; // Still in benching process; We want sample_2 to simulate the exact time of this loop occurrence before leaving, not the mean over the history
+ }
+ XBT_DEBUG("Average mean after %d steps is %f, relative standard error is %f (sample was %f)", data->count,
+ data->mean, data->relstderr, sample);
+
+ // That's enough for now, prevent sample_2 to run the same code over and over
+ data->benching = 0;