From: Frederic Suter Date: Tue, 20 Mar 2018 14:06:51 +0000 (+0100) Subject: add zone.h and storage.h X-Git-Tag: v3.19~9 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/363e09a2185870566b56bb1b5aeb65491135f554?ds=sidebyside add zone.h and storage.h --- diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 2cfefb73dd..8c160a57c3 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -10,7 +10,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -34,8 +36,15 @@ SG_BEGIN_DECL() #define msg_as_t msg_netzone_t /* portability macro */ typedef sg_netzone_t msg_netzone_t; -/* ******************************** Host ************************************ */ +#define MSG_zone_get_root() sg_zone_get_root() +#define MSG_zone_get_name(zone) sg_zone_get_name(zone) +#define MSG_zone_get_by_name(name) sg_zone_get_by_name(name) +#define MSG_zone_get_sons(zone, whereto) sg_zone_get_sons(zone, whereto) +#define MSG_zone_get_property_value(zone, name) sg_zone_get_property_value(zone, name) +#define MSG_zone_set_property_value(zone, name, value) sg_zone_set_property_value(zone, name, value) +#define MSG_zone_get_hosts(zone, whereto) sg_zone_get_hosts(zone, whereto) +/* ******************************** Hosts ************************************ */ typedef sg_host_t msg_host_t; #define MSG_get_host_number() sg_host_count() @@ -65,29 +74,13 @@ typedef sg_host_t msg_host_t; #define MSG_host_set_property_value(host, name, value) sg_host_set_property_value(host, name, value) #define MSG_host_get_process_list(host, whereto) sg_host_get_actor_list(host, whereto) -XBT_PUBLIC_DATA int sg_storage_max_file_descriptors; -/* ******************************** Task ************************************ */ - -typedef struct s_simdata_task_t* simdata_task_t; - -typedef struct msg_task { - char *name; /**< @brief task name if any */ - simdata_task_t simdata; /**< @brief simulator data */ - void *data; /**< @brief user data */ - long long int counter; /* task unique identifier for instrumentation */ - char *category; /* task category for instrumentation */ -} s_msg_task_t; - -/** @brief Task datatype. - @ingroup m_task_management - - A task may then be defined by a computing - amount, a message size and some private - data. - */ -typedef struct msg_task *msg_task_t; +XBT_ATTRIB_DEPRECATED_v320("Use MSG_host_get_speed(): v3.20 will drop MSG_host_get_current_power_peak() " + "completely.") static inline double MSG_host_get_current_power_peak(msg_host_t host) +{ + return sg_host_speed(host); +} -/* ******************************** VM ************************************* */ +/* ******************************** VMs ************************************* */ typedef sg_vm_t msg_vm_t; #define MSG_vm_create_core(vm, name) sg_vm_create_core(vm, name) @@ -112,18 +105,25 @@ XBT_ATTRIB_DEPRECATED_v322("Use sg_vm_create_migratable() from the live migratio #define MSG_vm_shutdown(vm) sg_vm_shutdown(vm) #define MSG_vm_destroy(vm) sg_vm_destroy(vm) -/* ******************************** File ************************************ */ -typedef sg_file_t msg_file_t; - /* ******************************** Storage ************************************ */ - -/** @brief Storage datatype. - * @ingroup msg_storage_management - * - * You should consider this as an opaque object. - */ typedef sg_storage_t msg_storage_t; +#define MSG_storage_get_name(storage) sg_storage_get_name(storage) +#define MSG_storage_get_by_name(name) sg_storage_get_by_name(name) +#define MSG_storage_get_properties(storage) sg_storage_get_properties(storage) +#define MSG_storage_set_property_value(storage, name, value) sg_storage_set_property_value(storage, name, value) +#define MSG_storage_get_property_value(storage, name) sg_storage_get_property_value(storage, name) +#define MSG_storages_as_dynar() sg_storages_as_dynar() +#define MSG_storage_set_data(storage, data) sg_storage_set_data(storage, data) +#define MSG_storage_get_data(storage) sg_storage_get_data(storage) +#define MSG_storage_get_host(storage) sg_storage_get_host(storage) +#define MSG_storage_read(storage, size) sg_storage_read(storage, size) +#define MSG_storage_write(storage, size) sg_storage_write(storage, size) + +/* ******************************** File ************************************ */ +typedef sg_file_t msg_file_t; +XBT_PUBLIC_DATA int sg_storage_max_file_descriptors; + /** * \brief @brief Communication action. * \ingroup msg_task_usage @@ -132,6 +132,28 @@ typedef sg_storage_t msg_storage_t; */ typedef sg_msg_Comm* msg_comm_t; +/* ******************************** Task ************************************ */ + +typedef struct s_simdata_task_t* simdata_task_t; + +typedef struct msg_task { + char* name; /**< @brief task name if any */ + simdata_task_t simdata; /**< @brief simulator data */ + void* data; /**< @brief user data */ + long long int counter; /* task unique identifier for instrumentation */ + char* category; /* task category for instrumentation */ +} s_msg_task_t; + +/** @brief Task datatype. + @ingroup m_task_management + + A task may then be defined by a computing + amount, a message size and some private + data. + */ + +typedef struct msg_task* msg_task_t; + /** \brief Default value for an uninitialized #msg_task_t. \ingroup m_task_management */ @@ -189,6 +211,7 @@ XBT_PUBLIC void MSG_init_nocheck(int* argc, char** argv); XBT_PUBLIC msg_error_t MSG_main(); XBT_PUBLIC void MSG_function_register(const char* name, xbt_main_func_t code); XBT_PUBLIC void MSG_function_register_default(xbt_main_func_t code); +XBT_PUBLIC void MSG_create_environment(const char* file); XBT_PUBLIC void MSG_launch_application(const char* file); /*Bypass the parser */ XBT_PUBLIC void MSG_set_function(const char* host_id, const char* function_name, xbt_dynar_t arguments); @@ -196,55 +219,6 @@ XBT_PUBLIC void MSG_set_function(const char* host_id, const char* function_name, XBT_PUBLIC double MSG_get_clock(); XBT_PUBLIC unsigned long int MSG_get_sent_msg(); -/************************** Net Zones ***********************************/ -XBT_PUBLIC sg_netzone_t sg_zone_get_root(); -#define MSG_zone_get_root() sg_zone_get_root() -XBT_PUBLIC const char* sg_zone_get_name(sg_netzone_t zone); -#define MSG_zone_get_name(zone) sg_zone_get_name(zone) -XBT_PUBLIC sg_netzone_t sg_zone_get_by_name(const char* name); -#define MSG_zone_get_by_name(name) sg_zone_get_by_name(name) -XBT_PUBLIC void sg_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto); -#define MSG_zone_get_sons(zone, whereto) sg_zone_get_sons(zone, whereto) -XBT_PUBLIC const char* sg_zone_get_property_value(sg_netzone_t as, const char* name); -#define MSG_zone_get_property_value(zone, name) sg_zone_get_property_value(zone, name) -XBT_PUBLIC void sg_zone_set_property_value(sg_netzone_t netzone, const char* name, char* value); -#define MSG_zone_set_property_value(zone, name, value) sg_zone_set_property_value(zone, name, value) -XBT_PUBLIC void sg_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto); -#define MSG_zone_get_hosts(zone, whereto) sg_zone_get_hosts(zone, whereto) - -/************************** Storage handling ***********************************/ -XBT_PUBLIC const char* sg_storage_get_name(sg_storage_t storage); -#define MSG_storage_get_name(storage) sg_storage_get_name(storage) -XBT_PUBLIC sg_storage_t sg_storage_get_by_name(const char* name); -#define MSG_storage_get_by_name(name) sg_storage_get_by_name(name) -XBT_PUBLIC xbt_dict_t sg_storage_get_properties(sg_storage_t storage); -#define MSG_storage_get_properties(storage) sg_storage_get_properties(storage) -XBT_PUBLIC void sg_storage_set_property_value(sg_storage_t storage, const char* name, char* value); -#define MSG_storage_set_property_value(storage, name, value) sg_storage_set_property_value(storage, name, value) -XBT_PUBLIC const char* sg_storage_get_property_value(sg_storage_t storage, const char* name); -#define MSG_storage_get_property_value(storage, name) sg_storage_get_property_value(storage, name) -XBT_PUBLIC xbt_dynar_t sg_storages_as_dynar(); -#define MSG_storages_as_dynar() sg_storages_as_dynar() -XBT_PUBLIC void sg_storage_set_data(sg_storage_t host, void* data); -#define MSG_storage_set_data(storage, data) sg_storage_set_data(storage, data) -XBT_PUBLIC void* sg_storage_get_data(sg_storage_t storage); -#define MSG_storage_get_data(storage) sg_storage_get_data(storage) -XBT_PUBLIC const char* sg_storage_get_host(sg_storage_t storage); -#define MSG_storage_get_host(storage) sg_storage_get_host(storage) -XBT_PUBLIC sg_size_t sg_storage_read(sg_storage_t storage, sg_size_t size); -#define MSG_storage_read(storage, size) sg_storage_read(storage, size) -XBT_PUBLIC sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size); -#define MSG_storage_write(storage, size) sg_storage_write(storage, size) - -/************************** Host handling ***********************************/ -XBT_ATTRIB_DEPRECATED_v320("Use MSG_host_get_speed(): v3.20 will drop MSG_host_get_current_power_peak() " - "completely.") static inline double MSG_host_get_current_power_peak(msg_host_t host) -{ - return MSG_host_get_speed(host); -} - -XBT_PUBLIC void MSG_create_environment(const char* file); - /************************** Process handling *********************************/ XBT_PUBLIC msg_process_t MSG_process_create(const char* name, xbt_main_func_t code, void* data, msg_host_t host); XBT_PUBLIC msg_process_t MSG_process_create_with_arguments(const char* name, xbt_main_func_t code, void* data, diff --git a/include/simgrid/storage.h b/include/simgrid/storage.h new file mode 100644 index 0000000000..83cfd57254 --- /dev/null +++ b/include/simgrid/storage.h @@ -0,0 +1,31 @@ +/* Public interface to the Link datatype */ + +/* Copyright (c) 2018. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef INCLUDE_SIMGRID_STORAGE_H_ +#define INCLUDE_SIMGRID_STORAGE_H_ + +#include +#include + +/* C interface */ +SG_BEGIN_DECL() + +XBT_PUBLIC const char* sg_storage_get_name(sg_storage_t storage); +XBT_PUBLIC sg_storage_t sg_storage_get_by_name(const char* name); +XBT_PUBLIC xbt_dict_t sg_storage_get_properties(sg_storage_t storage); +XBT_PUBLIC void sg_storage_set_property_value(sg_storage_t storage, const char* name, char* value); +XBT_PUBLIC const char* sg_storage_get_property_value(sg_storage_t storage, const char* name); +XBT_PUBLIC xbt_dynar_t sg_storages_as_dynar(); +XBT_PUBLIC void sg_storage_set_data(sg_storage_t host, void* data); +XBT_PUBLIC void* sg_storage_get_data(sg_storage_t storage); +XBT_PUBLIC const char* sg_storage_get_host(sg_storage_t storage); +XBT_PUBLIC sg_size_t sg_storage_read(sg_storage_t storage, sg_size_t size); +XBT_PUBLIC sg_size_t sg_storage_write(sg_storage_t storage, sg_size_t size); + +SG_END_DECL() + +#endif /* INCLUDE_SIMGRID_STORAGE_H_ */ diff --git a/include/simgrid/zone.h b/include/simgrid/zone.h new file mode 100644 index 0000000000..bd7bf722e9 --- /dev/null +++ b/include/simgrid/zone.h @@ -0,0 +1,27 @@ +/* Public interface to the Link datatype */ + +/* Copyright (c) 2018. The SimGrid Team. All rights reserved. */ + +/* This program is free software; you can redistribute it and/or modify it + * under the terms of the license (GNU LGPL) which comes with this package. */ + +#ifndef INCLUDE_SIMGRID_ZONE_H_ +#define INCLUDE_SIMGRID_ZONE_H_ + +#include +#include + +/* C interface */ +SG_BEGIN_DECL() + +XBT_PUBLIC sg_netzone_t sg_zone_get_root(); +XBT_PUBLIC const char* sg_zone_get_name(sg_netzone_t zone); +XBT_PUBLIC sg_netzone_t sg_zone_get_by_name(const char* name); +XBT_PUBLIC void sg_zone_get_sons(sg_netzone_t zone, xbt_dict_t whereto); +XBT_PUBLIC const char* sg_zone_get_property_value(sg_netzone_t as, const char* name); +XBT_PUBLIC void sg_zone_set_property_value(sg_netzone_t netzone, const char* name, char* value); +XBT_PUBLIC void sg_zone_get_hosts(sg_netzone_t zone, xbt_dynar_t whereto); + +SG_END_DECL() + +#endif /* INCLUDE_SIMGRID_ZONE_H_ */ diff --git a/tools/cmake/DefinePackages.cmake b/tools/cmake/DefinePackages.cmake index 6d81ef13e3..168cacd3d2 100644 --- a/tools/cmake/DefinePackages.cmake +++ b/tools/cmake/DefinePackages.cmake @@ -676,7 +676,9 @@ set(headers_to_install include/simgrid/kernel/future.hpp include/simgrid/host.h include/simgrid/link.h + include/simgrid/storage.h include/simgrid/vm.h + include/simgrid/zone.h include/simgrid/s4u/forward.hpp include/simgrid/s4u/Activity.hpp include/simgrid/s4u/Actor.hpp