diff options
author | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-10-03 19:50:00 +0000 |
---|---|---|
committer | Erik Schnetter <schnetter@cct.lsu.edu> | 2007-10-03 19:50:00 +0000 |
commit | 49ac81ecea3f2eaf425e9924c528fe8dfb4e9c8a (patch) | |
tree | e5a6f4de249d7ad9011f218d0e34c125f8807843 /Carpet/CarpetIOScalar | |
parent | cec78505b1c14f5604aa7d473f3ae6f0f421dca6 (diff) |
CarpetIOScalar: Record time spent in I/O
darcs-hash:20071003195015-dae7b-cc7705056e55d76a20ad0277588b57329886032a.gz
Diffstat (limited to 'Carpet/CarpetIOScalar')
-rw-r--r-- | Carpet/CarpetIOScalar/src/ioscalar.cc | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Carpet/CarpetIOScalar/src/ioscalar.cc b/Carpet/CarpetIOScalar/src/ioscalar.cc index d92bb7e66..0e26646be 100644 --- a/Carpet/CarpetIOScalar/src/ioscalar.cc +++ b/Carpet/CarpetIOScalar/src/ioscalar.cc @@ -263,7 +263,10 @@ namespace CarpetIOScalar { { string const reduction = ireduction->reduction; - ofstream file; + fstream file; + BeginTimingIO (cctkGH); + long long io_files = 0; + long long io_bytes_begin = 0, io_bytes_end = 0; if (CCTK_MyProc(cctkGH)==0) { // Invent a file name @@ -277,6 +280,8 @@ namespace CarpetIOScalar { // If this is the first time, then write a nice header if (do_truncate.at(n) and IO_TruncateOutputFiles (cctkGH)) { file.open (filename, ios::out | ios::trunc); + io_files += 1; + io_bytes_begin = file.tellg(); { bool want_labels = false; bool want_date = false; @@ -353,6 +358,8 @@ namespace CarpetIOScalar { } } else { file.open (filename, ios::out | ios::app); + io_files += 1; + io_bytes_begin = file.tellg(); } if (! file.good()) { CCTK_VWarn (0, __LINE__, __FILE__, CCTK_THORNSTRING, @@ -420,12 +427,19 @@ namespace CarpetIOScalar { } if (CCTK_MyProc(cctkGH)==0) { + io_bytes_end = file.tellg(); file.close(); assert (file.good()); } assert (! 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); + } // for reductions } END_GLOBAL_MODE; |