[MOAB-dev] r4301 - MOAB/trunk/src/io

tautges at mcs.anl.gov tautges at mcs.anl.gov
Tue Nov 23 19:00:22 CST 2010


Author: tautges
Date: 2010-11-23 19:00:22 -0600 (Tue, 23 Nov 2010)
New Revision: 4301

Modified:
   MOAB/trunk/src/io/WriteHDF5.cpp
Log:
Adding CPUTIME reporting to WriteHDF5, to enable, use CPUTIME option.



Modified: MOAB/trunk/src/io/WriteHDF5.cpp
===================================================================
--- MOAB/trunk/src/io/WriteHDF5.cpp	2010-11-23 22:11:48 UTC (rev 4300)
+++ MOAB/trunk/src/io/WriteHDF5.cpp	2010-11-24 01:00:22 UTC (rev 4301)
@@ -57,6 +57,13 @@
 #include "moab/Version.h"
 #include "IODebugTrack.hpp"
 #include "mhdf.h"
+
+#ifdef USE_MPI
+#define RUNTIME MPI_Wtime()
+#else
+#define RUNTIME (clock()/(double)CLOCKS_PER_SEC)
+#endif
+
 /* Access HDF5 file handle for debugging
 #include <H5Fpublic.h>
 struct file { uint32_t magic; hid_t handle; };
@@ -468,10 +475,19 @@
   std::list<SparseTag>::const_iterator t_itor;
   std::list<ExportSet>::iterator ex_itor;
   EntityHandle elem_count, max_id;
+  double init_time, gather_time, create_time, node_time, element_time, set_time, tag_time, total_time;
   
   if (MB_SUCCESS != init())
     return error(MB_FAILURE);
 
+    // see if we need to report times
+  bool cputime = false;
+  result = opts.get_null_option("CPUTIME");
+  if (MB_SUCCESS == result) {
+    cputime = true;
+    init_time = RUNTIME;
+  }
+
   dbgOut.tprint(1,"Gathering Mesh\n");
   
     // Gather mesh to export
@@ -489,6 +505,8 @@
       return error(result);
   }
   
+  if (cputime) gather_time = RUNTIME;
+  
   //if (nodeSet.range.size() == 0)
   //  return error(MB_ENTITY_NOT_FOUND);
   
@@ -538,6 +556,8 @@
   if (MB_SUCCESS != result)
     return error(result);
 


More information about the moab-dev mailing list