From: Paul Bédaride Date: Fri, 15 Nov 2013 14:27:48 +0000 (+0100) Subject: Merge branch 'surf++' X-Git-Tag: v3_11_beta~297 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/281f8c29e177852dcb1591fc31e363e1176857c8 Merge branch 'surf++' Conflicts: src/include/surf/surf.h src/instr/instr_private.h src/simix/smx_smurf_private.h src/smpi/smpi_bench.c src/surf/workstation.c --- 281f8c29e177852dcb1591fc31e363e1176857c8 diff --cc src/include/surf/maxmin.h index acd57fb07e,adc544c9f0..e4e67c5c78 --- a/src/include/surf/maxmin.h +++ b/src/include/surf/maxmin.h @@@ -31,8 -31,13 +31,12 @@@ static XBT_INLINE int double_equals(dou return (fabs(value1 - value2) < MAXMIN_PRECISION); } + #ifdef __cplusplus + extern "C" { + #endif + XBT_PUBLIC(lmm_system_t) lmm_system_new(int selective_update); XBT_PUBLIC(void) lmm_system_free(lmm_system_t sys); -void lmm_variable_disable(lmm_system_t sys, lmm_variable_t var); XBT_PUBLIC(lmm_constraint_t) lmm_constraint_new(lmm_system_t sys, void *id, double bound_value); diff --cc src/include/surf/surf.h index e59ba761e3,6394581dc9..97bdd5705d --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@@ -375,29 -231,92 +231,93 @@@ static inline void *surf_storage_resour return xbt_lib_get_elm_or_null(storage_lib, name); } - typedef struct surf_resource { - surf_model_t model; - char *name; - xbt_dict_t properties; - void_f_pvoid_t free_f; - } s_surf_resource_t, *surf_resource_t; - - /** - * Resource which have a metric handled by a maxmin system - */ - typedef struct { - double scale; - double peak; - tmgr_trace_event_t event; - } s_surf_metric_t; - - typedef struct surf_resource_lmm { - s_surf_resource_t generic_resource; - lmm_constraint_t constraint; - e_surf_resource_state_t state_current; - tmgr_trace_event_t state_event; - s_surf_metric_t power; - } s_surf_resource_lmm_t, *surf_resource_lmm_t; + #ifdef __cplusplus + extern "C" { + #endif + char *surf_routing_edge_name(sg_routing_edge_t edge); + void *surf_as_cluster_get_backbone(AS_t as); + void surf_as_cluster_set_backbone(AS_t as, void* backbone); + const char *surf_model_name(surf_model_t model); + xbt_swag_t surf_model_done_action_set(surf_model_t model); + xbt_swag_t surf_model_failed_action_set(surf_model_t model); + xbt_swag_t surf_model_ready_action_set(surf_model_t model); + xbt_swag_t surf_model_running_action_set(surf_model_t model); + surf_action_t surf_workstation_model_execute_parallel_task(surf_workstation_model_t model, + int workstation_nb, + void **workstation_list, + double *computation_amount, + double *communication_amount, + double rate); + surf_action_t surf_workstation_model_communicate(surf_workstation_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate); + xbt_dynar_t surf_workstation_model_get_route(surf_workstation_model_t model, surf_resource_t src, surf_resource_t dst); + void surf_vm_workstation_model_create(const char *name, surf_resource_t ind_phys_host); + surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_routing_edge_t src, sg_routing_edge_t dst, double size, double rate); + const char *surf_resource_name(surf_cpp_resource_t resource); + xbt_dict_t surf_resource_get_properties(surf_cpp_resource_t resource); + e_surf_resource_state_t surf_resource_get_state(surf_cpp_resource_t resource); + void surf_resource_set_state(surf_cpp_resource_t resource, e_surf_resource_state_t state); + double surf_workstation_get_speed(surf_resource_t resource, double load); + double surf_workstation_get_available_speed(surf_resource_t resource); + int surf_workstation_get_core(surf_resource_t resource); + surf_action_t surf_workstation_execute(surf_resource_t resource, double size); + surf_action_t surf_workstation_sleep(surf_resource_t resource, double duration); + surf_action_t surf_workstation_open(surf_resource_t workstation, const char* mount, const char* path); + surf_action_t surf_workstation_close(surf_resource_t workstation, surf_file_t fd); + surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size); + surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size); + xbt_dynar_t surf_workstation_get_info(surf_resource_t resource, surf_file_t fd); + sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name); + sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name); + xbt_dynar_t surf_workstation_get_vms(surf_resource_t resource); + void surf_workstation_get_params(surf_resource_t resource, ws_params_t params); + void surf_workstation_set_params(surf_resource_t resource, ws_params_t params); + void surf_vm_workstation_destroy(surf_resource_t resource); + void surf_vm_workstation_suspend(surf_resource_t resource); + void surf_vm_workstation_resume(surf_resource_t resource); + void surf_vm_workstation_save(surf_resource_t resource); + void surf_vm_workstation_restore(surf_resource_t resource); + void surf_vm_workstation_migrate(surf_resource_t resource, surf_resource_t ind_vm_ws_dest); + surf_resource_t surf_vm_workstation_get_pm(surf_resource_t resource); + void surf_vm_workstation_set_bound(surf_resource_t resource, double bound); + void surf_vm_workstation_set_affinity(surf_resource_t resource, surf_resource_t cpu, unsigned long mask); + surf_action_t surf_cpu_execute(surf_resource_t cpu, double size); + surf_action_t surf_cpu_sleep(surf_resource_t cpu, double duration); + double surf_workstation_get_current_power_peak(surf_resource_t host); + double surf_workstation_get_power_peak_at(surf_resource_t host, int pstate_index); + int surf_workstation_get_nb_pstates(surf_resource_t host); + void surf_workstation_set_power_peak_at(surf_resource_t host, int pstate_index); + double surf_workstation_get_consumed_energy(surf_resource_t host); + xbt_dict_t surf_workstation_get_storage_list(surf_resource_t workstation); + int surf_workstation_unlink(surf_resource_t workstation, surf_file_t fd); + surf_action_t surf_workstation_ls(surf_resource_t workstation, const char* mount, const char *path); + size_t surf_workstation_get_size(surf_resource_t workstation, surf_file_t fd); + int surf_network_link_is_shared(surf_cpp_resource_t link); + double surf_network_link_get_bandwidth(surf_cpp_resource_t link); + double surf_network_link_get_latency(surf_cpp_resource_t link); + xbt_dict_t surf_storage_get_content(surf_resource_t resource); + sg_storage_size_t surf_storage_get_size(surf_resource_t resource); ++void surf_storage_rename(surf_resource_t resource, const char* src, const char* dest); + void *surf_action_get_data(surf_action_t action); + void surf_action_set_data(surf_action_t action, void *data); + void surf_action_unref(surf_action_t action); + double surf_action_get_start_time(surf_action_t action); + double surf_action_get_finish_time(surf_action_t action); + double surf_action_get_remains(surf_action_t action); + void surf_action_suspend(surf_action_t action); + void surf_action_resume(surf_action_t action); + void surf_action_cancel(surf_action_t action); + void surf_action_set_priority(surf_action_t action, double priority); + void surf_action_set_category(surf_action_t action, const char *category); + e_surf_action_state_t surf_action_get_state(surf_action_t action); + int surf_action_get_cost(surf_action_t action); + void surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask); + void surf_cpu_action_set_bound(surf_action_t action, double bound); + surf_file_t surf_storage_action_get_file(surf_action_t action); + xbt_dict_t surf_storage_action_get_ls_dict(surf_action_t action); + surf_model_t surf_resource_model(const void *host, int level); + #ifdef __cplusplus + } + #endif /**************************************/ /* Implementations of model object */ diff --cc src/instr/instr_private.h index 2c0fc4b57a,d758703695..84e81c2d71 --- a/src/instr/instr_private.h +++ b/src/instr/instr_private.h @@@ -345,119 -218,10 +349,123 @@@ XBT_PUBLIC(val_t) PJ_value_get_or_new XBT_PUBLIC(val_t) PJ_value_get (const char *name, const type_t father); void PJ_value_free (val_t value); - +void print_pajeDefineContainerType(paje_event_t event); +void print_pajeDefineVariableType(paje_event_t event); +void print_pajeDefineStateType(paje_event_t event); +void print_pajeDefineEventType(paje_event_t event); +void print_pajeDefineLinkType(paje_event_t event); +void print_pajeDefineEntityValue (paje_event_t event); +void print_pajeCreateContainer(paje_event_t event); +void print_pajeDestroyContainer(paje_event_t event); +void print_pajeSetVariable(paje_event_t event); +void print_pajeAddVariable(paje_event_t event); +void print_pajeSubVariable(paje_event_t event); +void print_pajeSetState(paje_event_t event); +void print_pajePushState(paje_event_t event); +void print_pajePopState(paje_event_t event); +void print_pajeResetState(paje_event_t event); +void print_pajeStartLink(paje_event_t event); +void print_pajeEndLink(paje_event_t event); +void print_pajeNewEvent (paje_event_t event); + +void print_TIPushState(paje_event_t event); +void print_TICreateContainer(paje_event_t event); +void print_TIDestroyContainer(paje_event_t event); +void TRACE_TI_start(void); +void TRACE_TI_end(void); +void TRACE_TI_init(void); + +void print_NULL (paje_event_t event); +void TRACE_paje_dump_buffer (int force); +void dump_comment_file (const char *filename); +void dump_comment (const char *comment); + + + + +typedef struct instr_trace_writer { + void (*print_DefineContainerType) (paje_event_t event); + void (*print_DefineVariableType)(paje_event_t event); + void (*print_DefineStateType)(paje_event_t event); + void (*print_DefineEventType)(paje_event_t event); + void (*print_DefineLinkType)(paje_event_t event); + void (*print_DefineEntityValue)(paje_event_t event); + void (*print_CreateContainer)(paje_event_t event); + void (*print_DestroyContainer)(paje_event_t event); + void (*print_SetVariable)(paje_event_t event); + void (*print_AddVariable)(paje_event_t event); + void (*print_SubVariable)(paje_event_t event); + void (*print_SetState)(paje_event_t event); + void (*print_PushState)(paje_event_t event); + void (*print_PopState)(paje_event_t event); + void (*print_ResetState)(paje_event_t event); + void (*print_StartLink)(paje_event_t event); + void (*print_EndLink)(paje_event_t event); + void (*print_NewEvent) (paje_event_t event); +} s_instr_trace_writer_t; + + + +struct s_instr_extra_data; +typedef struct s_instr_extra_data *instr_extra_data; + + +typedef enum{ + TRACING_INIT, + TRACING_FINALIZE, + TRACING_COMM_SIZE, + TRACING_COMM_SPLIT, + TRACING_COMM_DUP, + TRACING_SEND, + TRACING_ISEND, + TRACING_SSEND, + TRACING_ISSEND, + TRACING_RECV, + TRACING_IRECV, + TRACING_SENDRECV, + TRACING_WAIT, + TRACING_WAITALL, + TRACING_WAITANY, + TRACING_BARRIER, + TRACING_BCAST, + TRACING_REDUCE, + TRACING_ALLREDUCE, + TRACING_ALLTOALL, + TRACING_ALLTOALLV, + TRACING_GATHER, + TRACING_GATHERV, + TRACING_SCATTER, + TRACING_SCATTERV, + TRACING_ALLGATHER, + TRACING_ALLGATHERV, + TRACING_REDUCE_SCATTER, + TRACING_COMPUTING, + TRACING_SCAN, + TRACING_EXSCAN +} e_caller_type ; + + + +typedef struct s_instr_extra_data { + e_caller_type type; + int send_size; + int recv_size; + double comp_size; + int src; + int dst; + int root; + const char* datatype1; + const char* datatype2; + int * sendcounts; + int * recvcounts; + int num_processes; +} s_instr_extra_data_t; + + #ifdef __cplusplus + } + #endif + ++ #endif /* HAVE_TRACING */ #ifdef HAVE_JEDULE diff --cc src/simix/smx_io.c index ee36fa4358,f177592824..f3ba022bfe --- a/src/simix/smx_io.c +++ b/src/simix/smx_io.c @@@ -296,20 -287,9 +287,19 @@@ xbt_dynar_t SIMIX_pre_file_get_info(smx xbt_dynar_t SIMIX_file_get_info(smx_process_t process, smx_file_t fd) { smx_host_t host = process->smx_host; - return surf_workstation_model->extension.workstation.get_info(host, - fd->surf_file); + return surf_workstation_get_info(host, fd->surf_file); } +void SIMIX_pre_storage_file_rename(smx_simcall_t simcall, smx_storage_t storage, const char* src, const char* dest) +{ + return SIMIX_storage_file_rename(simcall->issuer, storage, src, dest); +} + +void SIMIX_storage_file_rename(smx_process_t process, smx_storage_t storage, const char* src, const char* dest) +{ - return surf_storage_model->extension.storage.rename(storage, src, dest); ++ return surf_storage_rename(storage, src, dest); +} + sg_storage_size_t SIMIX_pre_storage_get_free_size(smx_simcall_t simcall, const char* name) { return SIMIX_storage_get_free_size(simcall->issuer, name); diff --cc src/simix/smx_smurf_private.h index 6f7f8a4e92,87bce4a331..89b6d68d2e --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@@ -88,12 -88,13 +88,14 @@@ #define TULONG(n) (n, unsigned long, ul) #define TFLOAT(n) (n, float, f) #define TDOUBLE(n) (n, double, d) - #define TPTR(n) (n, void*, p) + #define TDPTR(n) (n, void*, dp, void*) + #define TFPTR(n) (n, FPtr, fp, FPtr) #define TCPTR(n) (n, const void*, cp) #define TSIZE(n) (n, size_t, si) +#define TSGSTSIZE(n) (n, sg_storage_size_t, sgstsi) #define TVOID(n) (n, void) - #define TSPEC(n,t) (n, t, p) + #define TDSPEC(n,t) (n, t, dp, void*) + #define TFSPEC(n,t) (n, t, fp, FPtr) /* use comma or nothing to separate elements*/ #define SIMCALL_SEP_COMMA , @@@ -260,110 -273,129 +274,130 @@@ /* the list of simcalls definitions */ #define SIMCALL_LIST1(ACTION, sep) \ - ACTION(SIMCALL_HOST_GET_BY_NAME, host_get_by_name, WITH_ANSWER, TSPEC(result, smx_host_t), TSTRING(name)) sep \ - ACTION(SIMCALL_HOST_GET_NAME, host_get_name, WITH_ANSWER, TSTRING(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_PROPERTIES, host_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_CORE, host_get_core, WITH_ANSWER, TINT(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_PROCESS_LIST, host_get_process_list, WITH_ANSWER, TSPEC(result, xbt_swag_t), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_SPEED, host_get_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_AVAILABLE_SPEED, host_get_available_speed, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_STATE, host_get_state, WITH_ANSWER, TINT(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_DATA, host_get_data, WITH_ANSWER, TPTR(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_SET_DATA, host_set_data, WITH_ANSWER, TVOID(result), TSPEC(host, smx_host_t), TPTR(data)) sep \ - ACTION(SIMCALL_HOST_GET_CURRENT_POWER_PEAK, host_get_current_power_peak, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_GET_POWER_PEAK_AT, host_get_power_peak_at, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t), TINT(pstate_index)) sep \ - ACTION(SIMCALL_HOST_GET_NB_PSTATES, host_get_nb_pstates, WITH_ANSWER, TINT(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_SET_POWER_PEAK_AT, host_set_power_peak_at, WITH_ANSWER, TVOID(result), TSPEC(host, smx_host_t), TINT(pstate_index)) sep \ - ACTION(SIMCALL_HOST_GET_CONSUMED_ENERGY, host_get_consumed_energy, WITH_ANSWER, TDOUBLE(result), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_HOST_EXECUTE, host_execute, WITH_ANSWER, TSPEC(result, smx_action_t), TSTRING(name), TSPEC(host, smx_host_t), TDOUBLE(computation_amount), TDOUBLE(priority)) sep \ - ACTION(SIMCALL_HOST_PARALLEL_EXECUTE, host_parallel_execute, WITH_ANSWER, TSPEC(result, smx_action_t), TSTRING(name), TINT(host_nb), TSPEC(host_list, smx_host_t*), TSPEC(computation_amount, double*), TSPEC(communication_amount, double*), TDOUBLE(amount), TDOUBLE(rate)) sep \ - ACTION(SIMCALL_HOST_EXECUTION_DESTROY, host_execution_destroy, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t)) sep \ - ACTION(SIMCALL_HOST_EXECUTION_CANCEL, host_execution_cancel, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t)) sep \ - ACTION(SIMCALL_HOST_EXECUTION_GET_REMAINS, host_execution_get_remains, WITH_ANSWER, TDOUBLE(result), TSPEC(execution, smx_action_t)) sep \ - ACTION(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \ - ACTION(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \ - ACTION(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TSPEC(execution, smx_action_t)) sep \ - ACTION(SIMCALL_HOST_GET_STORAGE_LIST, host_get_storage_list, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_PROCESS_CREATE, process_create, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t*), TSTRING(name), TSPEC(code, xbt_main_func_t), TPTR(data), TSTRING(hostname), TDOUBLE(kill_time), TINT(argc), TSPEC(argv, char**), TSPEC(properties, xbt_dict_t), TINT(auto_restart)) sep \ - ACTION(SIMCALL_PROCESS_KILL, process_kill, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_HOST_GET_BY_NAME, host_get_by_name, WITH_ANSWER, TDSPEC(result, smx_host_t), TSTRING(name)) sep \ + ACTION(SIMCALL_HOST_GET_NAME, host_get_name, WITH_ANSWER, TSTRING(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_ON, host_on, WITH_ANSWER, TVOID(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_OFF, host_off, WITH_ANSWER, TVOID(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_PROPERTIES, host_get_properties, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_CORE, host_get_core, WITH_ANSWER, TINT(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_PROCESS_LIST, host_get_process_list, WITH_ANSWER, TDSPEC(result, xbt_swag_t), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_SPEED, host_get_speed, WITH_ANSWER, TDOUBLE(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_AVAILABLE_SPEED, host_get_available_speed, WITH_ANSWER, TDOUBLE(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_STATE, host_get_state, WITH_ANSWER, TINT(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_DATA, host_get_data, WITH_ANSWER, TDPTR(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_SET_DATA, host_set_data, WITH_ANSWER, TVOID(result), TDSPEC(host, smx_host_t), TDPTR(data)) sep \ + ACTION(SIMCALL_HOST_GET_CURRENT_POWER_PEAK, host_get_current_power_peak, WITH_ANSWER, TDOUBLE(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_POWER_PEAK_AT, host_get_power_peak_at, WITH_ANSWER, TDOUBLE(result), TDSPEC(host, smx_host_t), TINT(pstate_index)) sep \ + ACTION(SIMCALL_HOST_GET_NB_PSTATES, host_get_nb_pstates, WITH_ANSWER, TINT(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_SET_POWER_PEAK_AT, host_set_power_peak_at, WITH_ANSWER, TVOID(result), TDSPEC(host, smx_host_t), TINT(pstate_index)) sep \ + ACTION(SIMCALL_HOST_GET_CONSUMED_ENERGY, host_get_consumed_energy, WITH_ANSWER, TDOUBLE(result), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_EXECUTE, host_execute, WITH_ANSWER, TDSPEC(result, smx_action_t), TSTRING(name), TDSPEC(host, smx_host_t), TDOUBLE(computation_amount), TDOUBLE(priority), TDOUBLE(bound), TULONG(affinity_mask)) sep \ + ACTION(SIMCALL_HOST_PARALLEL_EXECUTE, host_parallel_execute, WITH_ANSWER, TDSPEC(result, smx_action_t), TSTRING(name), TINT(host_nb), TDSPEC(host_list, smx_host_t*), TDSPEC(computation_amount, double*), TDSPEC(communication_amount, double*), TDOUBLE(amount), TDOUBLE(rate)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_DESTROY, host_execution_destroy, WITH_ANSWER, TVOID(result), TDSPEC(execution, smx_action_t)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_CANCEL, host_execution_cancel, WITH_ANSWER, TVOID(result), TDSPEC(execution, smx_action_t)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_GET_REMAINS, host_execution_get_remains, WITH_ANSWER, TDOUBLE(result), TDSPEC(execution, smx_action_t)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_GET_STATE, host_execution_get_state, WITH_ANSWER, TINT(result), TDSPEC(execution, smx_action_t)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_SET_PRIORITY, host_execution_set_priority, WITH_ANSWER, TVOID(result), TDSPEC(execution, smx_action_t), TDOUBLE(priority)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_SET_BOUND, host_execution_set_bound, WITH_ANSWER, TVOID(result), TDSPEC(execution, smx_action_t), TDOUBLE(bound)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_SET_AFFINITY, host_execution_set_affinity, WITH_ANSWER, TVOID(result), TDSPEC(execution, smx_action_t), TDSPEC(ws, smx_host_t), TULONG(mask)) sep \ + ACTION(SIMCALL_HOST_EXECUTION_WAIT, host_execution_wait, WITHOUT_ANSWER, TINT(result), TDSPEC(execution, smx_action_t)) sep \ ++ACTION(SIMCALL_HOST_GET_STORAGE_LIST, host_get_storage_list, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_HOST_GET_PARAMS, host_get_params, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t), TDSPEC(params, ws_params_t)) sep \ + ACTION(SIMCALL_HOST_SET_PARAMS, host_set_params, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t), TDSPEC(params, ws_params_t)) sep \ + ACTION(SIMCALL_VM_CREATE, vm_create, WITH_ANSWER, TDPTR(result), TSTRING(name), TDSPEC(ind_pm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_START, vm_start, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_SET_STATE, vm_set_state, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t), TINT(state)) sep \ + ACTION(SIMCALL_VM_GET_STATE, vm_get_state, WITH_ANSWER, TINT(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_MIGRATE, vm_migrate, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t), TDSPEC(ind_dst_pm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_GET_PM, vm_get_pm, WITH_ANSWER, TDPTR(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_SET_BOUND, vm_set_bound, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t), TDOUBLE(bound)) sep \ + ACTION(SIMCALL_VM_SET_AFFINITY, vm_set_affinity, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t), TDSPEC(ind_pm, smx_host_t), TULONG(mask)) sep \ + ACTION(SIMCALL_VM_DESTROY, vm_destroy, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_SUSPEND, vm_suspend, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_RESUME, vm_resume, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_SHUTDOWN, vm_shutdown, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_SAVE, vm_save, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t)) sep \ + ACTION(SIMCALL_VM_RESTORE, vm_restore, WITH_ANSWER, TVOID(result), TDSPEC(ind_vm, smx_host_t)) sep \ -ACTION(SIMCALL_HOST_GET_STORAGE_LIST, host_get_storage_list, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_PROCESS_CREATE, process_create, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t*), TSTRING(name), TFSPEC(code, xbt_main_func_t), TDPTR(data), TSTRING(hostname), TDOUBLE(kill_time), TINT(argc), TDSPEC(argv, char**), TDSPEC(properties, xbt_dict_t), TINT(auto_restart)) sep \ + ACTION(SIMCALL_PROCESS_KILL, process_kill, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t)) sep \ ACTION(SIMCALL_PROCESS_KILLALL, process_killall, WITH_ANSWER, TVOID(result), TINT(reset_pid)) sep \ - ACTION(SIMCALL_PROCESS_CLEANUP, process_cleanup, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_CHANGE_HOST, process_change_host, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TSPEC(dest, smx_host_t)) sep \ - ACTION(SIMCALL_PROCESS_SUSPEND, process_suspend, WITHOUT_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_RESUME, process_resume, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_CLEANUP, process_cleanup, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_CHANGE_HOST, process_change_host, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t), TDSPEC(dest, smx_host_t)) sep \ + ACTION(SIMCALL_PROCESS_SUSPEND, process_suspend, WITHOUT_ANSWER, TVOID(result), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_RESUME, process_resume, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t)) sep \ ACTION(SIMCALL_PROCESS_COUNT, process_count, WITH_ANSWER, TINT(result)) sep \ - ACTION(SIMCALL_PROCESS_GET_PID, process_get_PID, WITH_ANSWER, TINT(result), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_GET_PPID, process_get_PPID, WITH_ANSWER, TINT(result), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_GET_DATA, process_get_data, WITH_ANSWER, TPTR(result), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_SET_DATA, process_set_data, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TPTR(data)) sep \ - ACTION(SIMCALL_PROCESS_GET_HOST, process_get_host, WITH_ANSWER, TSPEC(result, smx_host_t), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_GET_NAME, process_get_name, WITH_ANSWER, TSTRING(result), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_IS_SUSPENDED, process_is_suspended, WITH_ANSWER, TINT(result), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_PROCESS_GET_PROPERTIES, process_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_GET_PID, process_get_PID, WITH_ANSWER, TINT(result), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_GET_PPID, process_get_PPID, WITH_ANSWER, TINT(result), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_GET_DATA, process_get_data, WITH_ANSWER, TDPTR(result), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_SET_DATA, process_set_data, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t), TDPTR(data)) sep \ + ACTION(SIMCALL_PROCESS_GET_HOST, process_get_host, WITH_ANSWER, TDSPEC(result, smx_host_t), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_GET_NAME, process_get_name, WITH_ANSWER, TSTRING(result), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_IS_SUSPENDED, process_is_suspended, WITH_ANSWER, TINT(result), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_PROCESS_GET_PROPERTIES, process_get_properties, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TDSPEC(process, smx_process_t)) sep \ ACTION(SIMCALL_PROCESS_SLEEP, process_sleep, WITHOUT_ANSWER, TINT(result), TDOUBLE(duration)) sep \ - ACTION(SIMCALL_PROCESS_ON_EXIT, process_on_exit, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TSPEC(fun, int_f_pvoid_t), TPTR(data)) sep \ - ACTION(SIMCALL_PROCESS_AUTO_RESTART_SET, process_auto_restart_set, WITH_ANSWER, TVOID(result), TSPEC(process, smx_process_t), TINT(auto_restart)) sep \ - ACTION(SIMCALL_PROCESS_RESTART, process_restart, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(process, smx_process_t)) sep \ - ACTION(SIMCALL_RDV_CREATE, rdv_create, WITH_ANSWER, TSPEC(result, smx_rdv_t), TSTRING(name)) sep \ - ACTION(SIMCALL_RDV_DESTROY, rdv_destroy, WITH_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t)) sep \ - ACTION(SIMCALL_RDV_GET_BY_NAME, rdv_get_by_name, WITH_ANSWER, TSPEC(result, smx_host_t), TSTRING(name)) sep \ - ACTION(SIMCALL_RDV_COMM_COUNT_BY_HOST, rdv_comm_count_by_host, WITH_ANSWER, TUINT(result), TSPEC(rdv, smx_rdv_t), TSPEC(host, smx_host_t)) sep \ - ACTION(SIMCALL_RDV_GET_HEAD, rdv_get_head, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t)) sep \ - ACTION(SIMCALL_RDV_SET_RECV, rdv_set_receiver, WITH_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TSPEC(receiver, smx_process_t)) sep \ - ACTION(SIMCALL_RDV_GET_RECV, rdv_get_receiver, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(rdv, smx_rdv_t)) sep \ - ACTION(SIMCALL_COMM_IPROBE, comm_iprobe, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TINT(src), TINT(tag), TSPEC(match_fun, simix_match_func_t), TPTR(data)) sep \ - ACTION(SIMCALL_COMM_SEND, comm_send, WITHOUT_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TPTR(src_buff), TSIZE(src_buff_size), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(timeout)) sep \ - ACTION(SIMCALL_COMM_ISEND, comm_isend, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TPTR(src_buff), TSIZE(src_buff_size), TSPEC(match_fun, simix_match_func_t), TSPEC(clean_fun, simix_clean_func_t), TPTR(data), TINT(detached)) sep \ - ACTION(SIMCALL_COMM_RECV, comm_recv, WITHOUT_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(timeout)) sep \ - ACTION(SIMCALL_COMM_IRECV, comm_irecv, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data)) sep \ - ACTION(SIMCALL_COMM_RECV_BOUNDED, comm_recv_bounded, WITHOUT_ANSWER, TVOID(result), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(timeout), TDOUBLE(rate)) sep \ - ACTION(SIMCALL_COMM_IRECV_BOUNDED, comm_irecv_bounded, WITH_ANSWER, TSPEC(result, smx_action_t), TSPEC(rdv, smx_rdv_t), TPTR(dst_buff), TSPEC(dst_buff_size, size_t*), TSPEC(match_fun, simix_match_func_t), TPTR(data), TDOUBLE(rate)) sep \ - ACTION(SIMCALL_COMM_DESTROY, comm_destroy, WITH_ANSWER, TVOID(result), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_CANCEL, comm_cancel, WITH_ANSWER, TVOID(result), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_WAITANY, comm_waitany, WITHOUT_ANSWER, TINT(result), TSPEC(comms, xbt_dynar_t)) sep \ - ACTION(SIMCALL_COMM_WAIT, comm_wait, WITHOUT_ANSWER, TVOID(result), TSPEC(comm, smx_action_t), TDOUBLE(timeout)) sep \ - ACTION(SIMCALL_COMM_TEST, comm_test, WITHOUT_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_TESTANY, comm_testany, WITHOUT_ANSWER, TINT(result), TSPEC(comms, xbt_dynar_t)) sep \ - ACTION(SIMCALL_COMM_GET_REMAINS, comm_get_remains, WITH_ANSWER, TDOUBLE(result), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_GET_STATE, comm_get_state, WITH_ANSWER, TINT(result), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_GET_SRC_DATA, comm_get_src_data, WITH_ANSWER, TPTR(result), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_GET_DST_DATA, comm_get_dst_data, WITH_ANSWER, TPTR(result), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_GET_SRC_PROC, comm_get_src_proc, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_COMM_GET_DST_PROC, comm_get_dst_proc, WITH_ANSWER, TSPEC(result, smx_process_t), TSPEC(comm, smx_action_t)) sep \ - ACTION(SIMCALL_MUTEX_INIT, mutex_init, WITH_ANSWER, TSPEC(result, smx_mutex_t)) sep \ - ACTION(SIMCALL_MUTEX_DESTROY, mutex_destroy, WITH_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \ - ACTION(SIMCALL_MUTEX_LOCK, mutex_lock, WITHOUT_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \ - ACTION(SIMCALL_MUTEX_TRYLOCK, mutex_trylock, WITH_ANSWER, TINT(result), TSPEC(mutex, smx_mutex_t)) sep \ - ACTION(SIMCALL_MUTEX_UNLOCK, mutex_unlock, WITH_ANSWER, TVOID(result), TSPEC(mutex, smx_mutex_t)) sep \ - ACTION(SIMCALL_COND_INIT, cond_init, WITH_ANSWER, TSPEC(result, smx_cond_t)) sep \ - ACTION(SIMCALL_COND_DESTROY, cond_destroy, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \ - ACTION(SIMCALL_COND_SIGNAL, cond_signal, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \ - ACTION(SIMCALL_COND_WAIT, cond_wait, WITHOUT_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t), TSPEC(mutex, smx_mutex_t)) sep \ - ACTION(SIMCALL_COND_WAIT_TIMEOUT, cond_wait_timeout, WITHOUT_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t), TSPEC(mutex, smx_mutex_t), TDOUBLE(timeout)) sep \ - ACTION(SIMCALL_COND_BROADCAST, cond_broadcast, WITH_ANSWER, TVOID(result), TSPEC(cond, smx_cond_t)) sep \ - ACTION(SIMCALL_SEM_INIT, sem_init, WITH_ANSWER, TSPEC(result, smx_sem_t), TINT(capacity)) sep \ - ACTION(SIMCALL_SEM_DESTROY, sem_destroy, WITH_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \ - ACTION(SIMCALL_SEM_RELEASE, sem_release, WITH_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \ - ACTION(SIMCALL_SEM_WOULD_BLOCK, sem_would_block, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \ - ACTION(SIMCALL_SEM_ACQUIRE, sem_acquire, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t)) sep \ - ACTION(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem_acquire_timeout, WITHOUT_ANSWER, TVOID(result), TSPEC(sem, smx_sem_t), TDOUBLE(timeout)) sep \ - ACTION(SIMCALL_SEM_GET_CAPACITY, sem_get_capacity, WITH_ANSWER, TINT(result), TSPEC(sem, smx_sem_t)) sep \ - ACTION(SIMCALL_FILE_GET_DATA, file_get_data, WITH_ANSWER, TPTR(result), TSPEC(fd, smx_file_t)) sep \ - ACTION(SIMCALL_FILE_SET_DATA, file_set_data, WITH_ANSWER, TVOID(result), TSPEC(fd, smx_file_t), TPTR(data)) sep \ - ACTION(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TSGSTSIZE(result), TSPEC(fd, smx_file_t), TSGSTSIZE(size)) sep \ - ACTION(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSGSTSIZE(result), TSPEC(fd, smx_file_t), TSGSTSIZE(size)) sep \ - ACTION(SIMCALL_FILE_OPEN, file_open, WITHOUT_ANSWER, TSPEC(result, smx_file_t), TSTRING(mount), TSTRING(path)) sep \ - ACTION(SIMCALL_FILE_CLOSE, file_close, WITHOUT_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \ - ACTION(SIMCALL_FILE_UNLINK, file_unlink, WITH_ANSWER, TINT(result), TSPEC(fd, smx_file_t)) sep \ - ACTION(SIMCALL_FILE_LS, file_ls, WITHOUT_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(mount), TSTRING(path)) sep \ - ACTION(SIMCALL_FILE_GET_SIZE, file_get_size, WITH_ANSWER, TSGSTSIZE(result), TSPEC(fd, smx_file_t)) sep \ - ACTION(SIMCALL_FILE_GET_INFO, file_get_info, WITH_ANSWER, TSPEC(result, xbt_dynar_t), TSPEC(fd, smx_file_t)) sep \ - ACTION(SIMCALL_STORAGE_FILE_RENAME, storage_file_rename, WITH_ANSWER, TVOID(result), TSPEC(storage, smx_storage_t), TSTRING(src), TSTRING(dest)) sep \ - ACTION(SIMCALL_STORAGE_GET_FREE_SIZE, storage_get_free_size, WITH_ANSWER, TSGSTSIZE(result), TSTRING(name)) sep \ - ACTION(SIMCALL_STORAGE_GET_USED_SIZE, storage_get_used_size, WITH_ANSWER, TSGSTSIZE(result), TSTRING(name)) sep \ - ACTION(SIMCALL_STORAGE_GET_PROPERTIES, storage_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(storage, smx_storage_t)) sep \ - ACTION(SIMCALL_STORAGE_GET_CONTENT, storage_get_content, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSPEC(storage, smx_storage_t)) sep \ - ACTION(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TSPEC(result, xbt_dict_t), TSTRING(name)) sep + ACTION(SIMCALL_PROCESS_ON_EXIT, process_on_exit, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t), TFSPEC(fun, int_f_pvoid_t), TDPTR(data)) sep \ + ACTION(SIMCALL_PROCESS_AUTO_RESTART_SET, process_auto_restart_set, WITH_ANSWER, TVOID(result), TDSPEC(process, smx_process_t), TINT(auto_restart)) sep \ + ACTION(SIMCALL_PROCESS_RESTART, process_restart, WITH_ANSWER, TDSPEC(result, smx_process_t), TDSPEC(process, smx_process_t)) sep \ + ACTION(SIMCALL_RDV_CREATE, rdv_create, WITH_ANSWER, TDSPEC(result, smx_rdv_t), TSTRING(name)) sep \ + ACTION(SIMCALL_RDV_DESTROY, rdv_destroy, WITH_ANSWER, TVOID(result), TDSPEC(rdv, smx_rdv_t)) sep \ + ACTION(SIMCALL_RDV_GET_BY_NAME, rdv_get_by_name, WITH_ANSWER, TDSPEC(result, smx_host_t), TSTRING(name)) sep \ + ACTION(SIMCALL_RDV_COMM_COUNT_BY_HOST, rdv_comm_count_by_host, WITH_ANSWER, TUINT(result), TDSPEC(rdv, smx_rdv_t), TDSPEC(host, smx_host_t)) sep \ + ACTION(SIMCALL_RDV_GET_HEAD, rdv_get_head, WITH_ANSWER, TDSPEC(result, smx_action_t), TDSPEC(rdv, smx_rdv_t)) sep \ + ACTION(SIMCALL_RDV_SET_RECV, rdv_set_receiver, WITH_ANSWER, TVOID(result), TDSPEC(rdv, smx_rdv_t), TDSPEC(receiver, smx_process_t)) sep \ + ACTION(SIMCALL_RDV_GET_RECV, rdv_get_receiver, WITH_ANSWER, TDSPEC(result, smx_process_t), TDSPEC(rdv, smx_rdv_t)) sep \ + ACTION(SIMCALL_COMM_IPROBE, comm_iprobe, WITH_ANSWER, TDSPEC(result, smx_action_t), TDSPEC(rdv, smx_rdv_t), TINT(src), TINT(tag), TFSPEC(match_fun, simix_match_func_t), TDPTR(data)) sep \ + ACTION(SIMCALL_COMM_SEND, comm_send, WITHOUT_ANSWER, TVOID(result), TDSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TDPTR(src_buff), TSIZE(src_buff_size), TFSPEC(match_fun, simix_match_func_t), TDPTR(data), TDOUBLE(timeout)) sep \ + ACTION(SIMCALL_COMM_ISEND, comm_isend, WITH_ANSWER, TDSPEC(result, smx_action_t), TDSPEC(rdv, smx_rdv_t), TDOUBLE(task_size), TDOUBLE(rate), TDPTR(src_buff), TSIZE(src_buff_size), TFSPEC(match_fun, simix_match_func_t), TFSPEC(clean_fun, simix_clean_func_t), TDPTR(data), TINT(detached)) sep \ + ACTION(SIMCALL_COMM_RECV, comm_recv, WITHOUT_ANSWER, TVOID(result), TDSPEC(rdv, smx_rdv_t), TDPTR(dst_buff), TDSPEC(dst_buff_size, size_t*), TFSPEC(match_fun, simix_match_func_t), TDPTR(data), TDOUBLE(timeout)) sep \ + ACTION(SIMCALL_COMM_IRECV, comm_irecv, WITH_ANSWER, TDSPEC(result, smx_action_t), TDSPEC(rdv, smx_rdv_t), TDPTR(dst_buff), TDSPEC(dst_buff_size, size_t*), TFSPEC(match_fun, simix_match_func_t), TDPTR(data)) sep \ + ACTION(SIMCALL_COMM_RECV_BOUNDED, comm_recv_bounded, WITHOUT_ANSWER, TVOID(result), TDSPEC(rdv, smx_rdv_t), TDPTR(dst_buff), TDSPEC(dst_buff_size, size_t*), TFSPEC(match_fun, simix_match_func_t), TDPTR(data), TDOUBLE(timeout), TDOUBLE(rate)) sep \ + ACTION(SIMCALL_COMM_IRECV_BOUNDED, comm_irecv_bounded, WITH_ANSWER, TDSPEC(result, smx_action_t), TDSPEC(rdv, smx_rdv_t), TDPTR(dst_buff), TDSPEC(dst_buff_size, size_t*), TFSPEC(match_fun, simix_match_func_t), TDPTR(data), TDOUBLE(rate)) sep \ + ACTION(SIMCALL_COMM_DESTROY, comm_destroy, WITH_ANSWER, TVOID(result), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_CANCEL, comm_cancel, WITH_ANSWER, TVOID(result), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_WAITANY, comm_waitany, WITHOUT_ANSWER, TINT(result), TDSPEC(comms, xbt_dynar_t)) sep \ + ACTION(SIMCALL_COMM_WAIT, comm_wait, WITHOUT_ANSWER, TVOID(result), TDSPEC(comm, smx_action_t), TDOUBLE(timeout)) sep \ + ACTION(SIMCALL_COMM_TEST, comm_test, WITHOUT_ANSWER, TINT(result), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_TESTANY, comm_testany, WITHOUT_ANSWER, TINT(result), TDSPEC(comms, xbt_dynar_t)) sep \ + ACTION(SIMCALL_COMM_GET_REMAINS, comm_get_remains, WITH_ANSWER, TDOUBLE(result), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_GET_STATE, comm_get_state, WITH_ANSWER, TINT(result), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_GET_SRC_DATA, comm_get_src_data, WITH_ANSWER, TDPTR(result), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_GET_DST_DATA, comm_get_dst_data, WITH_ANSWER, TDPTR(result), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_GET_SRC_PROC, comm_get_src_proc, WITH_ANSWER, TDSPEC(result, smx_process_t), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_COMM_GET_DST_PROC, comm_get_dst_proc, WITH_ANSWER, TDSPEC(result, smx_process_t), TDSPEC(comm, smx_action_t)) sep \ + ACTION(SIMCALL_MUTEX_INIT, mutex_init, WITH_ANSWER, TDSPEC(result, smx_mutex_t)) sep \ + ACTION(SIMCALL_MUTEX_DESTROY, mutex_destroy, WITH_ANSWER, TVOID(result), TDSPEC(mutex, smx_mutex_t)) sep \ + ACTION(SIMCALL_MUTEX_LOCK, mutex_lock, WITHOUT_ANSWER, TVOID(result), TDSPEC(mutex, smx_mutex_t)) sep \ + ACTION(SIMCALL_MUTEX_TRYLOCK, mutex_trylock, WITH_ANSWER, TINT(result), TDSPEC(mutex, smx_mutex_t)) sep \ + ACTION(SIMCALL_MUTEX_UNLOCK, mutex_unlock, WITH_ANSWER, TVOID(result), TDSPEC(mutex, smx_mutex_t)) sep \ + ACTION(SIMCALL_COND_INIT, cond_init, WITH_ANSWER, TDSPEC(result, smx_cond_t)) sep \ + ACTION(SIMCALL_COND_DESTROY, cond_destroy, WITH_ANSWER, TVOID(result), TDSPEC(cond, smx_cond_t)) sep \ + ACTION(SIMCALL_COND_SIGNAL, cond_signal, WITH_ANSWER, TVOID(result), TDSPEC(cond, smx_cond_t)) sep \ + ACTION(SIMCALL_COND_WAIT, cond_wait, WITHOUT_ANSWER, TVOID(result), TDSPEC(cond, smx_cond_t), TDSPEC(mutex, smx_mutex_t)) sep \ + ACTION(SIMCALL_COND_WAIT_TIMEOUT, cond_wait_timeout, WITHOUT_ANSWER, TVOID(result), TDSPEC(cond, smx_cond_t), TDSPEC(mutex, smx_mutex_t), TDOUBLE(timeout)) sep \ + ACTION(SIMCALL_COND_BROADCAST, cond_broadcast, WITH_ANSWER, TVOID(result), TDSPEC(cond, smx_cond_t)) sep \ + ACTION(SIMCALL_SEM_INIT, sem_init, WITH_ANSWER, TDSPEC(result, smx_sem_t), TINT(capacity)) sep \ + ACTION(SIMCALL_SEM_DESTROY, sem_destroy, WITH_ANSWER, TVOID(result), TDSPEC(sem, smx_sem_t)) sep \ + ACTION(SIMCALL_SEM_RELEASE, sem_release, WITH_ANSWER, TVOID(result), TDSPEC(sem, smx_sem_t)) sep \ + ACTION(SIMCALL_SEM_WOULD_BLOCK, sem_would_block, WITH_ANSWER, TINT(result), TDSPEC(sem, smx_sem_t)) sep \ + ACTION(SIMCALL_SEM_ACQUIRE, sem_acquire, WITHOUT_ANSWER, TVOID(result), TDSPEC(sem, smx_sem_t)) sep \ + ACTION(SIMCALL_SEM_ACQUIRE_TIMEOUT, sem_acquire_timeout, WITHOUT_ANSWER, TVOID(result), TDSPEC(sem, smx_sem_t), TDOUBLE(timeout)) sep \ + ACTION(SIMCALL_SEM_GET_CAPACITY, sem_get_capacity, WITH_ANSWER, TINT(result), TDSPEC(sem, smx_sem_t)) sep \ + ACTION(SIMCALL_FILE_GET_DATA, file_get_data, WITH_ANSWER, TDPTR(result), TDSPEC(fd, smx_file_t)) sep \ + ACTION(SIMCALL_FILE_SET_DATA, file_set_data, WITH_ANSWER, TVOID(result), TDSPEC(fd, smx_file_t), TDPTR(data)) sep \ + ACTION(SIMCALL_FILE_READ, file_read, WITHOUT_ANSWER, TSIZE(result), TDSPEC(fd, smx_file_t), TSIZE(size)) sep \ + ACTION(SIMCALL_FILE_WRITE, file_write, WITHOUT_ANSWER, TSIZE(result), TDSPEC(fd, smx_file_t), TSIZE(size)) sep \ + ACTION(SIMCALL_FILE_OPEN, file_open, WITHOUT_ANSWER, TDSPEC(result, smx_file_t), TSTRING(mount), TSTRING(path)) sep \ + ACTION(SIMCALL_FILE_CLOSE, file_close, WITHOUT_ANSWER, TINT(result), TDSPEC(fd, smx_file_t)) sep \ + ACTION(SIMCALL_FILE_UNLINK, file_unlink, WITH_ANSWER, TINT(result), TDSPEC(fd, smx_file_t)) sep \ + ACTION(SIMCALL_FILE_LS, file_ls, WITHOUT_ANSWER, TDSPEC(result, xbt_dict_t), TSTRING(mount), TSTRING(path)) sep \ + ACTION(SIMCALL_FILE_GET_SIZE, file_get_size, WITH_ANSWER, TSIZE(result), TDSPEC(fd, smx_file_t)) sep \ + ACTION(SIMCALL_FILE_GET_INFO, file_get_info, WITH_ANSWER, TDSPEC(result, xbt_dynar_t), TDSPEC(fd, smx_file_t)) sep \ ++ACTION(SIMCALL_STORAGE_FILE_RENAME, storage_file_rename, WITH_ANSWER, TVOID(result), TDSPEC(storage, smx_storage_t), TSTRING(src), TSTRING(dest)) sep \ + ACTION(SIMCALL_STORAGE_GET_FREE_SIZE, storage_get_free_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \ + ACTION(SIMCALL_STORAGE_GET_USED_SIZE, storage_get_used_size, WITH_ANSWER, TSIZE(result), TSTRING(name)) sep \ + ACTION(SIMCALL_STORAGE_GET_PROPERTIES, storage_get_properties, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TDSPEC(storage, smx_storage_t)) sep \ + ACTION(SIMCALL_STORAGE_GET_CONTENT, storage_get_content, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TDSPEC(storage, smx_storage_t)) sep \ -ACTION(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TSTRING(name)) sep ++ACTION(SIMCALL_ASR_GET_PROPERTIES, asr_get_properties, WITH_ANSWER, TDSPEC(result, xbt_dict_t), TSTRING(name)) sep /* SIMCALL_COMM_IS_LATENCY_BOUNDED and SIMCALL_SET_CATEGORY make things complicated * because they are not always present */ @@@ -429,8 -462,8 +464,9 @@@ union u_smx_scalar float f; double d; size_t si; + sg_storage_size_t sgstsi; - void* p; + void* dp; + FPtr fp; const void* cp; }; diff --cc src/smpi/smpi_bench.c index b0f25dcaf6,f83d36b557..ddd68327da --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@@ -142,8 -127,9 +142,8 @@@ void smpi_execute_flops(double flops) smx_action_t action; smx_host_t host; host = SIMIX_host_self(); - XBT_DEBUG("Handle real computation time: %g flops", flops); - action = simcall_host_execute("computation", host, flops, 1); - + XBT_DEBUG("Handle real computation time: %f flops", flops); + action = simcall_host_execute("computation", host, flops, 1, 0, 0); #ifdef HAVE_TRACING simcall_set_category (action, TRACE_internal_smpi_get_category()); #endif diff --cc src/surf/storage.cpp index 0000000000,12444185a9..d0b2766967 mode 000000,100644..100644 --- a/src/surf/storage.cpp +++ b/src/surf/storage.cpp @@@ -1,0 -1,702 +1,717 @@@ + #include "storage.hpp" + #include "surf_private.h" + + #define __STDC_FORMAT_MACROS + #include + + extern "C" { + XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_storage, surf, + "Logging specific to the SURF storage module"); + } + + xbt_lib_t storage_lib; + int ROUTING_STORAGE_LEVEL; //Routing for storagelevel + int ROUTING_STORAGE_HOST_LEVEL; + int SURF_STORAGE_LEVEL; + xbt_lib_t storage_type_lib; + int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level + + static xbt_dynar_t storage_list; + + xbt_dynar_t mount_list = NULL; /* temporary store of current mount storage */ + StorageModelPtr surf_storage_model = NULL; + + static int storage_selective_update = 0; + static xbt_swag_t storage_running_action_set_that_does_not_need_being_checked = NULL; + + /************* + * CallBacks * + *************/ + + static XBT_INLINE void routing_storage_type_free(void *r) + { + storage_type_t stype = (storage_type_t) r; + free(stype->model); + free(stype->type_id); + free(stype->content); + xbt_dict_free(&(stype->properties)); + xbt_dict_free(&(stype->properties)); + free(stype); + } + + static XBT_INLINE void surf_storage_resource_free(void *r) + { + // specific to storage + StoragePtr storage = dynamic_cast(static_cast(r)); + xbt_dict_free(&storage->p_content); + xbt_dynar_free(&storage->p_writeActions); + free(storage->p_typeId); + free(storage->p_contentType); + // generic resource + delete storage; + } + + static XBT_INLINE void routing_storage_host_free(void *r) + { + xbt_dynar_t dyn = (xbt_dynar_t) r; + xbt_dynar_free(&dyn); + } + + static void parse_storage_init(sg_platf_storage_cbarg_t storage) + { + void* stype = xbt_lib_get_or_null(storage_type_lib, + storage->type_id, + ROUTING_STORAGE_TYPE_LEVEL); + if(!stype) xbt_die("No storage type '%s'",storage->type_id); + + // if storage content is not specified use the content of storage_type if exist + if(!strcmp(storage->content,"") && strcmp(((storage_type_t) stype)->content,"")){ + storage->content = ((storage_type_t) stype)->content; + storage->content_type = ((storage_type_t) stype)->content_type; + XBT_DEBUG("For disk '%s' content is empty, inherit the content (of type %s) from storage type '%s' ", + storage->id,((storage_type_t) stype)->content_type, + ((storage_type_t) stype)->type_id); + } + + XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s' " + "\n\t\tmodel '%s' \n\t\tcontent '%s'\n\t\tcontent_type '%s' " + "\n\t\tproperties '%p'\n", + storage->id, + ((storage_type_t) stype)->model, + ((storage_type_t) stype)->type_id, + storage->content, + storage->content_type, + ((storage_type_t) stype)->properties); + + surf_storage_model->createResource(storage->id, ((storage_type_t) stype)->model, + ((storage_type_t) stype)->type_id, + storage->content, + storage->content_type, + storage->properties); + } + + static void parse_mstorage_init(sg_platf_mstorage_cbarg_t mstorage) + { + XBT_DEBUG("parse_mstorage_init"); + } + + static void parse_storage_type_init(sg_platf_storage_type_cbarg_t storagetype_) + { + XBT_DEBUG("parse_storage_type_init"); + } + + static void parse_mount_init(sg_platf_mount_cbarg_t mount) + { + XBT_DEBUG("parse_mount_init"); + } + + static void storage_parse_storage(sg_platf_storage_cbarg_t storage) + { + xbt_assert(!xbt_lib_get_or_null(storage_lib, storage->id,ROUTING_STORAGE_LEVEL), + "Reading a storage, processing unit \"%s\" already exists", storage->id); + + // Verification of an existing type_id + #ifndef NDEBUG + void* storage_type = xbt_lib_get_or_null(storage_type_lib, storage->type_id,ROUTING_STORAGE_TYPE_LEVEL); + #endif + xbt_assert(storage_type,"Reading a storage, type id \"%s\" does not exists", storage->type_id); + + XBT_DEBUG("ROUTING Create a storage name '%s' with type_id '%s' and content '%s'", + storage->id, + storage->type_id, + storage->content); + + xbt_lib_set(storage_lib, + storage->id, + ROUTING_STORAGE_LEVEL, + (void *) xbt_strdup(storage->type_id)); + } + + static xbt_dict_t parse_storage_content(char *filename, sg_storage_size_t *used_size) + { + *used_size = 0; + if ((!filename) || (strcmp(filename, "") == 0)) + return NULL; + + xbt_dict_t parse_content = xbt_dict_new_homogeneous(xbt_free); + FILE *file = NULL; + + file = surf_fopen(filename, "r"); + xbt_assert(file != NULL, "Cannot open file '%s' (path=%s)", filename, + xbt_str_join(surf_path, ":")); + + char *line = NULL; + size_t len = 0; + ssize_t read; + char path[1024]; + sg_storage_size_t size; + + + while ((read = xbt_getline(&line, &len, file)) != -1) { + if (read){ + if(sscanf(line,"%s %" SCNu64, path, &size) == 2) { + *used_size += size; + sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1); + *psize = size; + xbt_dict_set(parse_content,path,psize,NULL); + } else { + xbt_die("Be sure of passing a good format for content file.\n"); + } + } + } + free(line); + fclose(file); + return parse_content; + } + + static void storage_parse_storage_type(sg_platf_storage_type_cbarg_t storage_type) + { + xbt_assert(!xbt_lib_get_or_null(storage_type_lib, storage_type->id,ROUTING_STORAGE_TYPE_LEVEL), + "Reading a storage type, processing unit \"%s\" already exists", storage_type->id); + + storage_type_t stype = xbt_new0(s_storage_type_t, 1); + stype->model = xbt_strdup(storage_type->model); + stype->properties = storage_type->properties; + stype->content = xbt_strdup(storage_type->content); + stype->content_type = xbt_strdup(storage_type->content_type); + stype->type_id = xbt_strdup(storage_type->id); + stype->size = storage_type->size; + + XBT_DEBUG("ROUTING Create a storage type id '%s' with model '%s', " + "content '%s', and content_type '%s'", + stype->type_id, + stype->model, + storage_type->content, + storage_type->content_type); + + xbt_lib_set(storage_type_lib, + stype->type_id, + ROUTING_STORAGE_TYPE_LEVEL, + (void *) stype); + } + static void storage_parse_mstorage(sg_platf_mstorage_cbarg_t mstorage) + { + THROW_UNIMPLEMENTED; + // mount_t mnt = xbt_new0(s_mount_t, 1); + // mnt->id = xbt_strdup(mstorage->type_id); + // mnt->name = xbt_strdup(mstorage->name); + // + // if(!mount_list){ + // XBT_DEBUG("Creata a Mount list for %s",A_surfxml_host_id); + // mount_list = xbt_dynar_new(sizeof(char *), NULL); + // } + // xbt_dynar_push(mount_list,(void *) mnt); + // free(mnt->id); + // free(mnt->name); + // xbt_free(mnt); + // XBT_DEBUG("ROUTING Mount a storage name '%s' with type_id '%s'",mstorage->name, mstorage->id); + } + + static void mount_free(void *p) + { + mount_t mnt = (mount_t) p; + xbt_free(mnt->name); + } + + static void storage_parse_mount(sg_platf_mount_cbarg_t mount) + { + // Verification of an existing storage + #ifndef NDEBUG + void* storage = xbt_lib_get_or_null(storage_lib, mount->storageId, ROUTING_STORAGE_LEVEL); + #endif + xbt_assert(storage,"Disk id \"%s\" does not exists", mount->storageId); + + XBT_DEBUG("ROUTING Mount '%s' on '%s'",mount->storageId, mount->name); + + s_mount_t mnt; + mnt.storage = surf_storage_resource_priv(surf_storage_resource_by_name(mount->storageId)); + mnt.name = xbt_strdup(mount->name); + + if(!mount_list){ + //FIXME:XBT_DEBUG("Create a Mount list for %s",A_surfxml_host_id); + mount_list = xbt_dynar_new(sizeof(s_mount_t), mount_free); + } + xbt_dynar_push(mount_list,&mnt); + } + + static void storage_define_callbacks() + { + sg_platf_storage_add_cb(parse_storage_init); + sg_platf_storage_type_add_cb(parse_storage_type_init); + sg_platf_mstorage_add_cb(parse_mstorage_init); + sg_platf_mount_add_cb(parse_mount_init); + } + + void storage_register_callbacks() { + + ROUTING_STORAGE_LEVEL = xbt_lib_add_level(storage_lib,xbt_free); + ROUTING_STORAGE_HOST_LEVEL = xbt_lib_add_level(storage_lib, routing_storage_host_free); + ROUTING_STORAGE_TYPE_LEVEL = xbt_lib_add_level(storage_type_lib, routing_storage_type_free); + SURF_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, surf_storage_resource_free); + + sg_platf_storage_add_cb(storage_parse_storage); + sg_platf_mstorage_add_cb(storage_parse_mstorage); + sg_platf_storage_type_add_cb(storage_parse_storage_type); + sg_platf_mount_add_cb(storage_parse_mount); + } + + /********* + * Model * + *********/ + + void surf_storage_model_init_default(void) + { + surf_storage_model = new StorageModel(); + storage_define_callbacks(); + xbt_dynar_push(model_list, &surf_storage_model); + } + + StorageModel::StorageModel() : Model("Storage") { + StorageActionLmm action; + + XBT_DEBUG("surf_storage_model_init_internal"); + + storage_running_action_set_that_does_not_need_being_checked = + xbt_swag_new(xbt_swag_offset(action, p_stateHookup)); + + if (!p_maxminSystem) { + p_maxminSystem = lmm_system_new(storage_selective_update); + } + } + + + StorageModel::~StorageModel(){ + lmm_system_free(p_maxminSystem); + + surf_storage_model = NULL; + + xbt_dynar_free(&storage_list); + + xbt_swag_free(storage_running_action_set_that_does_not_need_being_checked); + storage_running_action_set_that_does_not_need_being_checked = NULL; + } + + StoragePtr StorageModel::createResource(const char* id, const char* model, const char* type_id, + const char* content_name, const char* content_type, xbt_dict_t properties) + { + + xbt_assert(!surf_storage_resource_priv(surf_storage_resource_by_name(id)), + "Storage '%s' declared several times in the platform file", + id); + + storage_type_t storage_type = (storage_type_t) xbt_lib_get_or_null(storage_type_lib, type_id,ROUTING_STORAGE_TYPE_LEVEL); + + double Bread = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->properties, "Bread")); + double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->properties, "Bwrite")); + double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->properties, "Bconnection")); + + StoragePtr storage = new StorageLmm(this, id, properties, p_maxminSystem, + Bread, Bwrite, Bconnection, + type_id, (char *)content_name, xbt_strdup(content_type), storage_type->size); + + xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, static_cast(storage)); + + XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s' \n\t\tmodel '%s' \n\t\tproperties '%p'\n\t\tBread '%f'\n", + id, + model, + type_id, + storage_type->properties, + Bread); + + if(!storage_list) + storage_list = xbt_dynar_new(sizeof(char *),NULL); + xbt_dynar_push(storage_list, &storage); + + return storage; + } + + double StorageModel::shareResources(double now) + { + XBT_DEBUG("storage_share_resources %f", now); + unsigned int i, j; + StoragePtr storage; + StorageActionLmmPtr write_action; + + double min_completion = shareResourcesMaxMin(p_runningActionSet, + p_maxminSystem, lmm_solve); + + double rate; + // Foreach disk + xbt_dynar_foreach(storage_list,i,storage) + { + rate = 0; + // Foreach write action on disk + xbt_dynar_foreach(storage->p_writeActions, j, write_action) + { + rate += lmm_variable_getvalue(write_action->p_variable); + } + if(rate > 0) + min_completion = MIN(min_completion, (storage->m_size-storage->m_usedSize)/rate); + } + + return min_completion; + } + + void StorageModel::updateActionsState(double now, double delta) + { + void *_action, *_next_action; + StorageActionLmmPtr action = NULL; + + xbt_swag_foreach_safe(_action, _next_action, p_runningActionSet) { + action = dynamic_cast(static_cast(_action)); + if(action->m_type == WRITE) + { + // Update the disk usage + // Update the file size + // For each action of type write + double rate = lmm_variable_getvalue(action->p_variable); + /* Hack to avoid rounding differences between x86 and x86_64 + * (note that the next sizes are of type sg_storage_size_t). */ + long incr = delta * rate + MAXMIN_PRECISION; + action->p_storage->m_usedSize += incr; // disk usage + action->p_file->size += incr; // file size + + sg_storage_size_t *psize = xbt_new(sg_storage_size_t,1); + *psize = action->p_file->size; + + xbt_dict_t content_dict = action->p_storage->p_content; + xbt_dict_set(content_dict, action->p_file->name, psize, NULL); + } + + double_update(&action->m_remains, + lmm_variable_getvalue(action->p_variable) * delta); + + if (action->m_maxDuration != NO_MAX_DURATION) + double_update(&action->m_maxDuration, delta); + + if(action->m_remains > 0 && + lmm_get_variable_weight(action->p_variable) > 0 && + action->p_storage->m_usedSize == action->p_storage->m_size) + { + action->m_finish = surf_get_clock(); + action->setState(SURF_ACTION_FAILED); + } else if ((action->m_remains <= 0) && + (lmm_get_variable_weight(action->p_variable) > 0)) + { + action->m_finish = surf_get_clock(); + action->setState(SURF_ACTION_DONE); + } else if ((action->m_maxDuration != NO_MAX_DURATION) && + (action->m_maxDuration <= 0)) + { + action->m_finish = surf_get_clock(); + action->setState(SURF_ACTION_DONE); + } + } + + return; + } + + xbt_dict_t Storage::parseContent(char *filename) + { + m_usedSize = 0; + if ((!filename) || (strcmp(filename, "") == 0)) + return NULL; + + xbt_dict_t parse_content = xbt_dict_new_homogeneous(xbt_free); + FILE *file = NULL; + + file = surf_fopen(filename, "r"); + xbt_assert(file != NULL, "Cannot open file '%s' (path=%s)", filename, + xbt_str_join(surf_path, ":")); + + char *line = NULL; + size_t len = 0; + ssize_t read; + char path[1024]; + sg_storage_size_t size; + + + while ((read = xbt_getline(&line, &len, file)) != -1) { + if (read){ + if(sscanf(line,"%s %" SCNu64, path, &size) == 2) { + m_usedSize += size; + sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1); + *psize = size; + xbt_dict_set(parse_content,path,psize,NULL); + } else { + xbt_die("Be sure of passing a good format for content file.\n"); + } + } + } + free(line); + fclose(file); + return parse_content; + } + + /************ + * Resource * + ************/ + + Storage::Storage(StorageModelPtr model, const char* name, xbt_dict_t properties) + : Resource(model, name, properties) + { + p_writeActions = xbt_dynar_new(sizeof(char *),NULL); + } + + StorageLmm::StorageLmm(StorageModelPtr model, const char* name, xbt_dict_t properties, + lmm_system_t maxminSystem, double bread, double bwrite, double bconnection, + const char* type_id, char *content_name, char *content_type, size_t size) + : Resource(model, name, properties), ResourceLmm(), Storage(model, name, properties) { + XBT_DEBUG("Create resource with Bconnection '%f' Bread '%f' Bwrite '%f' and Size '%lu'", bconnection, bread, bwrite, ((unsigned long)size)); + + p_stateCurrent = SURF_RESOURCE_ON; + m_usedSize = 0; + m_size = 0; + + p_content = parseContent(content_name); + p_contentType = content_type; + p_constraint = lmm_constraint_new(maxminSystem, this, bconnection); + p_constraintRead = lmm_constraint_new(maxminSystem, this, bread); + p_constraintWrite = lmm_constraint_new(maxminSystem, this, bwrite); + m_size = size; + p_typeId = xbt_strdup(type_id); + } + + bool Storage::isUsed() + { + THROW_UNIMPLEMENTED; + return false; + } + + void Storage::updateState(tmgr_trace_event_t event_type, double value, double date) + { + THROW_UNIMPLEMENTED; + } + + StorageActionPtr StorageLmm::ls(const char* path) + { + StorageActionLmmPtr action = new StorageActionLmm(p_model, 0, p_stateCurrent != SURF_RESOURCE_ON, this, LS); + + action->p_lsDict = NULL; + xbt_dict_t ls_dict = xbt_dict_new_homogeneous(xbt_free); + + char* key; + sg_storage_size_t size = 0; + xbt_dict_cursor_t cursor = NULL; + + xbt_dynar_t dyn = NULL; + char* file = NULL; + + // for each file in the storage content + xbt_dict_foreach(p_content,cursor,key,size){ + // Search if file start with the prefix 'path' + if(xbt_str_start_with(key,path)){ + file = &key[strlen(path)]; + + // Split file with '/' + dyn = xbt_str_split(file,"/"); + file = xbt_dynar_get_as(dyn,0,char*); + + // file + if(xbt_dynar_length(dyn) == 1){ + sg_storage_size_t *psize = xbt_new(sg_storage_size_t, 1); + *psize=size; + xbt_dict_set(ls_dict, file, psize, NULL); + } + // Directory + else + { + // if directory does not exist yet in the dictionary + if(!xbt_dict_get_or_null(ls_dict,file)) + xbt_dict_set(ls_dict,file,NULL,NULL); + } + xbt_dynar_free(&dyn); + } + } + + action->p_lsDict = ls_dict; + return action; + } + + StorageActionPtr StorageLmm::open(const char* mount, const char* path) + { + XBT_DEBUG("\tOpen file '%s'",path); + sg_storage_size_t size, *psize; + psize = (sg_storage_size_t*) xbt_dict_get_or_null(p_content, path); + // if file does not exist create an empty file + if(psize) + size = *psize; + else { + psize = xbt_new(sg_storage_size_t,1); + size = 0; + *psize = size; + xbt_dict_set(p_content, path, psize, NULL); + XBT_DEBUG("File '%s' was not found, file created.",path); + } + surf_file_t file = xbt_new0(s_surf_file_t,1); + file->name = xbt_strdup(path); + file->size = size; + file->mount = xbt_strdup(mount); + + StorageActionLmmPtr action = new StorageActionLmm(p_model, 0, p_stateCurrent != SURF_RESOURCE_ON, this, OPEN); + action->p_file = file; + return action; + } + + StorageActionPtr StorageLmm::close(surf_file_t fd) + { + char *filename = fd->name; + XBT_DEBUG("\tClose file '%s' size '%" PRIu64 "'", filename, fd->size); + // unref write actions from storage + StorageActionLmmPtr write_action; + unsigned int i; + xbt_dynar_foreach(p_writeActions, i, write_action) { + if ((write_action->p_file) == fd) { + xbt_dynar_cursor_rm(p_writeActions, &i); + write_action->unref(); + } + } + free(fd->name); + free(fd->mount); + xbt_free(fd); + StorageActionLmmPtr action = new StorageActionLmm(p_model, 0, p_stateCurrent != SURF_RESOURCE_ON, this, CLOSE); + return action; + } + + StorageActionPtr StorageLmm::read(surf_file_t fd, sg_storage_size_t size) + { + if(size > fd->size) + size = fd->size; + StorageActionLmmPtr action = new StorageActionLmm(p_model, size, p_stateCurrent != SURF_RESOURCE_ON, this, READ); + return action; + } + + StorageActionPtr StorageLmm::write(surf_file_t fd, sg_storage_size_t size) + { + char *filename = fd->name; + XBT_DEBUG("\tWrite file '%s' size '%" PRIu64 "/%" PRIu64 "'",filename,size,fd->size); + + StorageActionLmmPtr action = new StorageActionLmm(p_model, size, p_stateCurrent != SURF_RESOURCE_ON, this, WRITE); + action->p_file = fd; + + // If the storage is full + if(m_usedSize==m_size) { + action->setState(SURF_ACTION_FAILED); + } + return action; + } + ++void StorageLmm::rename(const char *src, const char *dest) ++{ ++ sg_storage_size_t *psize, *new_psize; ++ psize = (sg_storage_size_t*) xbt_dict_get_or_null(p_content,src); ++ new_psize = xbt_new(sg_storage_size_t, 1); ++ *new_psize = *psize; ++ if (psize){// src file exists ++ xbt_dict_remove(p_content, src); ++ xbt_dict_set(p_content, dest, new_psize,NULL); ++ XBT_DEBUG("Change file name from %s to %s, size '%" PRIu64 "'",src, dest, *psize); ++ } ++ else ++ XBT_DEBUG("File %s doesn't exist",src); ++} ++ + xbt_dict_t StorageLmm::getContent() + { + /* For the moment this action has no cost, but in the future we could take in account access latency of the disk */ + /*surf_action_t action = storage_action_execute(storage,0, LS);*/ + + xbt_dict_t content_dict = xbt_dict_new_homogeneous(NULL); + xbt_dict_cursor_t cursor = NULL; + char *file; + sg_storage_size_t *psize; + + xbt_dict_foreach(p_content, cursor, file, psize){ + xbt_dict_set(content_dict,file,psize,NULL); + } + return content_dict; + } + + sg_storage_size_t StorageLmm::getSize(){ + return m_size; + } + + /********** + * Action * + **********/ + + StorageActionLmm::StorageActionLmm(ModelPtr model, double cost, bool failed, StorageLmmPtr storage, e_surf_action_storage_type_t type) + : Action(model, cost, failed), ActionLmm(model, cost, failed), StorageAction(model, cost, failed, storage, type) { + XBT_IN("(%s,%" PRIu64, storage->m_name, cost); + p_variable = lmm_variable_new(p_model->p_maxminSystem, this, 1.0, -1.0 , 3); + + // Must be less than the max bandwidth for all actions + lmm_expand(p_model->p_maxminSystem, storage->p_constraint, p_variable, 1.0); + switch(type) { + case OPEN: + case CLOSE: + case STAT: + case LS: + break; + case READ: + lmm_expand(p_model->p_maxminSystem, storage->p_constraintRead, + p_variable, 1.0); + break; + case WRITE: + lmm_expand(p_model->p_maxminSystem, storage->p_constraintWrite, + p_variable, 1.0); + xbt_dynar_push(storage->p_writeActions, static_cast(this)); + break; + } + XBT_OUT(); + } + + int StorageActionLmm::unref() + { + m_refcount--; + if (!m_refcount) { + xbt_swag_remove(static_cast(this), p_stateSet); + if (p_variable) + lmm_variable_free(p_model->p_maxminSystem, p_variable); + #ifdef HAVE_TRACING + xbt_free(p_category); + #endif + delete this; + return 1; + } + return 0; + } + + void StorageActionLmm::cancel() + { + setState(SURF_ACTION_FAILED); + return; + } + + void StorageActionLmm::suspend() + { + XBT_IN("(%p)", this); + if (m_suspended != 2) { + lmm_update_variable_weight(p_model->p_maxminSystem, + p_variable, + 0.0); + m_suspended = 1; + } + XBT_OUT(); + } + + void StorageActionLmm::resume() + { + THROW_UNIMPLEMENTED; + } + + bool StorageActionLmm::isSuspended() + { + return m_suspended == 1; + } + + void StorageActionLmm::setMaxDuration(double duration) + { + THROW_UNIMPLEMENTED; + } + + void StorageActionLmm::setPriority(double priority) + { + THROW_UNIMPLEMENTED; + } + diff --cc src/surf/storage.hpp index 0000000000,cceebf5ba6..bf16cef88b mode 000000,100644..100644 --- a/src/surf/storage.hpp +++ b/src/surf/storage.hpp @@@ -1,0 -1,150 +1,153 @@@ + #include "surf.hpp" + + #ifndef STORAGE_HPP_ + #define STORAGE_HPP_ + + /*********** + * Classes * + ***********/ + + class StorageModel; + typedef StorageModel *StorageModelPtr; + + class Storage; + typedef Storage *StoragePtr; + + class StorageLmm; + typedef StorageLmm *StorageLmmPtr; + + class StorageAction; + typedef StorageAction *StorageActionPtr; + + class StorageActionLmm; + typedef StorageActionLmm *StorageActionLmmPtr; + + + /********* + * Model * + *********/ + class StorageModel : public Model { + public: + StorageModel(); + ~StorageModel(); + StoragePtr createResource(const char* id, const char* model, const char* type_id, + const char* content_name, const char* content_type, xbt_dict_t properties); + double shareResources(double now); + void updateActionsState(double now, double delta); + + }; + + /************ + * Resource * + ************/ + + class Storage : virtual public Resource { + public: + Storage(StorageModelPtr model, const char* name, xbt_dict_t properties); + + bool isUsed(); + void updateState(tmgr_trace_event_t event_type, double value, double date); + + xbt_dict_t p_content; + char* p_contentType; + sg_storage_size_t m_size; + sg_storage_size_t m_usedSize; + char * p_typeId; + + virtual StorageActionPtr open(const char* mount, const char* path)=0; + virtual StorageActionPtr close(surf_file_t fd)=0; + //virtual StorageActionPtr unlink(surf_file_t fd)=0; + virtual StorageActionPtr ls(const char *path)=0; + virtual StorageActionPtr read(surf_file_t fd, sg_storage_size_t size)=0; + virtual StorageActionPtr write(surf_file_t fd, sg_storage_size_t size)=0; ++ virtual void rename(const char *src, const char *dest)=0; ++ + virtual xbt_dict_t getContent()=0; + virtual sg_storage_size_t getSize()=0; + + xbt_dict_t parseContent(char *filename); + + xbt_dynar_t p_writeActions; + }; + + class StorageLmm : public ResourceLmm, public Storage { + public: + StorageLmm(StorageModelPtr model, const char* name, xbt_dict_t properties, + lmm_system_t maxminSystem, double bread, double bwrite, double bconnection, + const char* type_id, char *content_name, char *content_type, size_t size); + + StorageActionPtr open(const char* mount, const char* path); + StorageActionPtr close(surf_file_t fd); + //StorageActionPtr unlink(surf_file_t fd); + StorageActionPtr ls(const char *path); + xbt_dict_t getContent(); + sg_storage_size_t getSize(); + StorageActionPtr read(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ?? + StorageActionPtr write(surf_file_t fd, sg_storage_size_t size);//FIXME:why we have a useless param ptr ?? ++ void rename(const char *src, const char *dest); + + lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/ + lmm_constraint_t p_constraintRead; /* Constraint for maximum write bandwidth*/ + }; + + /********** + * Action * + **********/ + + typedef enum { + READ=0, WRITE, STAT, OPEN, CLOSE, LS + } e_surf_action_storage_type_t; + + + class StorageAction : virtual public Action { + public: + StorageAction(){}; + StorageAction(ModelPtr model, double cost, bool failed, StoragePtr storage, e_surf_action_storage_type_t type) + : p_storage(storage), m_type(type) {}; + + + + e_surf_action_storage_type_t m_type; + StoragePtr p_storage; + surf_file_t p_file; + xbt_dict_t p_lsDict; + }; + + class StorageActionLmm : public ActionLmm, public StorageAction { + public: + StorageActionLmm(){}; + StorageActionLmm(ModelPtr model, double cost, bool failed, StorageLmmPtr storage, e_surf_action_storage_type_t type); + void suspend(); + int unref(); + void cancel(); + //FIXME:??void recycle(); + void resume(); + bool isSuspended(); + void setMaxDuration(double duration); + void setPriority(double priority); + + }; + + + typedef struct s_storage_type { + char *model; + char *content; + char *content_type; + char *type_id; + xbt_dict_t properties; + sg_storage_size_t size; + } s_storage_type_t, *storage_type_t; + + typedef struct s_mount { + void *storage; + char *name; + } s_mount_t, *mount_t; + + typedef struct surf_file { + char *name; + char *mount; + sg_storage_size_t size; + } s_surf_file_t; + + + #endif /* STORAGE_HPP_ */ diff --cc src/surf/surf_interface.cpp index 0000000000,3085b04dbd..b23ea89db2 mode 000000,100644..100644 --- a/src/surf/surf_interface.cpp +++ b/src/surf/surf_interface.cpp @@@ -1,0 -1,516 +1,520 @@@ + #include "surf.hpp" + #include "workstation.hpp" + #include "vm_workstation.hpp" + #include "network.hpp" + #include "surf_routing_cluster.hpp" + #include "instr/instr_private.h" + + XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_kernel); + + /********* + * TOOLS * + *********/ + extern double NOW; + + static CpuPtr get_casted_cpu(surf_resource_t resource){ + return dynamic_cast(static_cast(surf_cpu_resource_priv(resource))); + } + + static WorkstationCLM03Ptr get_casted_workstation(surf_resource_t resource){ + return dynamic_cast(static_cast(surf_workstation_resource_priv(resource))); + } + + static WorkstationVM2013Ptr get_casted_vm_workstation(surf_resource_t resource){ + return dynamic_cast(static_cast(surf_workstation_resource_priv(resource))); + } + + char *surf_routing_edge_name(sg_routing_edge_t edge){ + return edge->p_name; + } + + #ifdef CONTEXT_THREADS + static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */ + #endif + + static double *surf_mins = NULL; /* return value of share_resources for each model */ + static int surf_min_index; /* current index in surf_mins */ + static double surf_min; /* duration determined by surf_solve */ + + void surf_presolve(void) + { + double next_event_date = -1.0; + tmgr_trace_event_t event = NULL; + double value = -1.0; + ResourcePtr resource = NULL; + ModelPtr model = NULL; + unsigned int iter; + + XBT_DEBUG + ("First Run! Let's \"purge\" events and put models in the right state"); + while ((next_event_date = tmgr_history_next_date(history)) != -1.0) { + if (next_event_date > NOW) + break; + while ((event = + tmgr_history_get_next_event_leq(history, next_event_date, + &value, + (void **) &resource))) { + if (value >= 0){ + resource->updateState(event, value, NOW); + } + } + } + xbt_dynar_foreach(model_list, iter, model) + model->updateActionsState(NOW, 0.0); + } + + static void surf_share_resources(surf_model_t model) + { + double next_action_end = -1.0; + int i = __sync_fetch_and_add(&surf_min_index, 1); + if (strcmp(model->m_name.c_str(), "network NS3")) { + XBT_DEBUG("Running for Resource [%s]", model->m_name.c_str()); + next_action_end = model->shareResources(NOW); + XBT_DEBUG("Resource [%s] : next action end = %f", + model->m_name.c_str(), next_action_end); + } + surf_mins[i] = next_action_end; + } + + static void surf_update_actions_state(surf_model_t model) + { + model->updateActionsState(NOW, surf_min); + } + + double surf_solve(double max_date) + { + surf_min = -1.0; /* duration */ + double next_event_date = -1.0; + double model_next_action_end = -1.0; + double value = -1.0; + ResourcePtr resource = NULL; + ModelPtr model = NULL; + tmgr_trace_event_t event = NULL; + unsigned int iter; + + if(!host_that_restart) + host_that_restart = xbt_dynar_new(sizeof(char*), NULL); + + if (max_date != -1.0 && max_date != NOW) { + surf_min = max_date - NOW; + } + + XBT_DEBUG("Looking for next action end for all models except NS3"); + + if (surf_mins == NULL) { + surf_mins = xbt_new(double, xbt_dynar_length(model_list_invoke)); + } + surf_min_index = 0; + + /* sequential version */ + xbt_dynar_foreach(model_list_invoke, iter, model) { + surf_share_resources(static_cast(model)); + } + + unsigned i; + for (i = 0; i < xbt_dynar_length(model_list_invoke); i++) { + if ((surf_min < 0.0 || surf_mins[i] < surf_min) + && surf_mins[i] >= 0.0) { + surf_min = surf_mins[i]; + } + } + + XBT_DEBUG("Min for resources (remember that NS3 don't update that value) : %f", surf_min); + + XBT_DEBUG("Looking for next trace event"); + + do { + XBT_DEBUG("Next TRACE event : %f", next_event_date); + + next_event_date = tmgr_history_next_date(history); + + if(!strcmp(surf_network_model->m_name.c_str(), "network NS3")){//FIXME: add surf_network_model->m_name && + if(next_event_date!=-1.0 && surf_min!=-1.0) { + surf_min = MIN(next_event_date - NOW, surf_min); + } else{ + surf_min = MAX(next_event_date - NOW, surf_min); + } + + XBT_DEBUG("Run for network at most %f", surf_min); + // run until min or next flow + model_next_action_end = surf_network_model->shareResources(surf_min); + + XBT_DEBUG("Min for network : %f", model_next_action_end); + if(model_next_action_end>=0.0) + surf_min = model_next_action_end; + } + + if (next_event_date < 0.0) { + XBT_DEBUG("no next TRACE event. Stop searching for it"); + break; + } + + if ((surf_min == -1.0) || (next_event_date > NOW + surf_min)) break; + + XBT_DEBUG("Updating models (min = %g, NOW = %g, next_event_date = %g)", surf_min, NOW, next_event_date); + while ((event = + tmgr_history_get_next_event_leq(history, next_event_date, + &value, + (void **) &resource))) { + if (resource->isUsed() || xbt_dict_get_or_null(watched_hosts_lib, resource->m_name)) { + surf_min = next_event_date - NOW; + XBT_DEBUG + ("This event will modify model state. Next event set to %f", + surf_min); + } + /* update state of model_obj according to new value. Does not touch lmm. + It will be modified if needed when updating actions */ + XBT_DEBUG("Calling update_resource_state for resource %s with min %lf", + resource->m_name, surf_min); + resource->updateState(event, value, next_event_date); + } + } while (1); + + /* FIXME: Moved this test to here to avoid stopping simulation if there are actions running on cpus and all cpus are with availability = 0. + * This may cause an infinite loop if one cpu has a trace with periodicity = 0 and the other a trace with periodicity > 0. + * The options are: all traces with same periodicity(0 or >0) or we need to change the way how the events are managed */ + if (surf_min == -1.0) { + XBT_DEBUG("No next event at all. Bail out now."); + return -1.0; + } + + XBT_DEBUG("Duration set to %f", surf_min); + + NOW = NOW + surf_min; + /* FIXME: model_list or model_list_invoke? revisit here later */ + /* sequential version */ + xbt_dynar_foreach(model_list, iter, model) { + surf_update_actions_state(model); + } + + #ifdef HAVE_TRACING + TRACE_paje_dump_buffer (0); + #endif + + return surf_min; + } + + XBT_INLINE double surf_get_clock(void) + { + return NOW; + } + + void routing_get_route_and_latency(sg_routing_edge_t src, sg_routing_edge_t dst, + xbt_dynar_t * route, double *latency){ + routing_platf->getRouteAndLatency(src, dst, route, latency); + } + + /********* + * MODEL * + *********/ + + surf_model_t surf_resource_model(const void *host, int level) { + /* If level is SURF_WKS_LEVEL, ws is a workstation_CLM03 object. It has + * surf_resource at the generic_resource field. */ + ResourcePtr ws = static_cast(xbt_lib_get_level((xbt_dictelm_t) host, level)); + return ws->p_model; + } + + void *surf_as_cluster_get_backbone(AS_t as){ + return static_cast(as)->p_backbone; + } + + void surf_as_cluster_set_backbone(AS_t as, void* backbone){ + static_cast(as)->p_backbone = dynamic_cast(static_cast(backbone)); + } + + const char *surf_model_name(surf_model_t model){ + return model->m_name.c_str(); + } + + xbt_swag_t surf_model_done_action_set(surf_model_t model){ + return model->p_doneActionSet; + } + + xbt_swag_t surf_model_failed_action_set(surf_model_t model){ + return model->p_failedActionSet; + } + + xbt_swag_t surf_model_ready_action_set(surf_model_t model){ + return model->p_readyActionSet; + } + + xbt_swag_t surf_model_running_action_set(surf_model_t model){ + return model->p_runningActionSet; + } + + surf_action_t surf_workstation_model_execute_parallel_task(surf_workstation_model_t model, + int workstation_nb, + void **workstation_list, + double *computation_amount, + double *communication_amount, + double rate){ + return static_cast(model->executeParallelTask(workstation_nb, workstation_list, computation_amount, communication_amount, rate)); + } + + surf_action_t surf_workstation_model_communicate(surf_workstation_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate){ + return model->communicate(get_casted_workstation(src), get_casted_workstation(dst), size, rate); + } + + xbt_dynar_t surf_workstation_model_get_route(surf_workstation_model_t model, + surf_resource_t src, surf_resource_t dst){ + return model->getRoute(get_casted_workstation(src), get_casted_workstation(dst)); + } + + void surf_vm_workstation_model_create(const char *name, surf_resource_t ind_phys_host){ + surf_vm_workstation_model->createResource(name, ind_phys_host); + } + + surf_action_t surf_network_model_communicate(surf_network_model_t model, sg_routing_edge_t src, sg_routing_edge_t dst, double size, double rate){ + return model->communicate(src, dst, size, rate); + } + + const char *surf_resource_name(surf_cpp_resource_t resource){ + return resource->m_name; + } + + xbt_dict_t surf_resource_get_properties(surf_cpp_resource_t resource){ + return resource->getProperties(); + } + + e_surf_resource_state_t surf_resource_get_state(surf_cpp_resource_t resource){ + return resource->getState(); + } + + void surf_resource_set_state(surf_cpp_resource_t resource, e_surf_resource_state_t state){ + resource->setState(state); + } + + surf_action_t surf_workstation_sleep(surf_resource_t resource, double duration){ + return get_casted_workstation(resource)->sleep(duration); + } + + double surf_workstation_get_speed(surf_resource_t resource, double load){ + return get_casted_workstation(resource)->getSpeed(load); + } + + double surf_workstation_get_available_speed(surf_resource_t resource){ + return get_casted_workstation(resource)->getAvailableSpeed(); + } + + int surf_workstation_get_core(surf_resource_t resource){ + return get_casted_workstation(resource)->getCore(); + } + + surf_action_t surf_workstation_execute(surf_resource_t resource, double size){ + return get_casted_workstation(resource)->execute(size); + } + + double surf_workstation_get_current_power_peak(surf_resource_t resource){ + return get_casted_workstation(resource)->getCurrentPowerPeak(); + } + + double surf_workstation_get_power_peak_at(surf_resource_t resource, int pstate_index){ + return get_casted_workstation(resource)->getPowerPeakAt(pstate_index); + } + + int surf_workstation_get_nb_pstates(surf_resource_t resource){ + return get_casted_workstation(resource)->getNbPstates(); + } + + void surf_workstation_set_power_peak_at(surf_resource_t resource, int pstate_index){ + return get_casted_workstation(resource)->setPowerPeakAt(pstate_index); + } + + double surf_workstation_get_consumed_energy(surf_resource_t resource){ + return get_casted_workstation(resource)->getConsumedEnergy(); + } + + xbt_dict_t surf_workstation_get_storage_list(surf_resource_t workstation){ + return get_casted_workstation(workstation)->getStorageList(); + } + + surf_action_t surf_workstation_open(surf_resource_t workstation, const char* mount, const char* path){ + return get_casted_workstation(workstation)->open(mount, path); + } + + surf_action_t surf_workstation_close(surf_resource_t workstation, surf_file_t fd){ + return get_casted_workstation(workstation)->close(fd); + } + + int surf_workstation_unlink(surf_resource_t workstation, surf_file_t fd){ + return get_casted_workstation(workstation)->unlink(fd); + } + + surf_action_t surf_workstation_ls(surf_resource_t workstation, const char* mount, const char *path){ + return get_casted_workstation(workstation)->ls(mount, path); + } + + size_t surf_workstation_get_size(surf_resource_t workstation, surf_file_t fd){ + return get_casted_workstation(workstation)->getSize(fd); + } + + surf_action_t surf_workstation_read(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){ + return get_casted_workstation(resource)->read(fd, size); + } + + surf_action_t surf_workstation_write(surf_resource_t resource, surf_file_t fd, sg_storage_size_t size){ + return get_casted_workstation(resource)->write(fd, size); + } + + xbt_dynar_t surf_workstation_get_info(surf_resource_t resource, surf_file_t fd){ + return get_casted_workstation(resource)->getInfo(fd); + } + + sg_storage_size_t surf_workstation_get_free_size(surf_resource_t resource, const char* name){ + return get_casted_workstation(resource)->getFreeSize(name); + } + + sg_storage_size_t surf_workstation_get_used_size(surf_resource_t resource, const char* name){ + return get_casted_workstation(resource)->getUsedSize(name); + } + + xbt_dynar_t surf_workstation_get_vms(surf_resource_t resource){ + return get_casted_workstation(resource)->getVms(); + } + + void surf_workstation_get_params(surf_resource_t resource, ws_params_t params){ + get_casted_workstation(resource)->getParams(params); + } + + void surf_workstation_set_params(surf_resource_t resource, ws_params_t params){ + get_casted_workstation(resource)->setParams(params); + } + + void surf_vm_workstation_destroy(surf_resource_t resource){ + delete get_casted_vm_workstation(resource); + } + + void surf_vm_workstation_suspend(surf_resource_t resource){ + get_casted_vm_workstation(resource)->suspend(); + } + + void surf_vm_workstation_resume(surf_resource_t resource){ + get_casted_vm_workstation(resource)->resume(); + } + + void surf_vm_workstation_save(surf_resource_t resource){ + get_casted_vm_workstation(resource)->save(); + } + + void surf_vm_workstation_restore(surf_resource_t resource){ + get_casted_vm_workstation(resource)->restore(); + } + + void surf_vm_workstation_migrate(surf_resource_t resource, surf_resource_t ind_vm_ws_dest){ + get_casted_vm_workstation(resource)->migrate(ind_vm_ws_dest); + } + + surf_resource_t surf_vm_workstation_get_pm(surf_resource_t resource){ + return get_casted_vm_workstation(resource)->getPm(); + } + + void surf_vm_workstation_set_bound(surf_resource_t resource, double bound){ + return get_casted_vm_workstation(resource)->setBound(bound); + } + + void surf_vm_workstation_set_affinity(surf_resource_t resource, surf_resource_t cpu, unsigned long mask){ + return get_casted_vm_workstation(resource)->setAffinity(dynamic_cast(get_casted_cpu(cpu)), mask); + } + + int surf_network_link_is_shared(surf_cpp_resource_t link){ + return dynamic_cast(link)->isShared(); + } + + double surf_network_link_get_bandwidth(surf_cpp_resource_t link){ + return dynamic_cast(link)->getBandwidth(); + } + + double surf_network_link_get_latency(surf_cpp_resource_t link){ + return dynamic_cast(link)->getLatency(); + } + + xbt_dict_t surf_storage_get_content(surf_resource_t resource){ + return dynamic_cast(static_cast(surf_storage_resource_priv(resource)))->getContent(); + } + + sg_storage_size_t surf_storage_get_size(surf_resource_t resource){ + return dynamic_cast(static_cast(surf_storage_resource_priv(resource)))->getSize(); + } + ++void surf_storage_rename(surf_resource_t resource, const char* src, const char* dest){ ++ dynamic_cast(static_cast(surf_storage_resource_priv(resource)))->rename(src, dest); ++} ++ + surf_action_t surf_cpu_execute(surf_resource_t cpu, double size){ + return get_casted_cpu(cpu)->execute(size); + } + + surf_action_t surf_cpu_sleep(surf_resource_t cpu, double duration){ + return get_casted_cpu(cpu)->sleep(duration); + } + + double surf_action_get_start_time(surf_action_t action){ + return action->m_start; + } + + double surf_action_get_finish_time(surf_action_t action){ + return action->m_finish; + } + + double surf_action_get_remains(surf_action_t action){ + return action->getRemains(); + } + + void surf_action_unref(surf_action_t action){ + action->unref(); + } + + void surf_action_suspend(surf_action_t action){ + action->suspend(); + } + + void surf_action_resume(surf_action_t action){ + action->resume(); + } + + void surf_action_cancel(surf_action_t action){ + action->cancel(); + } + + void surf_action_set_priority(surf_action_t action, double priority){ + action->setPriority(priority); + } + + void surf_action_set_category(surf_action_t action, const char *category){ + action->setCategory(category); + } + + void *surf_action_get_data(surf_action_t action){ + return action->p_data; + } + + void surf_action_set_data(surf_action_t action, void *data){ + action->p_data = data; + } + + e_surf_action_state_t surf_action_get_state(surf_action_t action){ + return action->getState(); + } + + int surf_action_get_cost(surf_action_t action){ + return action->m_cost; + } + + void surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask) { + dynamic_cast(action)->setAffinity( dynamic_cast(get_casted_cpu(cpu)), mask); + } + + void surf_cpu_action_set_bound(surf_action_t action, double bound) { + dynamic_cast(action)->setBound(bound); + } + + surf_file_t surf_storage_action_get_file(surf_action_t action){ + return dynamic_cast(action)->p_file; + } + + xbt_dict_t surf_storage_action_get_ls_dict(surf_action_t action){ + return dynamic_cast(action)->p_lsDict; + } + + diff --cc src/surf/workstation.c index 69255a4ec7,452e269c5d..873cae59db --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@@ -11,13 -11,10 +11,27 @@@ #include "storage_private.h" #include "surf/surf_resource.h" #include "simgrid/sg_config.h" ++<<<<<<< HEAD +#include + +typedef struct workstation_CLM03 { + s_surf_resource_t generic_resource; /* Must remain first to add this to a trace */ + void *net_elm; + xbt_dynar_t storage; +} s_workstation_CLM03_t, *workstation_CLM03_t; ++||||||| merged common ancestors ++ ++typedef struct workstation_CLM03 { ++ s_surf_resource_t generic_resource; /* Must remain first to add this to a trace */ ++ void *net_elm; ++ xbt_dynar_t storage; ++} s_workstation_CLM03_t, *workstation_CLM03_t; ++======= + #include "workstation_private.h" + #include "vm_workstation_private.h" + #include "cpu_cas01_private.h" + #include "maxmin_private.h" ++>>>>>>> surf++ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf, "Logging specific to the SURF workstation module");