X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/de74e33ac31948d22f805fed0807be831cb8fdbd..e049fe573b321fbf974191c9f084873dc306009c:/src/surf/surf.hpp?ds=sidebyside diff --git a/src/surf/surf.hpp b/src/surf/surf.hpp index 636d6a4327..862173d4cf 100644 --- a/src/surf/surf.hpp +++ b/src/surf/surf.hpp @@ -15,15 +15,14 @@ #include "xbt/lib.h" #include "surf/surf_routing.h" #include "simgrid/platf_interface.h" +#include "surf/surf.h" +#include "surf/surf_private.h" extern tmgr_history_t history; #define NO_MAX_DURATION -1.0 using namespace std; -// TODO: put in surf_private.hpp -extern xbt_dict_t watched_hosts_lib; - /** \ingroup SURF_simulation * \brief Return the current time * @@ -34,6 +33,19 @@ extern xbt_dict_t watched_hosts_lib; * Utils * *********/ +/* user-visible parameters */ +extern double sg_tcp_gamma; +extern double sg_sender_gap; +extern double sg_latency_factor; +extern double sg_bandwidth_factor; +extern double sg_weight_S_parameter; +extern int sg_network_crosstraffic; +#ifdef HAVE_GTNETS +extern double sg_gtnets_jitter; +extern int sg_gtnets_jitter_seed; +#endif +extern xbt_dynar_t surf_path; + #ifdef __cplusplus extern "C" { #endif @@ -43,22 +55,35 @@ XBT_PUBLIC(void) surf_watched_hosts(void); } #endif +extern double sg_sender_gap; XBT_PUBLIC(int) SURF_CPU_LEVEL; //Surf cpu level +int __surf_is_absolute_file_path(const char *file_path); + /*********** * Classes * ***********/ -class Model; +//class Model; typedef Model* ModelPtr; -class Resource; +//class Resource; typedef Resource* ResourcePtr; typedef boost::function ResourceCallback; -class Action; +//class Action; typedef Action* ActionPtr; typedef boost::function ActionCallback; +//class ActionLmm; +typedef ActionLmm* ActionLmmPtr; + +enum heap_action_type{ + LATENCY = 100, + MAX_DURATION, + NORMAL, + NOTSET +}; + /********* * Trace * *********/ @@ -78,21 +103,20 @@ XBT_PUBLIC_DATA(xbt_dynar_t) model_list; class Model { public: - Model(string name) { - m_name = name; - m_resOnCB = m_resOffCB= 0; - m_actSuspendCB = m_actCancelCB = m_actResumeCB = 0; - } - virtual ~Model() { - xbt_swag_free(p_readyActionSet); - xbt_swag_free(p_runningActionSet); - xbt_swag_free(p_failedActionSet); - xbt_swag_free(p_doneActionSet); - } + Model(string name); + virtual ~Model(); + ResourcePtr createResource(string name); ActionPtr createAction(double _cost, bool _failed); - double shareResources(double now); - void updateActionsState(double now, double delta); + virtual double shareResources(double now); + virtual double shareResourcesLazy(double now); + virtual double shareResourcesFull(double now); + double shareResourcesMaxMin(xbt_swag_t running_actions, + lmm_system_t sys, + void (*solve) (lmm_system_t)); + virtual void updateActionsState(double now, double delta); + virtual void updateActionsStateLazy(double now, double delta); + virtual void updateActionsStateFull(double now, double delta); string getName() {return m_name;}; @@ -109,16 +133,22 @@ public: void addActionSuspendCallback(ActionCallback ac); void notifyActionSuspend(ActionPtr a); + lmm_system_t p_maxminSystem; + e_UM_t p_updateMechanism; + xbt_swag_t p_modifiedSet; + xbt_heap_t p_actionHeap; + int m_selectiveUpdate; + xbt_swag_t p_readyActionSet; /**< Actions in state SURF_ACTION_READY */ xbt_swag_t p_runningActionSet; /**< Actions in state SURF_ACTION_RUNNING */ xbt_swag_t p_failedActionSet; /**< Actions in state SURF_ACTION_FAILED */ xbt_swag_t p_doneActionSet; /**< Actions in state SURF_ACTION_DONE */ + string m_name; protected: std::vector m_failedActions, m_runningActions; private: - string m_name; ResourceCallback m_resOnCB, m_resOffCB; ActionCallback m_actCancelCB, m_actSuspendCB, m_actResumeCB; }; @@ -126,127 +156,108 @@ private: /************ * Resource * ************/ + +/** + * 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; + class Resource { public: - Resource(ModelPtr model, const char *name, xbt_dict_t properties): - m_name(name),m_running(true),p_model(model),m_properties(properties) {}; + Resource(); + Resource(ModelPtr model, const char *name, xbt_dict_t properties); virtual ~Resource() {}; - void updateState(tmgr_trace_event_t event_type, double value, double date); + virtual void updateState(tmgr_trace_event_t event_type, double value, double date)=0; //private - bool isUsed(); - //TODOupdateActionState(); - //TODOupdateResourceState(); - //TODOfinilize(); + virtual bool isUsed()=0; + //FIXME:updateActionState(); + //FIXME:updateResourceState(); + //FIXME:finilize(); bool isOn(); void turnOn(); void turnOff(); void setName(string name); - string getName(); + const char *getName(); + virtual xbt_dict_t getProperties(); + ModelPtr getModel() {return p_model;}; + virtual e_surf_resource_state_t getState(); void printModel() { std::cout << p_model->getName() << "<