+typedef struct {
+ int count;
+ char data[];
+} shared_data_t;
+
+typedef struct {
+ int count;
+ double sum;
+ double sum_pow2;
+ double mean;
+ double relstderr;
+ int iters;
+ double threshold;
+ int started;
+} local_data_t;
+
+void smpi_bench_destroy(void)
+{
+ if (allocs) {
+ xbt_dict_free(&allocs);
+ }
+ if (samples) {
+ xbt_dict_free(&samples);
+ }
+}
+
+static void smpi_execute_flops(double flops)
+{
+ smx_action_t action;
+ smx_host_t host;
+ host = SIMIX_host_self();
+
+ DEBUG1("Handle real computation time: %f flops", flops);
+ action = SIMIX_req_host_execute("computation", host, flops);
+#ifdef HAVE_TRACING
+ SIMIX_req_set_category (action, TRACE_internal_smpi_get_category());
+#endif
+ SIMIX_req_host_execution_wait(action);
+ SIMIX_req_host_execution_destroy(action);
+}
+
+static void smpi_execute(double duration)
+{
+ if (duration >= xbt_cfg_get_double(_surf_cfg_set, "smpi/cpu_threshold")) {
+ DEBUG1("Sleep for %f to handle real computation time", duration);
+ smpi_execute_flops(duration *
+ xbt_cfg_get_double(_surf_cfg_set,
+ "smpi/running_power"));
+ }
+}