X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/51f8d73fe7373b7b04bc2727ff9ef61272dce9a9..de74e33ac31948d22f805fed0807be831cb8fdbd:/src/surf/surf.hpp diff --git a/src/surf/surf.hpp b/src/surf/surf.hpp index d6c462e5f7..636d6a4327 100644 --- a/src/surf/surf.hpp +++ b/src/surf/surf.hpp @@ -12,11 +12,39 @@ #include #include #include "surf/trace_mgr.h" +#include "xbt/lib.h" +#include "surf/surf_routing.h" +#include "simgrid/platf_interface.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 + * + * Return the current time in millisecond. + */ + +/********* + * Utils * + *********/ + +#ifdef __cplusplus +extern "C" { +#endif +XBT_PUBLIC(double) surf_get_clock(void); +XBT_PUBLIC(void) surf_watched_hosts(void); +#ifdef __cplusplus +} +#endif + +XBT_PUBLIC(int) SURF_CPU_LEVEL; //Surf cpu level + /*********** * Classes * ***********/ @@ -31,9 +59,23 @@ class Action; typedef Action* ActionPtr; typedef boost::function ActionCallback; +/********* + * Trace * + *********/ +/* For the trace and trace:connect tag (store their content till the end of the parsing) */ +XBT_PUBLIC_DATA(xbt_dict_t) traces_set_list; +XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_host_avail; +XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_power; +XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_link_avail; +XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_bandwidth; +XBT_PUBLIC_DATA(xbt_dict_t) trace_connect_list_latency; + + /********* * Model * *********/ +XBT_PUBLIC_DATA(xbt_dynar_t) model_list; + class Model { public: Model(string name) { @@ -41,9 +83,16 @@ public: m_resOnCB = m_resOffCB= 0; m_actSuspendCB = m_actCancelCB = m_actResumeCB = 0; } - virtual ~Model() {} + virtual ~Model() { + xbt_swag_free(p_readyActionSet); + xbt_swag_free(p_runningActionSet); + xbt_swag_free(p_failedActionSet); + xbt_swag_free(p_doneActionSet); + } ResourcePtr createResource(string name); ActionPtr createAction(double _cost, bool _failed); + double shareResources(double now); + void updateActionsState(double now, double delta); string getName() {return m_name;}; @@ -61,9 +110,9 @@ public: void notifyActionSuspend(ActionPtr a); xbt_swag_t p_readyActionSet; /**< Actions in state SURF_ACTION_READY */ - xbt_swag_t runningActionSet; /**< Actions in state SURF_ACTION_RUNNING */ - xbt_swag_t failedActionSet; /**< Actions in state SURF_ACTION_FAILED */ - xbt_swag_t doneActionSet; /**< Actions in state SURF_ACTION_DONE */ + 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 */ protected: std::vector m_failedActions, m_runningActions; @@ -79,10 +128,18 @@ private: ************/ class Resource { public: - Resource(ModelPtr model, string name, xbt_dict_t properties): + Resource(ModelPtr model, const char *name, xbt_dict_t properties): m_name(name),m_running(true),p_model(model),m_properties(properties) {}; virtual ~Resource() {}; + void updateState(tmgr_trace_event_t event_type, double value, double date); + + //private + bool isUsed(); + //TODOupdateActionState(); + //TODOupdateResourceState(); + //TODOfinilize(); + bool isOn(); void turnOn(); void turnOff(); @@ -90,16 +147,37 @@ public: string getName(); ModelPtr getModel() {return p_model;}; void printModel() { std::cout << p_model->getName() << "<