X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/6de03ecc4e630732984a0673512a5d15fd75e270..2c69087d11c54eee924f6870373883d6aa9ff228:/src/surf/workstation_interface.hpp diff --git a/src/surf/workstation_interface.hpp b/src/surf/workstation_interface.hpp index d0546b5394..13ccd603ff 100644 --- a/src/surf/workstation_interface.hpp +++ b/src/surf/workstation_interface.hpp @@ -33,30 +33,32 @@ typedef WorkstationAction *WorkstationActionPtr; * @brief Callbacks handler which emit the callbacks after Workstation creation * * @details Callback functions have the following signature: `void(WorkstationPtr)` */ -extern surf_callback(void, WorkstationPtr) workstationCreatedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, WorkstationPtr)) workstationCreatedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emit the callbacks after Workstation destruction * * @details Callback functions have the following signature: `void(WorkstationPtr)` */ -extern surf_callback(void, WorkstationPtr) workstationDestructedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, WorkstationPtr)) workstationDestructedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emit the callbacks after Workstation State changed * - * @details Callback functions have the following signature: `void(WorkstationActionPtr)` + * @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)` */ -extern surf_callback(void, WorkstationPtr) workstationStateChangedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, WorkstationPtr, e_surf_resource_state_t, e_surf_resource_state_t)) workstationStateChangedCallbacks; /** @ingroup SURF_callbacks * @brief Callbacks handler which emit the callbacks after WorkstationAction State changed * - * @details Callback functions have the following signature: `void(WorkstationActionPtr)` + * @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)` */ -extern surf_callback(void, WorkstationActionPtr) workstationActionStateChangedCallbacks; +XBT_PUBLIC_DATA(surf_callback(void, WorkstationActionPtr, e_surf_action_state_t, e_surf_action_state_t)) workstationActionStateChangedCallbacks; /********* * Tools * *********/ -extern WorkstationModelPtr surf_workstation_model; +XBT_PUBLIC_DATA(WorkstationModelPtr) surf_workstation_model; +XBT_PUBLIC(void) workstation_parse_init(sg_platf_host_cbarg_t host); +XBT_PUBLIC(void) workstation_add_traces(); /********* * Model * @@ -67,9 +69,9 @@ extern WorkstationModelPtr surf_workstation_model; */ class WorkstationModel : public Model { public: - /** + /** * @brief WorkstationModel constructor - * + * * @param name the name of the model */ WorkstationModel(const char *name); @@ -84,44 +86,36 @@ public: */ ~WorkstationModel(); + virtual WorkstationPtr createWorkstation(const char *name)=0; + void addTraces(){DIE_IMPOSSIBLE;} + /** * @brief [brief description] * @details [long description] */ virtual void adjustWeightOfDummyCpuActions(); - + /** * @brief [brief description] * @details [long description] - * + * * @param workstation_nb [description] * @param workstation_list [description] - * @param computation_amount [description] - * @param communication_amount [description] + * @param flops_amount [description] + * @param bytes_amount [description] * @param rate [description] * @return [description] */ virtual ActionPtr executeParallelTask(int workstation_nb, void **workstation_list, - double *computation_amount, - double *communication_amount, + double *flops_amount, + double *bytes_amount, double rate)=0; /** * @brief [brief description] * @details [long description] - * - * @param src [description] - * @param dst [description] - * - * @return [description] - */ - virtual xbt_dynar_t getRoute(WorkstationPtr src, WorkstationPtr dst)=0; - - /** - * @brief [brief description] - * @details [long description] - * + * * @param src [description] * @param dst [description] * @param size [description] @@ -149,7 +143,7 @@ public: /** * @brief Workstation constructor - * + * * @param model WorkstationModel associated to this Workstation * @param name The name of the Workstation * @param props Dictionary of properties associated to this Workstation @@ -162,7 +156,7 @@ public: /** * @brief Workstation constructor - * + * * @param model WorkstationModel associated to this Workstation * @param name The name of the Workstation * @param props Dictionary of properties associated to this Workstation @@ -171,8 +165,9 @@ public: * @param netElm The RoutingEdge associated to this Workstation * @param cpu The Cpu associated to this Workstation */ - Workstation(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint, - xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu); + Workstation(ModelPtr model, const char *name, xbt_dict_t props, + lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdgePtr netElm, + CpuPtr cpu); /** * @brief Workstation destructor @@ -190,16 +185,16 @@ public: /** * @brief Execute some quantity of computation - * - * @param size The value of the processing amount (in flop) needed to process + * + * @param flops_amount The value of the processing amount (in flop) needed to process * @return The CpuAction corresponding to the processing * @see Cpu */ - virtual ActionPtr execute(double size)=0; + virtual ActionPtr execute(double flops_amount)=0; /** * @brief Make a process sleep for duration seconds - * + * * @param duration The number of seconds to sleep * @return The CpuAction corresponding to the sleeping * @see Cpu @@ -208,7 +203,7 @@ public: /** * @brief Get the number of cores of the associated Cpu - * + * * @return The number of cores of the associated Cpu * @see Cpu */ @@ -216,7 +211,7 @@ public: /** * @brief Get the speed of the associated Cpu - * + * * @param load [TODO] * @return The speed of the associated Cpu * @see Cpu @@ -226,7 +221,7 @@ public: /** * @brief Get the available speed of the associated Cpu * @details [TODO] - * + * * @return The available speed of the associated Cpu * @see Cpu */ @@ -234,7 +229,7 @@ public: /** * @brief Get the associated Cpu power peak - * + * * @return The associated Cpu power peak * @see Cpu */ @@ -246,7 +241,7 @@ public: /** * @brief Return the storage of corresponding mount point - * + * * @param storage The mount point * @return The corresponding Storage */ @@ -254,24 +249,30 @@ public: /** * @brief Get the xbt_dict_t of mount_point: Storage - * + * * @return The xbt_dict_t of mount_point: Storage */ - virtual xbt_dict_t getStorageList(); + virtual xbt_dict_t getMountedStorageList(); + + /** + * @brief Get the xbt_dynar_t of storages attached to the workstation + * + * @return The xbt_dynar_t of Storage names + */ + virtual xbt_dynar_t getAttachedStorageList(); /** * @brief Open a file - * - * @param mount The mount point - * @param path The path to the file - * + * + * @param fullpath The full path to the file + * * @return The StorageAction corresponding to the opening */ - virtual ActionPtr open(const char* mount, const char* path); + virtual ActionPtr open(const char* fullpath); /** * @brief Close a file - * + * * @param fd The file descriptor to close * @return The StorageAction corresponding to the closing */ @@ -280,25 +281,15 @@ public: /** * @brief Unlink a file * @details [long description] - * + * * @param fd [description] * @return [description] */ virtual int unlink(surf_file_t fd); - /** - * @brief List directory contents of a path - * @details [long description] - * - * @param mount [description] - * @param path The path to the directory - * @return The StorageAction corresponding to the ls action - */ - virtual ActionPtr ls(const char* mount, const char *path); - /** * @brief Get the size in bytes of the file - * + * * @param fd The file descriptor to read * @return The size in bytes of the file */ @@ -306,7 +297,7 @@ public: /** * @brief Read a file - * + * * @param fd The file descriptor to read * @param size The size in bytes to read * @return The StorageAction corresponding to the reading @@ -315,7 +306,7 @@ public: /** * @brief Write a file - * + * * @param fd The file descriptor to write * @param size The size in bytes to write * @return The StorageAction corresponding to the writing @@ -330,7 +321,7 @@ public: * - the storage name, * - the storage typeId, * - the storage content type - * + * * @param fd The file descriptor * @return An xbt_dynar_t with the file informations */ @@ -338,32 +329,16 @@ public: /** * @brief Get the current position of the file descriptor - * + * * @param fd The file descriptor * @return The current position of the file descriptor */ virtual sg_size_t fileTell(surf_file_t fd); /** - * @brief Get the available space of the storage at the mount point - * - * @param name The mount point - * @return The amount of availble space in bytes - */ - virtual sg_size_t getFreeSize(const char* name); - - /** - * @brief Get the used space of the storage at the mount point - * - * @param name The mount point - * @return The amount of used space in bytes - */ - virtual sg_size_t getUsedSize(const char* name); - - /** - * @brief Set the position indictator assiociated with the file descriptor to a new position + * @brief Set the position indicator associated with the file descriptor to a new position * @details [long description] - * + * * @param fd The file descriptor * @param offset The offset from the origin * @param origin Position used as a reference for the offset @@ -372,7 +347,18 @@ public: * - SEEK_END: end of the file * @return MSG_OK if successful, otherwise MSG_TASK_CANCELED */ - virtual int fileSeek(surf_file_t fd, sg_size_t offset, int origin); + virtual int fileSeek(surf_file_t fd, sg_offset_t offset, int origin); + + /** + * @brief Move a file to another location on the *same mount point*. + * @details [long description] + * + * @param fd The file descriptor + * @param fullpath The new full path + * @return MSG_OK if successful, MSG_TASK_CANCELED and a warning if the new + * full path is not on the same mount point + */ + virtual int fileMove(surf_file_t fd, const char* fullpath); xbt_dynar_t p_storage; RoutingEdgePtr p_netElm; @@ -381,7 +367,7 @@ public: /** * @brief Get the list of virtual machines on the current Workstation - * + * * @return The list of VMs */ xbt_dynar_t getVms(); @@ -390,7 +376,7 @@ public: /** * @brief [brief description] * @details [long description] - * + * * @param params [description] */ void getParams(ws_params_t params); @@ -398,7 +384,7 @@ public: /** * @brief [brief description] * @details [long description] - * + * * @param params [description] */ void setParams(ws_params_t params); @@ -408,6 +394,7 @@ public: /********** * Action * **********/ + /** @ingroup SURF_workstation_interface * @brief SURF workstation action interface class */ @@ -415,7 +402,7 @@ class WorkstationAction : public Action { public: /** * @brief WorkstationAction constructor - * + * * @param model The WorkstationModel associated to this WorkstationAction * @param cost The cost of this WorkstationAction in [TODO] * @param failed [description] @@ -425,7 +412,7 @@ public: /** * @brief WorkstationAction constructor - * + * * @param model The WorkstationModel associated to this WorkstationAction * @param cost The cost of this WorkstationAction in [TODO] * @param failed [description]