{
msg_file_t file = NULL;
sg_size_t read,write;
+ msg_storage_t st;
+ const char* st_name;
if(!strcmp(MSG_process_get_name(MSG_process_self()),"0")){
file = MSG_file_open(FILENAME1, NULL);
MSG_file_dump(file);
+ st_name = "Disk4";
} else if(!strcmp(MSG_process_get_name(MSG_process_self()),"1")) {
file = MSG_file_open(FILENAME2, NULL);
+ st_name = "Disk2";
} else if(!strcmp(MSG_process_get_name(MSG_process_self()),"2")){
file = MSG_file_open(FILENAME3, NULL);
- } else if(!strcmp(MSG_process_get_name(MSG_process_self()),"3"))
+ st_name = "Disk3";
+ } else if(!strcmp(MSG_process_get_name(MSG_process_self()),"3")){
file = MSG_file_open(FILENAME4, NULL);
+ st_name = "Disk1";
+ }
else xbt_die("FILENAME NOT DEFINED %s",MSG_process_get_name(MSG_process_self()));
const char* filename = MSG_file_get_name(file);
XBT_INFO("\tOpen file '%s'",filename);
+ st = MSG_storage_get_by_name(st_name);
+
+ XBT_INFO("\tCapacity of the storage element '%s' is stored on: %llu / %llu",
+ filename, MSG_storage_get_used_size(st), MSG_storage_get_size(st));
+
+ /* Try to read for 10MB */
+ read = MSG_file_read(file, 10000000);
+ XBT_INFO("\tHave read %llu from '%s'",read,filename);
+
+ /* Write 100KB in file from the current position, i.e, end of file or 10MB */
+ write = MSG_file_write(file, 100000);
+ XBT_INFO("\tHave written %llu in '%s'. Size now is: %llu",write,filename,
+ MSG_file_get_size(file));
+
- read = MSG_file_read(file, 10000000); // Read for 10MB
- XBT_INFO("\tHave read %llu on %s",read,filename);
+ XBT_INFO("\tCapacity of the storage element '%s' is stored on: %llu / %llu",
+ filename, MSG_storage_get_used_size(st), MSG_storage_get_size(st));
- write = MSG_file_write(file, 100000); // Write for 100KB
- XBT_INFO("\tHave written %llu on %s",write,filename);
+ /* rewind to the beginning of the file */
+ XBT_INFO("\tComing back to the beginning of the stream for file '%s'",
+ filename);
+ MSG_file_seek(file, 0, SEEK_SET);
- read = MSG_file_read(file, 110000); // Read for 110KB
- XBT_INFO("\tHave read %llu on %s (of size %llu)",read,filename,
+ /* Try to read 110KB */
+ read = MSG_file_read(file, 110000);
+ XBT_INFO("\tHave read %llu from '%s' (of size %llu)",read,filename,
MSG_file_get_size(file));
+ /* rewind once again to the beginning of the file */
+ XBT_INFO("\tComing back to the beginning of the stream for file '%s'",
+ filename);
+ MSG_file_seek(file, 0, SEEK_SET);
+
+ /* Write 110KB in file from the current position, i.e, end of file or 10MB */
+ write = MSG_file_write(file, 110000);
+ XBT_INFO("\tHave written %llu in '%s'. Size now is: %llu", write,filename,
+ MSG_file_get_size(file));
+
+ XBT_INFO("\tCapacity of the storage element '%s' is stored on: %llu / %llu",
+ filename, MSG_storage_get_used_size(st), MSG_storage_get_size(st));
+
XBT_INFO("\tClose file '%s'",filename);
MSG_file_close(file);
> Storage Type: 'single_SSD'
> Content Type: 'txt_unix'
> [ 0.000000] (1:0@denise) Open file '/home/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.000040] (4:3@bob) Have read 4028 on /home/doc/simgrid/examples/platforms/nancy.xml
-> [ 0.000085] (1:0@denise) Have read 17028 on /home/doc/simgrid/examples/platforms/g5k.xml
-> [ 0.000226] (3:2@carl) Have read 22645 on /home/doc/simgrid/examples/platforms/g5k_cabinets.xml
-> [ 0.000508] (2:1@alice) Have read 101663 on c:\Windows\setupact.log
-> [ 0.001752] (1:0@denise) Have written 100000 on /home/doc/simgrid/examples/platforms/g5k.xml
-> [ 0.002175] (2:1@alice) Have written 100000 on c:\Windows\setupact.log
-> [ 0.002439] (1:0@denise) Have read 110000 on /home/doc/simgrid/examples/platforms/g5k.xml (of size 117026)
-> [ 0.002439] (1:0@denise) Close file '/home/doc/simgrid/examples/platforms/g5k.xml'
-> [ 0.002862] (2:1@alice) Have read 110000 on c:\Windows\setupact.log (of size 201662)
-> [ 0.002862] (2:1@alice) Close file 'c:\Windows\setupact.log'
-> [ 0.003374] (4:3@bob) Have written 100000 on /home/doc/simgrid/examples/platforms/nancy.xml
-> [ 0.003560] (3:2@carl) Have written 100000 on /home/doc/simgrid/examples/platforms/g5k_cabinets.xml
-> [ 0.004529] (4:3@bob) Have read 104023 on /home/doc/simgrid/examples/platforms/nancy.xml (of size 104023)
-> [ 0.004529] (4:3@bob) Close file '/home/doc/simgrid/examples/platforms/nancy.xml'
-> [ 0.004782] (3:2@carl) Have read 110000 on /home/doc/simgrid/examples/platforms/g5k_cabinets.xml (of size 122641)
-> [ 0.004782] (3:2@carl) Close file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
-> [ 0.004782] (0:@) Simulation time 0.00478201
+> [ 0.000000] (2:1@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391537133 / 536870912000
+> [ 0.000000] (3:2@carl) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' is stored on: 36946053 / 536870912000
+> [ 0.000000] (4:3@bob) Capacity of the storage element '/home/doc/simgrid/examples/platforms/nancy.xml' is stored on: 36946053 / 536870912000
+> [ 0.000000] (1:0@denise) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k.xml' is stored on: 13221994 / 536870912000
+> [ 0.000040] (4:3@bob) Have read 4028 from '/home/doc/simgrid/examples/platforms/nancy.xml'
+> [ 0.000085] (1:0@denise) Have read 17028 from '/home/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.000226] (3:2@carl) Have read 22645 from '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
+> [ 0.000508] (2:1@alice) Have read 101663 from 'c:\Windows\setupact.log'
+> [ 0.001752] (1:0@denise) Have written 100000 in '/home/doc/simgrid/examples/platforms/g5k.xml'. Size now is: 117028
+> [ 0.001752] (1:0@denise) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k.xml' is stored on: 13321994 / 536870912000
+> [ 0.001752] (1:0@denise) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.002175] (2:1@alice) Have written 100000 in 'c:\Windows\setupact.log'. Size now is: 201663
+> [ 0.002175] (2:1@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391637133 / 536870912000
+> [ 0.002175] (2:1@alice) Coming back to the beginning of the stream for file 'c:\Windows\setupact.log'
+> [ 0.002439] (1:0@denise) Have read 110000 from '/home/doc/simgrid/examples/platforms/g5k.xml' (of size 117028)
+> [ 0.002439] (1:0@denise) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.002862] (2:1@alice) Have read 110000 from 'c:\Windows\setupact.log' (of size 201663)
+> [ 0.002862] (2:1@alice) Coming back to the beginning of the stream for file 'c:\Windows\setupact.log'
+> [ 0.003374] (4:3@bob) Have written 100000 in '/home/doc/simgrid/examples/platforms/nancy.xml'. Size now is: 104028
+> [ 0.003374] (4:3@bob) Capacity of the storage element '/home/doc/simgrid/examples/platforms/nancy.xml' is stored on: 37046053 / 536870912000
+> [ 0.003374] (4:3@bob) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/nancy.xml'
+> [ 0.003560] (3:2@carl) Have written 100000 in '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'. Size now is: 122645
+> [ 0.003560] (3:2@carl) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' is stored on: 37046053 / 536870912000
+> [ 0.003560] (3:2@carl) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
+> [ 0.004529] (4:3@bob) Have read 104028 from '/home/doc/simgrid/examples/platforms/nancy.xml' (of size 104028)
+> [ 0.004529] (4:3@bob) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/nancy.xml'
+> [ 0.004782] (3:2@carl) Have read 110000 from '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' (of size 122645)
+> [ 0.004782] (3:2@carl) Coming back to the beginning of the stream for file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
+> [ 0.006106] (1:0@denise) Have written 110000 in '/home/doc/simgrid/examples/platforms/g5k.xml'. Size now is: 110000
+> [ 0.006106] (1:0@denise) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k.xml' is stored on: 13314966 / 536870912000
+> [ 0.006106] (1:0@denise) Close file '/home/doc/simgrid/examples/platforms/g5k.xml'
+> [ 0.006529] (2:1@alice) Have written 110000 in 'c:\Windows\setupact.log'. Size now is: 110000
+> [ 0.006529] (2:1@alice) Capacity of the storage element 'c:\Windows\setupact.log' is stored on: 2391545470 / 536870912000
+> [ 0.006529] (2:1@alice) Close file 'c:\Windows\setupact.log'
+> [ 0.011863] (4:3@bob) Have written 110000 in '/home/doc/simgrid/examples/platforms/nancy.xml'. Size now is: 110000
+> [ 0.011863] (4:3@bob) Capacity of the storage element '/home/doc/simgrid/examples/platforms/nancy.xml' is stored on: 37052025 / 536870912000
+> [ 0.011863] (4:3@bob) Close file '/home/doc/simgrid/examples/platforms/nancy.xml'
+> [ 0.012115] (3:2@carl) Have written 110000 in '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'. Size now is: 110000
+> [ 0.012115] (3:2@carl) Capacity of the storage element '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml' is stored on: 37033408 / 536870912000
+> [ 0.012115] (3:2@carl) Close file '/home/doc/simgrid/examples/platforms/g5k_cabinets.xml'
+> [ 0.012115] (0:@) Simulation time 0.0121153
$ ${bindir:=.}/io/file_unlink ${srcdir:=.}/examples/platforms/storage.xml "--log=root.fmt:[%10.6r]%e(%i:%P@%h)%e%m%n"
> [ 0.000000] (0:@) Number of host '4'