From: navarro Date: Fri, 22 Jun 2012 11:07:42 +0000 (+0200) Subject: Need to have a double because the result should not be an integer. X-Git-Tag: v3_8~491 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/15afbe2327850f075af976703a182bf99289c118 Need to have a double because the result should not be an integer. --- diff --git a/examples/msg/io/file.c b/examples/msg/io/file.c index e899d95b68..21c1b836ce 100644 --- a/examples/msg/io/file.c +++ b/examples/msg/io/file.c @@ -36,7 +36,7 @@ int host(int argc, char *argv[]) s_msg_stat_t stat; void *ptr = NULL; char* mount = bprintf("/home"); - size_t read,write; + double read,write; if(!strcmp(MSG_process_get_name(MSG_process_self()),"0")) file = MSG_file_open(mount,FILENAME1,"rw"); @@ -51,16 +51,16 @@ int host(int argc, char *argv[]) XBT_INFO("\tOpen file '%s'",file->name); read = MSG_file_read(ptr,10000000,sizeof(char*),file); // Read for 10Mo - XBT_INFO("\tHaving read %zu \ton %s",read,file->name); + XBT_INFO("\tHaving read %.1f \ton %s",read,file->name); write = MSG_file_write(ptr,100000,sizeof(char*),file); // Write for 100Ko - XBT_INFO("\tHaving write %zu \ton %s",write,file->name); + XBT_INFO("\tHaving write %.1f \ton %s",write,file->name); read = MSG_file_read(ptr,10000000,sizeof(char*),file); // Read for 10Mo - XBT_INFO("\tHaving read %zu \ton %s",read,file->name); + XBT_INFO("\tHaving read %.1f \ton %s",read,file->name); MSG_file_stat(file,&stat); - XBT_INFO("\tFile stat %s Size %f",file->name,stat.size); + XBT_INFO("\tFile stat %s Size %.1f",file->name,stat.size); XBT_INFO("\tClose file '%s'",file->name); MSG_file_close(file); @@ -76,9 +76,9 @@ int main(int argc, char **argv) MSG_create_environment(argv[1]); xbt_dynar_t hosts = MSG_hosts_as_dynar(); MSG_function_register("host", host); - - XBT_INFO("Number of host '%lu'",xbt_dynar_length(hosts)); - for(i = 0 ; i [ 0.000000] (2:1@alice) Open file './doc/simgrid/examples/platforms/One_cluster_no_backbone.xml' > [ 0.000000] (3:2@carl) Open file './doc/simgrid/examples/platforms/g5k_cabinets.xml' > [ 0.000000] (4:3@bob) Open file './doc/simgrid/examples/platforms/nancy.xml' -> [ 0.000005] (2:1@alice) Having read 482 on ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml -> [ 0.000040] (4:3@bob) Having read 4028 on ./doc/simgrid/examples/platforms/nancy.xml -> [ 0.000170] (1:0@denise) Having read 17028 on ./doc/simgrid/examples/platforms/g5k.xml -> [ 0.000226] (3:2@carl) Having read 22645 on ./doc/simgrid/examples/platforms/g5k_cabinets.xml -> [ 0.003338] (2:1@alice) Having write 100000 on ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml -> [ 0.003374] (4:3@bob) Having write 100000 on ./doc/simgrid/examples/platforms/nancy.xml -> [ 0.003504] (1:0@denise) Having write 100000 on ./doc/simgrid/examples/platforms/g5k.xml -> [ 0.003560] (3:2@carl) Having write 100000 on ./doc/simgrid/examples/platforms/g5k_cabinets.xml -> [ 0.004343] (2:1@alice) Having read 100482 on ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml -> [ 0.004343] (2:1@alice) File stat ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml Size 100482 +> [ 0.000005] (2:1@alice) Having read 482.0 on ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml +> [ 0.000040] (4:3@bob) Having read 4028.0 on ./doc/simgrid/examples/platforms/nancy.xml +> [ 0.000170] (1:0@denise) Having read 17028.0 on ./doc/simgrid/examples/platforms/g5k.xml +> [ 0.000226] (3:2@carl) Having read 22645.0 on ./doc/simgrid/examples/platforms/g5k_cabinets.xml +> [ 0.003338] (2:1@alice) Having write 100000.0 on ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml +> [ 0.003374] (4:3@bob) Having write 100000.0 on ./doc/simgrid/examples/platforms/nancy.xml +> [ 0.003504] (1:0@denise) Having write 100000.0 on ./doc/simgrid/examples/platforms/g5k.xml +> [ 0.003560] (3:2@carl) Having write 100000.0 on ./doc/simgrid/examples/platforms/g5k_cabinets.xml +> [ 0.004343] (2:1@alice) Having read 100482.0 on ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml +> [ 0.004343] (2:1@alice) File stat ./doc/simgrid/examples/platforms/One_cluster_no_backbone.xml Size 100482.0 > [ 0.004343] (2:1@alice) Close file './doc/simgrid/examples/platforms/One_cluster_no_backbone.xml' -> [ 0.004414] (4:3@bob) Having read 104028 on ./doc/simgrid/examples/platforms/nancy.xml -> [ 0.004414] (4:3@bob) File stat ./doc/simgrid/examples/platforms/nancy.xml Size 104028 +> [ 0.004414] (4:3@bob) Having read 104028.0 on ./doc/simgrid/examples/platforms/nancy.xml +> [ 0.004414] (4:3@bob) File stat ./doc/simgrid/examples/platforms/nancy.xml Size 104028.0 > [ 0.004414] (4:3@bob) Close file './doc/simgrid/examples/platforms/nancy.xml' -> [ 0.004674] (1:0@denise) Having read 117028 on ./doc/simgrid/examples/platforms/g5k.xml -> [ 0.004674] (1:0@denise) File stat ./doc/simgrid/examples/platforms/g5k.xml Size 117028 +> [ 0.004674] (1:0@denise) Having read 117028.0 on ./doc/simgrid/examples/platforms/g5k.xml +> [ 0.004674] (1:0@denise) File stat ./doc/simgrid/examples/platforms/g5k.xml Size 117028.0 > [ 0.004674] (1:0@denise) Close file './doc/simgrid/examples/platforms/g5k.xml' -> [ 0.004786] (3:2@carl) Having read 122645 on ./doc/simgrid/examples/platforms/g5k_cabinets.xml -> [ 0.004786] (3:2@carl) File stat ./doc/simgrid/examples/platforms/g5k_cabinets.xml Size 122645 +> [ 0.004786] (3:2@carl) Having read 122645.0 on ./doc/simgrid/examples/platforms/g5k_cabinets.xml +> [ 0.004786] (3:2@carl) File stat ./doc/simgrid/examples/platforms/g5k_cabinets.xml Size 122645.0 > [ 0.004786] (3:2@carl) Close file './doc/simgrid/examples/platforms/g5k_cabinets.xml' -> [ 0.004786] (0:@) Simulation time 0.00478623 \ No newline at end of file +> [ 0.004786] (0:@) Simulation time 0.00478623 diff --git a/include/msg/msg.h b/include/msg/msg.h index a947576db3..8194d19eb3 100644 --- a/include/msg/msg.h +++ b/include/msg/msg.h @@ -73,7 +73,7 @@ XBT_PUBLIC(unsigned long int) MSG_get_sent_msg(void); /************************** File handling ***********************************/ -XBT_PUBLIC(size_t) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream); +XBT_PUBLIC(double) MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream); XBT_PUBLIC(size_t) MSG_file_write(const void* ptr, size_t size, size_t nmemb, msg_file_t stream); XBT_PUBLIC(msg_file_t) MSG_file_open(const char* mount, const char* path, const char* mode); XBT_PUBLIC(int) MSG_file_close(msg_file_t fp); diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 872af4a677..1dd29b9250 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -431,7 +431,7 @@ XBT_PUBLIC(void) simcall_sem_acquire_timeout(smx_sem_t sem, XBT_PUBLIC(unsigned int) simcall_sem_acquire_any(xbt_dynar_t sems); XBT_PUBLIC(int) simcall_sem_get_capacity(smx_sem_t sem); -XBT_PUBLIC(size_t) simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream); +XBT_PUBLIC(double) simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream); XBT_PUBLIC(size_t) simcall_file_write(const void* ptr, size_t size, size_t nmemb, smx_file_t stream); XBT_PUBLIC(smx_file_t) simcall_file_open(const char* storage, const char* path, const char* mode); XBT_PUBLIC(int) simcall_file_close(smx_file_t fp); diff --git a/src/msg/msg_io.c b/src/msg/msg_io.c index affae9d2f6..3774f1eb1a 100644 --- a/src/msg/msg_io.c +++ b/src/msg/msg_io.c @@ -28,7 +28,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_io, msg, * \param stream to read * \return the number of items successfully read */ -size_t MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream) +double MSG_file_read(void* ptr, size_t size, size_t nmemb, msg_file_t stream) { return simcall_file_read(ptr, size, nmemb, stream->simdata->smx_file); } diff --git a/src/simix/smx_smurf_private.h b/src/simix/smx_smurf_private.h index 6ce40e26ac..083008a093 100644 --- a/src/simix/smx_smurf_private.h +++ b/src/simix/smx_smurf_private.h @@ -513,7 +513,7 @@ typedef struct s_smx_simcall { size_t size; size_t nmemb; smx_file_t stream; - size_t result; + double result; } file_read; struct { diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index c0f8af041f..25f75a3df0 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -1203,7 +1203,7 @@ int simcall_sem_get_capacity(smx_sem_t sem) return simcall->sem_get_capacity.result; } -size_t simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream) +double simcall_file_read(void* ptr, size_t size, size_t nmemb, smx_file_t stream) { smx_simcall_t simcall = SIMIX_simcall_mine(); diff --git a/src/surf/storage.c b/src/surf/storage.c index 15db4c7d5a..7aed75ee22 100644 --- a/src/surf/storage.c +++ b/src/surf/storage.c @@ -76,12 +76,9 @@ static surf_action_t storage_action_close(void *storage, surf_file_t fp) static surf_action_t storage_action_read(void *storage, void* ptr, double size, size_t nmemb, surf_file_t stream) { - char *filename = stream->name; surf_stat_t content = stream->content; - XBT_INFO("\tRead file '%s' size '%f/%f'",filename,content->stat.size,size); if(size > content->stat.size) size = content->stat.size; - XBT_INFO("Really read file '%s' for %f",filename,size); surf_action_t action = storage_action_execute(storage,size,READ); return action; } @@ -212,10 +209,8 @@ static void storage_update_actions_state(double now, double delta) if(action->type == WRITE) { double rate = lmm_variable_getvalue(GENERIC_LMM_ACTION(action).variable); - XBT_INFO("Update %f + %f = %f",((surf_action_t)action)->file->content->stat.size,delta * rate,((surf_action_t)action)->file->content->stat.size+delta * rate); ((storage_t)(action->storage))->used_size += delta * rate; // disk usage ((surf_action_t)action)->file->content->stat.size += delta * rate; // file size - XBT_INFO("Have updating to %f",((surf_action_t)action)->file->content->stat.size); } }