-
-
-/** \brief Model datatype
- * \ingroup SURF_models
- *
- * Generic data structure for a model. The workstations,
- * the CPUs and the network links are examples of models.
- */
-typedef struct surf_model {
- const char *name; /**< Name of this model */
- s_surf_action_state_t states; /**< Any living action on this model */
-
- e_surf_action_state_t(*action_state_get) (surf_action_t action);
- /**< Return the state of an action */
- void (*action_state_set) (surf_action_t action,
- e_surf_action_state_t state);
- /**< Change an action state*/
-
- double (*action_get_start_time) (surf_action_t action); /**< Return the start time of an action */
- double (*action_get_finish_time) (surf_action_t action); /**< Return the finish time of an action */
- int (*action_unref) (surf_action_t action); /**< Specify that we don't use that action anymore */
- void (*action_cancel) (surf_action_t action); /**< Cancel a running action */
- void (*action_recycle) (surf_action_t action); /**< Recycle an action */
- void (*action_data_set) (surf_action_t action, void *data); /**< Set the user data of an action */
- void (*suspend) (surf_action_t action); /**< Suspend an action */
- void (*resume) (surf_action_t action); /**< Resume a suspended action */
- int (*is_suspended) (surf_action_t action); /**< Return whether an action is suspended */
- void (*set_max_duration) (surf_action_t action, double duration); /**< Set the max duration of an action*/
- void (*set_priority) (surf_action_t action, double priority); /**< Set the priority of an action */
- double (*get_remains) (surf_action_t action); /**< Get the remains of an action */
-#ifdef HAVE_LATENCY_BOUND_TRACKING
- int (*get_latency_limited) (surf_action_t action); /**< Return 1 if action is limited by latency, 0 otherwise */
+static inline void *surf_cpu_resource_priv(const void *host) {
+ return xbt_lib_get_level((xbt_dictelm_t)host, SURF_CPU_LEVEL);
+}
+static inline void *surf_workstation_resource_priv(const void *host){
+ return (void*)xbt_lib_get_level((xbt_dictelm_t)host, SURF_WKS_LEVEL);
+}
+static inline void *surf_storage_resource_priv(const void *host){
+ return (void*)xbt_lib_get_level((xbt_dictelm_t)host, SURF_STORAGE_LEVEL);
+}
+
+static inline void *surf_cpu_resource_by_name(const char *name) {
+ return xbt_lib_get_elm_or_null(host_lib, name);
+}
+static inline void *surf_workstation_resource_by_name(const char *name){
+ return xbt_lib_get_elm_or_null(host_lib, name);
+}
+static inline void *surf_storage_resource_by_name(const char *name){
+ return xbt_lib_get_elm_or_null(storage_lib, name);
+}
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+char *surf_routing_edge_name(sg_routing_edge_t edge);
+
+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_workstation_t src, surf_workstation_t dst, double size, double rate);
+xbt_dynar_t surf_workstation_model_get_route(surf_workstation_model_t model, surf_workstation_t src, surf_workstation_t dst);
+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_resource_t resource);
+xbt_dict_t surf_resource_get_properties(surf_resource_t resource);
+e_surf_resource_state_t surf_resource_get_state(surf_resource_t resource);
+double surf_workstation_get_speed(surf_workstation_t resource, double load);
+double surf_workstation_get_available_speed(surf_workstation_t resource);
+int surf_workstation_get_core(surf_workstation_t resource);
+surf_action_t surf_workstation_execute(surf_workstation_t resource, double size);
+surf_action_t surf_workstation_sleep(surf_workstation_t resource, double duration);
+surf_action_t surf_workstation_open(surf_workstation_t workstation, const char* mount, const char* path);
+surf_action_t surf_workstation_close(surf_workstation_t workstation, surf_file_t fd);
+const char *surf_cpu_name(surf_cpu_t resource);
+surf_action_t surf_cpu_execute(surf_cpu_t cpu, double size);
+surf_action_t surf_cpu_sleep(surf_cpu_t cpu, double duration);
+int surf_workstation_unlink(surf_workstation_t workstation, surf_file_t fd);
+surf_action_t surf_workstation_ls(surf_workstation_t workstation, const char* mount, const char *path);
+size_t surf_workstation_get_size(surf_workstation_t workstation, surf_file_t fd);
+surf_action_t surf_workstation_read(surf_workstation_t resource, void *ptr, size_t size, surf_file_t fd);
+surf_action_t surf_workstation_write(surf_workstation_t resource, const void *ptr, size_t size, surf_file_t fd);
+int surf_network_link_is_shared(surf_network_link_t link);
+double surf_network_link_get_bandwidth(surf_network_link_t link);
+double surf_network_link_get_latency(surf_network_link_t link);
+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);
+surf_file_t surf_storage_action_get_file(surf_storage_action_lmm_t action);
+xbt_dict_t surf_storage_action_get_ls_dict(surf_storage_action_lmm_t action);
+
+#ifdef __cplusplus
+}