X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/83ff63f9a846dd01995a4bbb8979d2fa909ed34b..5faf49cdf3f8ad8751317b857a6d3134fe07eda3:/src/surf/surf.hpp diff --git a/src/surf/surf.hpp b/src/surf/surf.hpp index 6deea66080..996aa47825 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 @@ -46,21 +58,23 @@ XBT_PUBLIC(void) surf_watched_hosts(void); 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; +//class ActionLmm; typedef ActionLmm* ActionLmmPtr; enum heap_action_type{ @@ -70,12 +84,6 @@ enum heap_action_type{ NOTSET }; -typedef enum { - UM_FULL, - UM_LAZY, - UM_UNDEFINED -} e_UM_t; - /********* * Trace * *********/ @@ -95,31 +103,23 @@ 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 (Model::*shareResources)(double now); + virtual double shareResources(double now); double shareResourcesLazy(double now); - double shareResourcesFull(xbt_swag_t running_actions, + //double shareResourcesFull(double now); + double shareResourcesMaxMin(xbt_swag_t running_actions, size_t offset, lmm_system_t sys, void (*solve) (lmm_system_t)); - void (Model::*updateActionsState)(double now, double delta); + void updateActionsState(double now, double delta); void updateActionsStateLazy(double now, double delta); void updateActionsStateFull(double now, double delta); string getName() {return m_name;}; - void gapRemove(ActionLmmPtr action); void addTurnedOnCallback(ResourceCallback rc); void notifyResourceTurnedOn(ResourcePtr r); @@ -144,12 +144,12 @@ public: 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; }; @@ -169,15 +169,14 @@ typedef struct { class Resource { public: - Resource() {}; - 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(); + virtual bool isUsed()=0; //TODOupdateActionState(); //TODOupdateResourceState(); //TODOfinilize(); @@ -186,17 +185,19 @@ public: void turnOn(); void turnOff(); void setName(string name); - string getName(); + const char *getName(); + xbt_dict_t getProperties(); + ModelPtr getModel() {return p_model;}; e_surf_resource_state_t getState(); void printModel() { std::cout << p_model->getName() << "<