diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-10-03 19:47:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-10-03 19:47:00 +0000 |
commit | 2f51ff92b859a9b3b9b6a4cda226553e73327574 (patch) | |
tree | 00025269b947fe8648cff7db8f2c351444578332 /Carpet | |
parent | 5df135bab562f9e9e7c5da7dacf0c81640c74c50 (diff) |
CarpetIOASCII: Record time spent in I/O
darcs-hash:20071003194750-dae7b-02254987c83d04dbe6ce7ba3d67855492e9678a9.gz
Diffstat (limited to 'Carpet')
-rw-r--r-- | Carpet/CarpetIOASCII/src/ioascii.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/Carpet/CarpetIOASCII/src/ioascii.cc b/Carpet/CarpetIOASCII/src/ioascii.cc index b21638be8..99cde41f7 100644 --- a/Carpet/CarpetIOASCII/src/ioascii.cc +++ b/Carpet/CarpetIOASCII/src/ioascii.cc @@ -643,7 +643,10 @@ namespace CarpetIOASCII { } } // if grouptype is GF - ofstream file; + fstream file; + BeginTimingIO (cctkGH); + long long io_files = 0; + long long io_bytes_begin = 0, io_bytes_end = 0; if (dist::rank()==ioproc) { // Invent a file name @@ -682,7 +685,6 @@ namespace CarpetIOASCII { string filenamestr = filenamebuf.str(); const char* const filename = filenamestr.c_str(); - // Open the file file.open (filename, ios::out | (is_new_file ? ios::trunc : ios::app)); @@ -691,6 +693,8 @@ namespace CarpetIOASCII { "Could not open output file '%s' for variable '%s'", filename, varname); } + io_files += 1; + io_bytes_begin = file.tellg(); // If this is the first time, then write a nice header if (is_new_file) { bool want_labels = false; @@ -936,12 +940,19 @@ namespace CarpetIOASCII { assert (file.good()); file << eol; } + io_bytes_end = file.tellg(); file.close(); assert (file.good()); } assert (not file.is_open()); + long long io_bytes = io_bytes_end - io_bytes_begin; + // Broadcast I/O size and synchronise processes + MPI_Bcast (& io_files, 1, MPI_LONG_LONG, 0, dist::comm()); + MPI_Bcast (& io_bytes, 1, MPI_LONG_LONG, 0, dist::comm()); + EndTimingIO (cctkGH, io_files, io_bytes, false); + } END_MAP_LOOP; } // if (desired) |