-
- /* Clean Simulator data */
- simdata = host->simdata;
-
- if (xbt_swag_size(simdata->process_list) != 0) {
- char *msg=bprintf("Shutting down host %s, but it's not empty:", host->name);
- char *tmp;
- smx_process_t process = NULL;
-
- xbt_swag_foreach(process, simdata->process_list) {
- tmp = bprintf("%s\n\t%s",msg,process->name);
- free(msg);
- msg=tmp;
- }
- THROW1(arg_error,0,"%s",msg);
+double SIMIX_host_get_speed(smx_host_t host)
+{
+ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
+
+ return surf_workstation_model->extension.workstation.
+ get_speed(host->host, 1.0);
+}
+
+double SIMIX_host_get_available_speed(smx_host_t host)
+{
+ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
+
+ return surf_workstation_model->extension.workstation.
+ get_available_speed(host->host);
+}
+
+int SIMIX_host_get_state(smx_host_t host)
+{
+ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
+
+ return surf_workstation_model->extension.workstation.
+ get_state(host->host);
+}
+
+void* SIMIX_host_self_get_data(void)
+{
+ return SIMIX_host_get_data(SIMIX_host_self());
+}
+
+void SIMIX_host_self_set_data(void *data)
+{
+ SIMIX_host_set_data(SIMIX_host_self(), data);
+}
+
+void* SIMIX_host_get_data(smx_host_t host)
+{
+ xbt_assert((host != NULL), "Invalid parameters (simix host is NULL)");
+
+ return host->data;
+}
+
+void SIMIX_host_set_data(smx_host_t host, void *data)
+{
+ xbt_assert((host != NULL), "Invalid parameters");
+ xbt_assert((host->data == NULL), "Data already set");
+
+ host->data = data;
+}
+
+smx_action_t SIMIX_host_execute(const char *name, smx_host_t host,
+ double computation_amount,
+ double priority)
+{
+ /* alloc structures and initialize */
+ smx_action_t action = xbt_mallocator_get(simix_global->action_mallocator);
+ action->type = SIMIX_ACTION_EXECUTE;
+ action->name = xbt_strdup(name);
+ action->state = SIMIX_RUNNING;
+ action->execution.host = host;
+
+#ifdef HAVE_TRACING
+ action->category = NULL;
+#endif
+
+ /* set surf's action */
+ if (!MC_IS_ENABLED) {
+ action->execution.surf_exec =
+ surf_workstation_model->extension.workstation.execute(host->host,
+ computation_amount);
+ surf_workstation_model->action_data_set(action->execution.surf_exec, action);
+ surf_workstation_model->set_priority(action->execution.surf_exec, priority);