ADD_TEST(msg-energy-pstates ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e1/pstate.tesh)
ADD_TEST(msg-energy-consumption ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e2/energy_consumption.tesh)
ADD_TEST(msg-energy-concurrent-tasks ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:thread --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/energy/e3/concurrent_tasks.tesh)
-
-
+ ADD_TEST(msg-storage ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --setenv srcdir=${CMAKE_HOME_DIRECTORY}/teshsuite --cd ${CMAKE_BINARY_DIR}/teshsuite ${CMAKE_HOME_DIRECTORY}/teshsuite/msg/storage/storage.tesh)
+
if(CONTEXT_UCONTEXT)
ADD_TEST(msg-sendrecv-CLM03-ucontext ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_CLM03.tesh)
ADD_TEST(msg-sendrecv-Vegas-ucontext ${CMAKE_BINARY_DIR}/bin/tesh ${TESH_OPTION} --cfg contexts/factory:ucontext --setenv srcdir=${CMAKE_HOME_DIRECTORY}/examples/msg --cd ${CMAKE_BINARY_DIR}/examples/msg ${CMAKE_HOME_DIRECTORY}/examples/msg/sendrecv/sendrecv_Vegas.tesh)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/trace)
+add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/msg/storage)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/availability)
add_subdirectory(${CMAKE_HOME_DIRECTORY}/teshsuite/simdag/network)
XBT_PUBLIC(xbt_dynar_t) MSG_hosts_as_dynar(void);
XBT_PUBLIC(int) MSG_get_host_number(void);
XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_list(msg_host_t host);
-XBT_PUBLIC(xbt_dynar_t) MSG_host_get_storage_content(msg_host_t host);
+XBT_PUBLIC(xbt_dict_t) MSG_host_get_storage_content(msg_host_t host);
/************************** Process handling *********************************/
XBT_PUBLIC(msg_process_t) MSG_process_create(const char *name,
xbt_main_func_t code,
* \param host a host
* \return a dynar containing content (as a dict) of all storages mounted on the host
*/
-xbt_dynar_t MSG_host_get_storage_content(msg_host_t host)
+xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
{
xbt_assert((host != NULL), "Invalid parameters");
- xbt_dynar_t contents = xbt_dynar_new(sizeof(void *),NULL);
-// msg_storage_t storage;
-// char* storage_name;
-// unsigned int i;
-// xbt_dynar_t storage_list = simcall_host_get_storage_list(host);
-// xbt_dynar_foreach(storage_list, i, storage_name){
-// storage = xbt_lib_get_elm_or_null(storage_lib,storage_name);
-//
-// XBT_INFO("STORAGE NAME: %s", storage_name);
-// xbt_dict_t content = simcall_storage_get_content(storage);
-// xbt_dynar_push(contents, &content);
-// }
+ xbt_dict_t contents = xbt_dict_new();
+
+ msg_storage_t storage;
+ char* storage_name;
+ char* mount_name;
+ xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor2 = NULL;
+ char* file;
+ size_t size;
+
+ xbt_dict_t storage_list = simcall_host_get_storage_list(host);
+
+ xbt_dict_foreach(storage_list,cursor,mount_name,storage_name){
+ storage = (msg_storage_t)xbt_lib_get_elm_or_null(storage_lib,storage_name);
+
+ XBT_INFO("mount name => %s", mount_name);
+ xbt_dict_t content = simcall_storage_get_content(storage);
+ xbt_dict_foreach(content,cursor2,file,size){
+ XBT_INFO("\t\t%s size: %zu bytes", file, size);
+ }
+
+ xbt_dict_set(contents,mount_name,(void *)content,NULL);
+ }
return contents;
}
xbt_dict_t content_dict = xbt_dict_new();
xbt_dict_cursor_t cursor = NULL;
char *file;
- size_t size;
+ char *size;
xbt_dict_foreach(((storage_t)st)->content, cursor, file, size){
- xbt_dict_set(content_dict,file,&size,NULL);
+ xbt_dict_set(content_dict,file,(void*)size,NULL);
}
return content_dict;
}
--- /dev/null
+cmake_minimum_required(VERSION 2.6)
+
+set(EXECUTABLE_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}")
+
+add_executable(storage storage.c)
+
+### Add definitions for compile
+if(NOT WIN32)
+ target_link_libraries(storage simgrid m pthread )
+else()
+ target_link_libraries(storage simgrid)
+endif()
+
+set(tesh_files
+ ${tesh_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/storage.tesh
+ PARENT_SCOPE
+ )
+set(xml_files
+ ${xml_files}
+ ${CMAKE_CURRENT_SOURCE_DIR}/platform.xml
+ ${CMAKE_CURRENT_SOURCE_DIR}/deployment.xml
+ PARENT_SCOPE
+ )
+set(teshsuite_src
+ ${teshsuite_src}
+ ${CMAKE_CURRENT_SOURCE_DIR}/storage.c
+ PARENT_SCOPE
+ )
+set(bin_files
+ ${bin_files}
+ PARENT_SCOPE
+ )
+set(txt_files
+ ${txt_files}
+ PARENT_SCOPE
+ )
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+<platform version="3">
+ <process host="client" function="client"/>
+ <process host="server" function="server"/>
+</platform>
\ No newline at end of file
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
+
+<platform version="3">
+ <AS id="AS0" routing="Full">
+ <!-- STORAGE TYPES -->
+ <storage_type id="crucial" model="SSD" size="500">
+ <prop id="Bwrite" value="30000000" /> <!-- 30Mo/s -->
+ <prop id="Bread" value="100000000" /> <!-- 100Mo/s -->
+ <prop id="Bconnection" value="150000000" /> <!-- 150Mo/s -->
+ </storage_type>
+
+ <storage_type id="single_HDD" model="linear_no_lat" size="500GiB" content_type="txt_unix">
+ <prop id="Bwrite" value="30MBps" />
+ <prop id="Bread" value="100MBps" />
+ <prop id="Bconnection" value="150MBps" />
+ </storage_type>
+
+ <storage_type id="single_SSD" model="linear_no_lat" size="500GiB">
+ <prop id="Bwrite" value="30MBps" />
+ <prop id="Bread" value="100MBps" />
+ <prop id="Bconnection" value="150MBps" />
+ </storage_type>
+
+ <!-- DISKS -->
+ <storage id="cdisk" typeId="single_HDD" content="msg/storage/storage_content_c.txt">
+ <prop id="usage" value="scratch"/>
+ <prop id="date" value="31-08-13"/>
+ </storage>
+ <storage id="sdisk1" typeId="single_SSD" content="msg/storage/storage_content_s1.txt" />
+ <storage id="sdisk2" typeId="single_HDD" content="msg/storage/storage_content_s2.txt" />
+
+ <!-- HOSTS -->
+ <host id="client" power="1000000000">
+ <mount storageId="cdisk" name="/sd1" />
+ </host>
+
+ <host id="server" power="1000000000">
+ <mount storageId="sdisk1" name="/sd1" />
+ <mount storageId="sdisk2" name="/sd2" />
+ <prop id="ip adress" value="134.165.2.5"/>
+ </host>
+
+ <!-- LINKS & ROUTES -->
+ <link id="link" bandwidth="125MBps" latency="50us" />
+
+ <route src="client" dst="server" symmetrical="YES">
+ <link_ctn id="link" />
+ </route>
+ </AS>
+</platform>
--- /dev/null
+#include "msg/msg.h"
+#include "xbt/log.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation");
+
+void storage_info(msg_host_t host);
+void display_storage_properties(msg_storage_t storage);
+int client(int argc, char *argv[]);
+int server(int argc, char *argv[]);
+
+
+int client(int argc, char *argv[])
+{
+ storage_info(MSG_host_self());
+ return 1;
+}
+
+int server(int argc, char *argv[])
+{
+ //display_storage_info();
+ return 1;
+}
+
+void storage_info(msg_host_t host){
+
+ const char* host_name = MSG_host_get_name(host);
+ XBT_INFO("** Storage info on %s:", host_name);
+
+ xbt_dict_cursor_t cursor = NULL;
+ char* mount_name;
+ char* storage_name;
+ msg_storage_t storage;
+
+ xbt_dict_t storage_list = MSG_host_get_storage_list(MSG_host_self());
+
+ xbt_dict_foreach(storage_list,cursor,mount_name,storage_name)
+ {
+ XBT_INFO("\tStorage mount name: %s", mount_name);
+
+ size_t free_size = MSG_storage_get_free_size(mount_name);
+ size_t used_size = MSG_storage_get_used_size(mount_name);
+
+ XBT_INFO("\t\tFree size: %zu octets", free_size);
+ XBT_INFO("\t\tUsed size: %zu octets", used_size);
+
+ storage = MSG_storage_get_by_name(storage_name);
+ display_storage_properties(storage);
+ }
+}
+
+void display_storage_properties(msg_storage_t storage){
+ xbt_dict_cursor_t cursor = NULL;
+ char *key, *data;
+ xbt_dict_t props = MSG_storage_get_properties(storage);
+ if (props){
+ XBT_INFO("\tProperties of mounted storage: %s", MSG_storage_get_name(storage));
+ xbt_dict_foreach(props, cursor, key, data)
+ XBT_INFO("\t\t'%s' -> '%s'", key, data);
+ }else{
+ XBT_INFO("\t\tNo property attached.");
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ MSG_init(&argc, argv);
+
+ /* Check the arguments */
+ if (argc < 3) {
+ printf("Usage: %s platform_file deployment_file \n", argv[0]);
+ return -1;
+ }
+
+ const char *platform_file = argv[1];
+ const char *deployment_file = argv[2];
+
+ MSG_create_environment(platform_file);
+
+ MSG_function_register("client", client);
+ MSG_function_register("server", server);
+ MSG_launch_application(deployment_file);
+
+ msg_error_t res = MSG_main();
+
+ if (res == MSG_OK)
+ return 0;
+ else
+ return 1;
+}
--- /dev/null
+$ msg/storage/storage ${srcdir:=.}/msg/storage/plateform.xml ${srcdir:=.}/msg/storage/deployment.xml 0 "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
+> [ 0.000000] (1:client@client) ** Storage info on client:
+> [ 0.000000] (1:client@client) Storage mount name: /sd1
+> [ 0.000000] (1:client@client) Free size: 536774599000 octets
+> [ 0.000000] (1:client@client) Used size: 96313000 octets
+> [ 0.000000] (1:client@client) Properties of mounted storage: cdisk
+> [ 0.000000] (1:client@client) 'date' -> '31-08-13'
+> [ 0.000000] (1:client@client) 'usage' -> 'scratch'
\ No newline at end of file
--- /dev/null
+./doc/simgrid/examples/cxx/autoDestination/FinalizeTask.cxx 71000
+./doc/simgrid/examples/cxx/autoDestination/autoDestination_deployment.xml 1262000
+./doc/simgrid/examples/cxx/autoDestination/Main.cxx 1480000
+./doc/simgrid/examples/cxx/autoDestination/Slave.cxx 87000000
+./doc/simgrid/examples/cxx/autoDestination/BasicTask.cxx 6500000
--- /dev/null
+./doc/simgrid/examples/cxx/autoDestination/Master.cxx 18910000
+./doc/simgrid/examples/cxx/autoDestination/autoDestination_platform.xml 21339320000
+./doc/simgrid/examples/cxx/autoDestination/Forwarder.cxx 113700000
+./doc/simgrid/examples/cxx/basic/FinalizeTask.cxx 710000000
--- /dev/null
+./doc/simgrid/examples/cxx/basic/Main.cxx 14800000
+./doc/simgrid/examples/cxx/basic/Slave.cxx 69300000
\ No newline at end of file