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");
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);
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<xbt_dynar_length(hosts); i++)
+ unsigned long nb_hosts = xbt_dynar_length(hosts);
+ XBT_INFO("Number of host '%lu'",nb_hosts);
+ for(i = 0 ; i<nb_hosts; i++)
{
char* name_host = bprintf("%d",i);
MSG_process_create( name_host, host, NULL, xbt_dynar_get_as(hosts,i,m_host_t) );
> [ 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
/************************** 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);
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);
* \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);
}
size_t size;
size_t nmemb;
smx_file_t stream;
- size_t result;
+ double result;
} file_read;
struct {
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();
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;
}
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);
}
}