X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/09a63025cb84856ac04d8452e30634759a05f4d9..54d19a62bc6f609898dd623e8857cd1c6474e24f:/src/surf/surf_interface.hpp diff --git a/src/surf/surf_interface.hpp b/src/surf/surf_interface.hpp index 4381fa70d3..e5e44a6877 100644 --- a/src/surf/surf_interface.hpp +++ b/src/surf/surf_interface.hpp @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -63,6 +62,8 @@ XBT_PUBLIC(double) surf_get_clock(void); extern double sg_sender_gap; XBT_PUBLIC(int) SURF_CPU_LEVEL; //Surf cpu level +extern surf_callback(void, void) surfExitCallbacks; + int __surf_is_absolute_file_path(const char *file_path); /*********** @@ -114,7 +115,7 @@ XBT_PUBLIC_DATA(xbt_dynar_t) model_list; * @brief SURF model interface class * @details A model is an object which handle the interactions between its Resources and its Actions */ -class Model { +XBT_PUBLIC_CLASS Model { public: /** * @brief Model constructor @@ -251,7 +252,7 @@ typedef struct { * @brief SURF resource interface class * @details A resource represent an element of a component (e.g.: a link for the network) */ -class Resource { +XBT_PUBLIC_CLASS Resource { public: /** * @brief Resource constructor @@ -364,7 +365,6 @@ private: const char *p_name; xbt_dict_t p_properties; ModelPtr p_model; - void *p_resource; bool m_running; e_surf_resource_state_t m_stateCurrent; @@ -389,13 +389,15 @@ void surf_action_lmm_update_index_heap(void *action, int i); * @brief SURF action interface class * @details An action is an event generated by a resource (e.g.: a communication for the network) */ -class Action : public actionHook, public actionLmmHook { -public: +XBT_PUBLIC_CLASS Action : public actionHook, public actionLmmHook { +private: /** - * @brief Action constructor + * @brief Common initializations for the constructors */ - Action(); + void initialize(ModelPtr model, double cost, bool failed, + lmm_variable_t var = NULL); +public: /** * @brief Action constructor * @@ -439,6 +441,20 @@ public: */ virtual void setState(e_surf_action_state_t state); + /** + * @brief Get the bound of the current Action + * + * @return The bound of the current Action + */ + double getBound(); + + /** + * @brief Set the bound of the current Action + * + * @param bound The new bound of the current Action + */ + void setBound(double bound); + /** * @brief Get the start time of the current action * @@ -500,14 +516,14 @@ public: * * @param delta [TODO] */ - void updateMaxDuration(double delta) {double_update(&m_maxDuration, delta);} + void updateMaxDuration(double delta) {double_update(&m_maxDuration, delta,sg_surf_precision);} /** * @brief Update the remaining time of the current action * * @param delta [TODO] */ - void updateRemains(double delta) {double_update(&m_remains, delta);} + void updateRemains(double delta) {double_update(&m_remains, delta, sg_maxmin_precision*sg_surf_precision);} /** * @brief Set the remaining time of the current action @@ -600,15 +616,6 @@ public: */ double getRemainsNoUpdate(); -#ifdef HAVE_LATENCY_BOUND_TRACKING - /** - * @brief Check if the action is limited by latency. - * - * @return 1 if action is limited by latency, 0 otherwise - */ - int getLatencyLimited(); -#endif - /** * @brief Get the priority of the current Action * @@ -626,6 +633,8 @@ public: s_xbt_swag_hookup_t p_stateHookup; + ModelPtr getModel() {return p_model;} + protected: ActionListPtr p_stateSet; double m_priority; /**< priority (1.0 by default) */ @@ -634,8 +643,6 @@ protected: double m_maxDuration; /*< max_duration (may fluctuate until the task is completed) */ double m_finish; /**< finish time : this is modified during the run and fluctuates until the task is completed */ - ModelPtr getModel() {return p_model;} - private: int resourceUsed(void *resource_id); @@ -679,7 +686,7 @@ private: #ifdef HAVE_LATENCY_BOUND_TRACKING int m_latencyLimited; /**< Set to 1 if is limited by latency, 0 otherwise */ #endif - int m_cost; + double m_cost; ModelPtr p_model; void *p_data; /**< for your convenience */