int surf_get_nthreads(void);
void surf_set_nthreads(int nthreads);
+void surf_watched_hosts(void);
+
SG_END_DECL()
#endif /* _SURF_SURF_H */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix,
"Logging specific to SIMIX (hosts)");
+xbt_dict_t watched_hosts_lib;
static void SIMIX_execution_finish(smx_action_t action);
arg->properties = properties;
arg->auto_restart = auto_restart;
+ if( SIMIX_host_get_state(host) == SURF_RESOURCE_OFF
+ && !xbt_dict_get_or_null(watched_hosts_lib,host->name)){
+ xbt_dict_set(watched_hosts_lib,host->name,host,NULL);
+ XBT_DEBUG("Have push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",host->name);
+ }
xbt_dynar_push_as(host->auto_restart_processes,smx_process_arg_t,arg);
}
lmm_variable_t var = NULL;
lmm_element_t elem = NULL;
+ surf_watched_hosts();
+
if (event_type == cpu->power_event) {
cpu->power_scale = value;
lmm_update_constraint_bound(surf_cpu_model->model_private->maxmin_system, cpu->constraint,
cpu_ti_t cpu = id;
surf_action_cpu_ti_t action;
+ surf_watched_hosts();
+
if (event_type == cpu->power_event) {
tmgr_trace_t power_trace;
surf_cpu_ti_tgmr_t trace;
as_router_lib = xbt_lib_new();
storage_lib = xbt_lib_new();
storage_type_lib = xbt_lib_new();
+ watched_hosts_lib = xbt_dict_new();
XBT_DEBUG("Add routing levels");
ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free);
xbt_lib_free(&storage_lib);
xbt_lib_free(&storage_type_lib);
+ xbt_dict_free(&watched_hosts_lib);
+
tmgr_finalize();
surf_parse_lex_destroy();
surf_parse_free_callbacks();
surf_nthreads = nthreads;
}
+
+void surf_watched_hosts(void)
+{
+ char *key;
+ void *host;
+ xbt_dict_cursor_t cursor;
+
+ XBT_DEBUG("Check for host SURF_RESOURCE_ON on watched_hosts_lib");
+ xbt_dict_foreach(watched_hosts_lib,cursor,key,host)
+ {
+ if(SIMIX_host_get_state(host) == SURF_RESOURCE_ON){
+ XBT_DEBUG("See SURF_RESOURCE_ON on host: %s",SIMIX_host_get_name(host));
+ // TODO need to restart all processes on host->auto_restart_processes
+ XBT_INFO("Should call SIMIX restart host here for '%s'",SIMIX_host_get_name(host));
+ // TODO be sure having remove the wake up host
+ //xbt_dict_remove(watched_hosts_lib,key);
+ }
+ else
+ XBT_DEBUG("See SURF_RESOURCE_OFF on host: %s",key);
+ }
+}
extern int sg_gtnets_jitter_seed;
#endif
+extern xbt_dict_t watched_hosts_lib;
extern const char *surf_action_state_names[6];