Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use homogeneous dicts which are more efficient.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 1 Oct 2013 21:25:07 +0000 (23:25 +0200)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 1 Oct 2013 21:28:36 +0000 (23:28 +0200)
src/msg/msg_host.c
src/smpi/smpi_bench.c
src/surf/network.c
src/surf/storage.c
src/surf/surf.c
src/surf/workstation.c

index 1903036..4dbe948 100644 (file)
@@ -357,7 +357,7 @@ xbt_dict_t MSG_host_get_storage_list(msg_host_t host)
 xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters");
 xbt_dict_t MSG_host_get_storage_content(msg_host_t host)
 {
   xbt_assert((host != NULL), "Invalid parameters");
-  xbt_dict_t contents = xbt_dict_new();
+  xbt_dict_t contents = xbt_dict_new_homogeneous(NULL);
   msg_storage_t storage;
   char* storage_name;
   char* mount_name;
   msg_storage_t storage;
   char* storage_name;
   char* mount_name;
index e5aa423..ccbf9b3 100644 (file)
@@ -102,13 +102,13 @@ static void* shm_map(int fd, size_t size, shared_data_t* data) {
     xbt_die("Could not map fd %d: %s", fd, strerror(errno));
   }
   if(!allocs_metadata) {
     xbt_die("Could not map fd %d: %s", fd, strerror(errno));
   }
   if(!allocs_metadata) {
-    allocs_metadata = xbt_dict_new();
+    allocs_metadata = xbt_dict_new_homogeneous(xbt_free);
   }
   snprintf(loc, PTR_STRLEN, "%p", mem);
   meta = xbt_new(shared_metadata_t, 1);
   meta->size = size;
   meta->data = data;
   }
   snprintf(loc, PTR_STRLEN, "%p", mem);
   meta = xbt_new(shared_metadata_t, 1);
   meta->size = size;
   meta->data = data;
-  xbt_dict_set(allocs_metadata, loc, meta, &free);
+  xbt_dict_set(allocs_metadata, loc, meta, NULL);
   XBT_DEBUG("MMAP %zu to %p", size, mem);
   return mem;
 }
   XBT_DEBUG("MMAP %zu to %p", size, mem);
   return mem;
 }
index f5dd903..d3d87f7 100644 (file)
@@ -680,7 +680,7 @@ static void smpi_gap_append(double size, const link_CM02_t link,
 
   if (sg_sender_gap > 0.0) {
     if (!gap_lookup) {
 
   if (sg_sender_gap > 0.0) {
     if (!gap_lookup) {
-      gap_lookup = xbt_dict_new();
+      gap_lookup = xbt_dict_new_homogeneous(NULL);
     }
     fifo = (xbt_fifo_t) xbt_dict_get_or_null(gap_lookup, src);
     action->sender.gap = 0.0;
     }
     fifo = (xbt_fifo_t) xbt_dict_get_or_null(gap_lookup, src);
     action->sender.gap = 0.0;
index 9a0a99e..a34bf83 100644 (file)
@@ -43,7 +43,7 @@ static surf_action_t storage_action_ls(void *storage, const char* path)
 {
   surf_action_t action = storage_action_execute(storage,0, LS);
   action->ls_dict = NULL;
 {
   surf_action_t action = storage_action_execute(storage,0, LS);
   action->ls_dict = NULL;
-  xbt_dict_t ls_dict = xbt_dict_new();
+  xbt_dict_t ls_dict = xbt_dict_new_homogeneous(NULL);
 
   char* key;
   sg_storage_size_t size = 0;
 
   char* key;
   sg_storage_size_t size = 0;
@@ -204,7 +204,7 @@ static xbt_dict_t storage_get_content(void *storage)
   /*surf_action_t action = storage_action_execute(storage,0, LS);*/
 
   void *st = surf_storage_resource_priv(storage);
   /*surf_action_t action = storage_action_execute(storage,0, LS);*/
 
   void *st = surf_storage_resource_priv(storage);
-  xbt_dict_t content_dict = xbt_dict_new();
+  xbt_dict_t content_dict = xbt_dict_new_homogeneous(NULL);
   xbt_dict_cursor_t cursor = NULL;
   char *file;
   char *size;
   xbt_dict_cursor_t cursor = NULL;
   char *file;
   char *size;
index dae1ecc..3835bc6 100644 (file)
@@ -401,7 +401,7 @@ void surf_init(int *argc, char **argv)
   as_router_lib = xbt_lib_new();
   storage_lib = xbt_lib_new();
   storage_type_lib = xbt_lib_new();
   as_router_lib = xbt_lib_new();
   storage_lib = xbt_lib_new();
   storage_type_lib = xbt_lib_new();
-  watched_hosts_lib = xbt_dict_new();
+  watched_hosts_lib = xbt_dict_new_homogeneous(NULL);
 
   XBT_DEBUG("Add routing levels");
   ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free);
 
   XBT_DEBUG("Add routing levels");
   ROUTING_HOST_LEVEL = xbt_lib_add_level(host_lib,routing_asr_host_free);
index c4c000b..a949716 100644 (file)
@@ -369,7 +369,7 @@ static xbt_dict_t ws_get_storage_list(void *workstation)
 {
   s_mount_t mnt;
   unsigned int i;
 {
   s_mount_t mnt;
   unsigned int i;
-  xbt_dict_t storage_list = xbt_dict_new();
+  xbt_dict_t storage_list = xbt_dict_new_homogeneous(NULL);
   char *storage_name = NULL;
 
   workstation_CLM03_t ws = (workstation_CLM03_t) surf_workstation_resource_priv(workstation);
   char *storage_name = NULL;
 
   workstation_CLM03_t ws = (workstation_CLM03_t) surf_workstation_resource_priv(workstation);