4 XBT_LOG_NEW_DEFAULT_CATEGORY(storage,"Messages specific for this simulation");
6 void storage_info(msg_host_t host);
7 void display_storage_properties(msg_storage_t storage);
8 int client(int argc, char *argv[]);
9 int server(int argc, char *argv[]);
12 int client(int argc, char *argv[])
14 storage_info(MSG_host_self());
18 int server(int argc, char *argv[])
20 //display_storage_info();
24 void storage_info(msg_host_t host){
26 const char* host_name = MSG_host_get_name(host);
27 XBT_INFO("** Storage info on %s:", host_name);
29 xbt_dict_cursor_t cursor = NULL;
32 msg_storage_t storage;
34 xbt_dict_t storage_list = MSG_host_get_storage_list(MSG_host_self());
36 xbt_dict_foreach(storage_list,cursor,mount_name,storage_name)
38 XBT_INFO("\tStorage mount name: %s", mount_name);
40 sg_storage_size_t free_size = MSG_storage_get_free_size(mount_name);
41 sg_storage_size_t used_size = MSG_storage_get_used_size(mount_name);
43 XBT_INFO("\t\tFree size: %zu bytes", free_size);
44 XBT_INFO("\t\tUsed size: %zu bytes", used_size);
46 storage = MSG_storage_get_by_name(storage_name);
47 display_storage_properties(storage);
51 void display_storage_properties(msg_storage_t storage){
52 xbt_dict_cursor_t cursor = NULL;
54 xbt_dict_t props = MSG_storage_get_properties(storage);
56 XBT_INFO("\tProperties of mounted storage: %s", MSG_storage_get_name(storage));
57 xbt_dict_foreach(props, cursor, key, data)
58 XBT_INFO("\t\t'%s' -> '%s'", key, data);
60 XBT_INFO("\t\tNo property attached.");
64 int main(int argc, char *argv[])
66 MSG_init(&argc, argv);
68 /* Check the arguments */
70 printf("Usage: %s platform_file deployment_file \n", argv[0]);
74 const char *platform_file = argv[1];
75 const char *deployment_file = argv[2];
77 MSG_create_environment(platform_file);
79 MSG_function_register("client", client);
80 MSG_function_register("server", server);
81 MSG_launch_application(deployment_file);
83 msg_error_t res = MSG_main();