[MOAB-dev] r4126 - MOAB/trunk/tools/dagmc

sjackson at cae.wisc.edu sjackson at cae.wisc.edu
Wed Sep 15 11:58:59 CDT 2010


Author: sjackson
Date: 2010-09-15 11:58:59 -0500 (Wed, 15 Sep 2010)
New Revision: 4126

Modified:
   MOAB/trunk/tools/dagmc/ray_fire_test.cc
Log:
Improvements to DagMC's ray_fire_test utility

* Fix memory estimate reporting under Linux kernel 2.6.32
* Add Moab's own memory estimates to python output
* Add verbose OBB stats to python output, because the stats() output
  string contains some information that is not otherwise accessible

Modified: MOAB/trunk/tools/dagmc/ray_fire_test.cc
===================================================================
--- MOAB/trunk/tools/dagmc/ray_fire_test.cc	2010-09-15 16:33:23 UTC (rev 4125)
+++ MOAB/trunk/tools/dagmc/ray_fire_test.cc	2010-09-15 16:58:59 UTC (rev 4126)
@@ -424,12 +424,8 @@
     ((double)r_usage.ru_stime.tv_usec/1.e6);
   tot_time = user_time + sys_time;
   tot_mem = 0;
-  if (0 != r_usage.ru_maxrss) {
-    tot_mem = r_usage.ru_idrss; 
-  }
-  else {
-      // this machine doesn't return rss - try going to /proc
-      // print the file name to open
+
+  // try going to /proc to estimate total memory
     char file_str[4096], dum_str[4096];
     int file_ptr = -1, file_len;
     file_ptr = open("/proc/self/stat", O_RDONLY);
@@ -462,7 +458,7 @@
                             &vm_size, &rss);
     if (num_fields == 24)
       tot_mem = ((double)vm_size);
-  }
+
 }
 
 
@@ -511,6 +507,16 @@
 
 }
 
+void moab_memory_estimates( Interface* mbi, int& moab_data_bytes, int& moab_alldata_est_bytes ){
+  
+  unsigned long storage, amortized_storage;
+  mbi->estimated_memory_use( NULL, 0, &storage, &amortized_storage );
+
+  moab_data_bytes = storage;
+  moab_alldata_est_bytes = amortized_storage;
+
+}
+
 #define DICT_VAL(X) out << "'" #X "':" << X << "," << std::endl;
 #define DICT_VAL_STR(X) out << "'" #X  "':'" << X << "'," << std::endl;
 void dump_pyfile( char* filename, double timewith, double timewithout, double tmem, DagMC& dagmc,
@@ -551,6 +557,10 @@
     DICT_VAL(timewith-timewithout);
   }
   DICT_VAL(tmem);
+  int moab_data_bytes, moab_alldata_est_bytes;
+  moab_memory_estimates( dagmc.moab_instance(), moab_data_bytes, moab_alldata_est_bytes );


More information about the moab-dev mailing list