- SIMIX_register_action_to_condition(action, smpi_global->timer_cond);
- SIMIX_cond_wait(smpi_global->timer_cond, smpi_global->timer_mutex);
- SIMIX_unregister_action_to_condition(action, smpi_global->timer_cond);
- SIMIX_action_destroy(action);
+int smpi_sample_2(int global, const char *file, int line)
+{
+ char *loc = sample_location(global, file, line);
+ local_data_t *data;
+
+ xbt_assert(samples, "You did something very inconsistent, didn't you?");
+ data = xbt_dict_get_or_null(samples, loc);
+ if (!data) {
+ xbt_assert(data, "Please, do thing in order");
+ }
+ if (!data->started) {
+ if ((data->iters > 0 && data->count >= data->iters)
+ || (data->count > 1 && data->threshold > 0.0 && data->relstderr <= data->threshold)) {
+ XBT_DEBUG("Perform some wait of %f", data->mean);
+ smpi_execute(data->mean);
+ } else {
+ data->started = 1;
+ data->count++;
+ }
+ } else {
+ data->started = 0;
+ }
+ free(loc);
+ smpi_bench_begin();
+ smpi_process_simulated_start();
+ return data->started;
+}
+
+void smpi_sample_3(int global, const char *file, int line)
+{
+ char *loc = sample_location(global, file, line);
+ local_data_t *data;
+ double sample, n;
+
+ xbt_assert(samples, "You did something very inconsistent, didn't you?");
+ data = xbt_dict_get_or_null(samples, loc);
+ smpi_bench_end();
+ if(data && data->started && data->count < data->iters) {
+ sample = smpi_process_simulated_elapsed();
+ 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;
+ XBT_DEBUG("Average mean after %d steps is %f, relative standard error is %f (sample was %f)", data->count,
+ data->mean, data->relstderr, sample);
+ }
+ free(loc);
+}
+
+void smpi_sample_flops(double flops)
+{
+ smpi_execute_flops(flops);
+}