[MOAB-dev] commit/MOAB: 5 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Jul 14 19:05:47 CDT 2014
5 new commits in MOAB:
https://bitbucket.org/fathomteam/moab/commits/29f47717e991/
Changeset: 29f47717e991
Branch: None
User: vijaysm
Date: 2014-07-15 00:09:19
Summary: Making an API change to estimate the memory usage in all of the MOAB routines: changing long to long long
Affected #: 10 files
diff --git a/src/AEntityFactory.cpp b/src/AEntityFactory.cpp
index e29df97..650ad49 100644
--- a/src/AEntityFactory.cpp
+++ b/src/AEntityFactory.cpp
@@ -1473,8 +1473,8 @@ ErrorCode AEntityFactory::set_adjacency_ptr( EntityHandle entity,
}
-void AEntityFactory::get_memory_use( unsigned long& entity_total,
- unsigned long& memory_total )
+void AEntityFactory::get_memory_use( unsigned long long& entity_total,
+ unsigned long long& memory_total )
{
entity_total = memory_total = 0;
@@ -1506,8 +1506,8 @@ void AEntityFactory::get_memory_use( unsigned long& entity_total,
ErrorCode AEntityFactory::get_memory_use( const Range& ents_in,
- unsigned long& min_per_ent,
- unsigned long& amortized )
+ unsigned long long& min_per_ent,
+ unsigned long long& amortized )
{
min_per_ent = amortized = 0;
SequenceData* prev_data = 0;
diff --git a/src/AEntityFactory.hpp b/src/AEntityFactory.hpp
index 5d3c3f3..c84a0d3 100644
--- a/src/AEntityFactory.hpp
+++ b/src/AEntityFactory.hpp
@@ -163,11 +163,11 @@ public:
ErrorCode merge_adjust_adjacencies(EntityHandle entity_to_keep,
EntityHandle entity_to_remove);
- void get_memory_use( unsigned long& total_entity_storage,
- unsigned long& total_storage );
+ void get_memory_use( unsigned long long& total_entity_storage,
+ unsigned long long& total_storage );
ErrorCode get_memory_use( const Range& entities,
- unsigned long& total_entity_storage,
- unsigned long& total_amortized_storage );
+ unsigned long long& total_entity_storage,
+ unsigned long long& total_amortized_storage );
private:
diff --git a/src/AdaptiveKDTree.cpp b/src/AdaptiveKDTree.cpp
index 4b104b4..f629cc4 100644
--- a/src/AdaptiveKDTree.cpp
+++ b/src/AdaptiveKDTree.cpp
@@ -2154,7 +2154,7 @@ namespace moab {
all.merge( elem2d );
all.merge( elem3d );
tree_sets.insert( myRoot );
- unsigned long set_used, set_amortized, set_store_used, set_store_amortized,
+ unsigned long long set_used, set_amortized, set_store_used, set_store_amortized,
set_tag_used, set_tag_amortized, elem_used, elem_amortized;
moab()->estimated_memory_use( tree_sets,
&set_used, &set_amortized,
diff --git a/src/Core.cpp b/src/Core.cpp
index 0bd882f..620c2dd 100644
--- a/src/Core.cpp
+++ b/src/Core.cpp
@@ -3851,22 +3851,22 @@ ErrorCode Core::get_set_iterators(EntityHandle meshset,
}
void Core::estimated_memory_use_internal( const Range* ents,
- unsigned long* total_storage,
- unsigned long* total_amortized_storage,
- unsigned long* entity_storage,
- unsigned long* amortized_entity_storage,
- unsigned long* adjacency_storage,
- unsigned long* amortized_adjacency_storage,
+ unsigned long long* total_storage,
+ unsigned long long* total_amortized_storage,
+ unsigned long long* entity_storage,
+ unsigned long long* amortized_entity_storage,
+ unsigned long long* adjacency_storage,
+ unsigned long long* amortized_adjacency_storage,
const Tag* tag_array,
unsigned num_tags,
- unsigned long* tag_storage,
- unsigned long* amortized_tag_storage )
+ unsigned long long* tag_storage,
+ unsigned long long* amortized_tag_storage )
{
// Figure out which values we need to calulate
- unsigned long i_entity_storage, ia_entity_storage,
+ unsigned long long i_entity_storage, ia_entity_storage,
i_adjacency_storage, ia_adjacency_storage,
i_tag_storage, ia_tag_storage;
- unsigned long *total_tag_storage = 0,
+ unsigned long long *total_tag_storage = 0,
*amortized_total_tag_storage =0;
if (!tag_array) {
total_tag_storage = tag_storage;
@@ -3998,16 +3998,16 @@ void Core::estimated_memory_use_internal( const Range* ents,
void Core::estimated_memory_use( const EntityHandle* ent_array,
unsigned long num_ents,
- unsigned long* total_storage,
- unsigned long* total_amortized_storage,
- unsigned long* entity_storage,
- unsigned long* amortized_entity_storage,
- unsigned long* adjacency_storage,
- unsigned long* amortized_adjacency_storage,
+ unsigned long long* total_storage,
+ unsigned long long* total_amortized_storage,
+ unsigned long long* entity_storage,
+ unsigned long long* amortized_entity_storage,
+ unsigned long long* adjacency_storage,
+ unsigned long long* amortized_adjacency_storage,
const Tag* tag_array,
unsigned num_tags,
- unsigned long* tag_storage,
- unsigned long* amortized_tag_storage )
+ unsigned long long* tag_storage,
+ unsigned long long* amortized_tag_storage )
{
Range range;
@@ -4035,16 +4035,16 @@ void Core::estimated_memory_use( const EntityHandle* ent_array,
}
void Core::estimated_memory_use( const Range& ents,
- unsigned long* total_storage,
- unsigned long* total_amortized_storage,
- unsigned long* entity_storage,
- unsigned long* amortized_entity_storage,
- unsigned long* adjacency_storage,
- unsigned long* amortized_adjacency_storage,
+ unsigned long long* total_storage,
+ unsigned long long* total_amortized_storage,
+ unsigned long long* entity_storage,
+ unsigned long long* amortized_entity_storage,
+ unsigned long long* adjacency_storage,
+ unsigned long long* amortized_adjacency_storage,
const Tag* tag_array,
unsigned num_tags,
- unsigned long* tag_storage,
- unsigned long* amortized_tag_storage )
+ unsigned long long* tag_storage,
+ unsigned long long* amortized_tag_storage )
{
estimated_memory_use_internal( &ents,
total_storage, total_amortized_storage,
diff --git a/src/SequenceManager.cpp b/src/SequenceManager.cpp
index f896cf2..8ca1755 100644
--- a/src/SequenceManager.cpp
+++ b/src/SequenceManager.cpp
@@ -767,13 +767,13 @@ SequenceManager::replace_subsequence( EntitySequence* new_seq )
return typeData[type].replace_subsequence( new_seq, &tagSizes[0], tagSizes.size() );
}
-void SequenceManager::get_memory_use( unsigned long& total_entity_storage,
- unsigned long& total_storage ) const
+void SequenceManager::get_memory_use( unsigned long long& total_entity_storage,
+ unsigned long long& total_storage ) const
{
total_entity_storage = 0;
total_storage = 0;
- unsigned long temp_entity, temp_total;
+ unsigned long long temp_entity, temp_total;
for (EntityType i = MBVERTEX; i < MBMAXTYPE; ++i) {
temp_entity = temp_total = 0;
get_memory_use( i, temp_entity, temp_total );
@@ -783,19 +783,19 @@ void SequenceManager::get_memory_use( unsigned long& total_entity_storage,
}
void SequenceManager::get_memory_use( EntityType type,
- unsigned long& total_entity_storage,
- unsigned long& total_storage ) const
+ unsigned long long& total_entity_storage,
+ unsigned long long& total_storage ) const
{
typeData[type].get_memory_use( total_entity_storage, total_storage );
}
void SequenceManager::get_memory_use( const Range& entities,
- unsigned long& total_entity_storage,
- unsigned long& total_amortized_storage ) const
+ unsigned long long& total_entity_storage,
+ unsigned long long& total_amortized_storage ) const
{
total_entity_storage = 0;
total_amortized_storage = 0;
- unsigned long temp_entity, temp_total;
+ unsigned long long temp_entity, temp_total;
Range::const_pair_iterator i;
for (i = entities.const_pair_begin(); i != entities.const_pair_end(); ++i) {
const EntityType t1 = TYPE_FROM_HANDLE(i->first);
diff --git a/src/SequenceManager.hpp b/src/SequenceManager.hpp
index 50b1010..be70710 100644
--- a/src/SequenceManager.hpp
+++ b/src/SequenceManager.hpp
@@ -236,16 +236,16 @@ class SequenceManager
const TypeSequenceManager& entity_map( EntityType type ) const
{ return typeData[type]; }
- void get_memory_use( unsigned long& total_entity_storage,
- unsigned long& total_storage ) const;
+ void get_memory_use( unsigned long long& total_entity_storage,
+ unsigned long long& total_storage ) const;
void get_memory_use( EntityType type,
- unsigned long& total_entity_storage,
- unsigned long& total_storage ) const;
+ unsigned long long& total_entity_storage,
+ unsigned long long& total_storage ) const;
void get_memory_use( const Range& entities,
- unsigned long& total_entity_storage,
- unsigned long& total_amortized_storage ) const;
+ unsigned long long& total_entity_storage,
+ unsigned long long& total_amortized_storage ) const;
diff --git a/src/TypeSequenceManager.cpp b/src/TypeSequenceManager.cpp
index 50d6ef6..59f1d42 100644
--- a/src/TypeSequenceManager.cpp
+++ b/src/TypeSequenceManager.cpp
@@ -807,8 +807,8 @@ ErrorCode TypeSequenceManager::notify_prepended( iterator seq )
return rval;
}
-void TypeSequenceManager::get_memory_use( unsigned long& entity_storage,
- unsigned long& total_storage ) const
+void TypeSequenceManager::get_memory_use( unsigned long long& entity_storage,
+ unsigned long long& total_storage ) const
{
entity_storage = total_storage = 0;
if (empty())
@@ -825,8 +825,8 @@ void TypeSequenceManager::get_memory_use( unsigned long& entity_storage,
void TypeSequenceManager::append_memory_use( EntityHandle first,
EntityHandle last,
const SequenceData* data,
- unsigned long& entity_storage,
- unsigned long& total_storage ) const
+ unsigned long long& entity_storage,
+ unsigned long long& total_storage ) const
{
const unsigned long allocated_count = data->size();
@@ -865,8 +865,8 @@ void TypeSequenceManager::append_memory_use( EntityHandle first,
void TypeSequenceManager::get_memory_use( EntityHandle first,
EntityHandle last,
- unsigned long& entity_storage,
- unsigned long& total_storage ) const
+ unsigned long long& entity_storage,
+ unsigned long long& total_storage ) const
{
entity_storage = total_storage = 0;
diff --git a/src/TypeSequenceManager.hpp b/src/TypeSequenceManager.hpp
index f69bf15..bbc89fd 100644
--- a/src/TypeSequenceManager.hpp
+++ b/src/TypeSequenceManager.hpp
@@ -75,8 +75,8 @@ private:
void append_memory_use( EntityHandle first,
EntityHandle last,
const SequenceData* data,
- unsigned long& entity_storage,
- unsigned long& total_storage ) const;
+ unsigned long long& entity_storage,
+ unsigned long long& total_storage ) const;
// check if sequence at passed iterator should be merged with
// the subsequent sequence, and if so merge them retaining i.
@@ -332,12 +332,12 @@ public:
*/
ErrorCode notify_appended( iterator seq );
- void get_memory_use( unsigned long& total_entity_storage,
- unsigned long& total_storage ) const;
+ void get_memory_use( unsigned long long& total_entity_storage,
+ unsigned long long& total_storage ) const;
void get_memory_use( EntityHandle start, EntityHandle end,
- unsigned long& total_entity_storage,
- unsigned long& total_amortized_storage ) const;
+ unsigned long long& total_entity_storage,
+ unsigned long long& total_amortized_storage ) const;
unsigned long get_sequence_count() const
{ return sequenceSet.size(); }
diff --git a/src/moab/Core.hpp b/src/moab/Core.hpp
index aa7d9da..d767226 100644
--- a/src/moab/Core.hpp
+++ b/src/moab/Core.hpp
@@ -1224,16 +1224,16 @@ public:
*/
void estimated_memory_use( const EntityHandle* ent_array = 0,
unsigned long num_ents = 0,
- unsigned long* total_storage = 0,
- unsigned long* total_amortized_storage = 0,
- unsigned long* entity_storage = 0,
- unsigned long* amortized_entity_storage = 0,
- unsigned long* adjacency_storage = 0,
- unsigned long* amortized_adjacency_storage = 0,
+ unsigned long long* total_storage = 0,
+ unsigned long long* total_amortized_storage = 0,
+ unsigned long long* entity_storage = 0,
+ unsigned long long* amortized_entity_storage = 0,
+ unsigned long long* adjacency_storage = 0,
+ unsigned long long* amortized_adjacency_storage = 0,
const Tag* tag_array = 0,
unsigned num_tags = 0,
- unsigned long* tag_storage = 0,
- unsigned long* amortized_tag_storage = 0 );
+ unsigned long long* tag_storage = 0,
+ unsigned long long* amortized_tag_storage = 0 );
/**\brief Calculate amount of memory used to store MOAB data
*
@@ -1262,16 +1262,16 @@ public:
* all tags.
*/
void estimated_memory_use( const Range& ents,
- unsigned long* total_storage = 0,
- unsigned long* total_amortized_storage = 0,
- unsigned long* entity_storage = 0,
- unsigned long* amortized_entity_storage = 0,
- unsigned long* adjacency_storage = 0,
- unsigned long* amortized_adjacency_storage = 0,
+ unsigned long long* total_storage = 0,
+ unsigned long long* total_amortized_storage = 0,
+ unsigned long long* entity_storage = 0,
+ unsigned long long* amortized_entity_storage = 0,
+ unsigned long long* adjacency_storage = 0,
+ unsigned long long* amortized_adjacency_storage = 0,
const Tag* tag_array = 0,
unsigned num_tags = 0,
- unsigned long* tag_storage = 0,
- unsigned long* amortized_tag_storage = 0 );
+ unsigned long long* tag_storage = 0,
+ unsigned long long* amortized_tag_storage = 0 );
void print_database() const;
@@ -1284,16 +1284,16 @@ private:
Core& operator=( const Core& copy );
void estimated_memory_use_internal( const Range* ents,
- unsigned long* total_storage,
- unsigned long* total_amortized_storage,
- unsigned long* entity_storage,
- unsigned long* amortized_entity_storage,
- unsigned long* adjacency_storage,
- unsigned long* amortized_adjacency_storage,
+ unsigned long long* total_storage,
+ unsigned long long* total_amortized_storage,
+ unsigned long long* entity_storage,
+ unsigned long long* amortized_entity_storage,
+ unsigned long long* adjacency_storage,
+ unsigned long long* amortized_adjacency_storage,
const Tag* tag_array,
unsigned num_tags,
- unsigned long* tag_storage,
- unsigned long* amortized_tag_storage );
+ unsigned long long* tag_storage,
+ unsigned long long* amortized_tag_storage );
//! database init and de-init routines
ErrorCode initialize();
diff --git a/src/moab/Interface.hpp b/src/moab/Interface.hpp
index 09f4219..88ce232 100644
--- a/src/moab/Interface.hpp
+++ b/src/moab/Interface.hpp
@@ -1043,16 +1043,16 @@ public:
*/
virtual void estimated_memory_use( const EntityHandle* ent_array = 0,
unsigned long num_ents = 0,
- unsigned long* total_storage = 0,
- unsigned long* total_amortized_storage = 0,
- unsigned long* entity_storage = 0,
- unsigned long* amortized_entity_storage = 0,
- unsigned long* adjacency_storage = 0,
- unsigned long* amortized_adjacency_storage = 0,
+ unsigned long long* total_storage = 0,
+ unsigned long long* total_amortized_storage = 0,
+ unsigned long long* entity_storage = 0,
+ unsigned long long* amortized_entity_storage = 0,
+ unsigned long long* adjacency_storage = 0,
+ unsigned long long* amortized_adjacency_storage = 0,
const Tag* tag_array = 0,
unsigned num_tags = 0,
- unsigned long* tag_storage = 0,
- unsigned long* amortized_tag_storage = 0 ) = 0;
+ unsigned long long* tag_storage = 0,
+ unsigned long long* amortized_tag_storage = 0 ) = 0;
/**\brief Calculate amount of memory used to store MOAB data
*
@@ -1082,16 +1082,16 @@ public:
* for all tags.
*/
virtual void estimated_memory_use( const Range& ents,
- unsigned long* total_storage = 0,
- unsigned long* total_amortized_storage = 0,
- unsigned long* entity_storage = 0,
- unsigned long* amortized_entity_storage = 0,
- unsigned long* adjacency_storage = 0,
- unsigned long* amortized_adjacency_storage = 0,
+ unsigned long long* total_storage = 0,
+ unsigned long long* total_amortized_storage = 0,
+ unsigned long long* entity_storage = 0,
+ unsigned long long* amortized_entity_storage = 0,
+ unsigned long long* adjacency_storage = 0,
+ unsigned long long* amortized_adjacency_storage = 0,
const Tag* tag_array = 0,
unsigned num_tags = 0,
- unsigned long* tag_storage = 0,
- unsigned long* amortized_tag_storage = 0 ) = 0;
+ unsigned long long* tag_storage = 0,
+ unsigned long long* amortized_tag_storage = 0 ) = 0;
/**@}*/
/** \name Higher-order elements */
https://bitbucket.org/fathomteam/moab/commits/a045781af504/
Changeset: a045781af504
Branch: None
User: vijaysm
Date: 2014-07-15 00:09:20
Summary: Modifying the mbmem (memory estimator) tool to use the new API
Affected #: 1 file
diff --git a/tools/mbmem.cpp b/tools/mbmem.cpp
index a881fcd..538abca 100644
--- a/tools/mbmem.cpp
+++ b/tools/mbmem.cpp
@@ -116,14 +116,14 @@ int main( int argc, char* argv[] )
// struct to store memory stats
struct MemStats {
- unsigned long total_storage;
- unsigned long total_amortized;
- unsigned long entity_storage;
- unsigned long entity_amortized;
- unsigned long adjacency_storage;
- unsigned long adjacency_amortized;
- unsigned long tag_storage;
- unsigned long tag_amortized;
+ unsigned long long total_storage;
+ unsigned long long total_amortized;
+ unsigned long long entity_storage;
+ unsigned long long entity_amortized;
+ unsigned long long adjacency_storage;
+ unsigned long long adjacency_amortized;
+ unsigned long long tag_storage;
+ unsigned long long tag_amortized;
};
// test if MemStats object indicates no memory
@@ -136,7 +136,7 @@ static void get_mem_stats( moab::Interface& mb,
moab::EntityType type = moab::MBMAXTYPE );
// Formatted string representation of memory size value
-static std::string memstr( unsigned long val );
+static std::string memstr( unsigned long long val );
// Get string describing tag data type
static std::string tag_type_string( moab::Interface& mb, moab::Tag tag );
@@ -244,7 +244,7 @@ void print_memory_stats( moab::Interface& mb,
if (moab::MB_SUCCESS != rval || name.empty())
name = ANON_TAG_NAME;
- unsigned long occupied, allocated;
+ unsigned long long occupied, allocated;
mb.estimated_memory_use( 0, 0, 0, 0, 0, 0, 0, 0, &*ti, 1, &occupied, &allocated );
std::cout << std::left << std::setw(maxlen) << name << ' '
@@ -270,8 +270,8 @@ void print_memory_stats( moab::Interface& mb,
if (sysstats) {
std::FILE* filp = std::fopen("/proc/self/stat", "r");
- unsigned long vsize;
- long rss;
+ unsigned long long vsize;
+ long long rss;
if (filp && 2 == std::fscanf(filp,
"%*d " // pid
"%*s " // comm
@@ -295,8 +295,8 @@ void print_memory_stats( moab::Interface& mb,
"%*d " // num_threads
"%*d " // itrealvalue
"%*u " // starttime
- "%lu " // vsize
- "%ld", // rss
+ "%llu " // vsize
+ "%lld", // rss
&vsize, &rss )) {
#ifndef _MSC_VER
rss *= getpagesize();
@@ -313,7 +313,7 @@ void print_memory_stats( moab::Interface& mb,
std::cerr << "getrusage failed" << std::endl;
}
else {
- long int tmp_rss = sysdata.ru_maxrss;
+ long long int tmp_rss = sysdata.ru_maxrss;
rss *= getpagesize();
std::cerr << std::endl << "SYSTEM:"
<< std::endl << "Resident set size: " << memstr(tmp_rss)
@@ -360,17 +360,17 @@ void get_mem_stats( moab::Interface& mb,
}
// rounded division
-static unsigned long rdiv( unsigned long num, unsigned long den )
+static unsigned long long rdiv( unsigned long long num, unsigned long long den )
{
return (num + den/2) / den;
}
-std::string memstr( unsigned long val )
+std::string memstr( unsigned long long val )
{
- const unsigned long kb = 1024;
- const unsigned long mb = kb*kb;
- const unsigned long gb = kb*mb;
- const unsigned long tb = kb*gb;
+ const unsigned long long kb = 1024;
+ const unsigned long long mb = kb*kb;
+ const unsigned long long gb = kb*mb;
+ const unsigned long long tb = kb*gb;
std::ostringstream s;
if (UNITS == HUMAN) {
@@ -388,7 +388,7 @@ std::string memstr( unsigned long val )
s << "0 ";
}
else {
- unsigned long den = 1;
+ unsigned long long den = 1;
switch (UNITS) {
case BYTES: den = 1; break;
case KILOBYTES: den = kb; break;
https://bitbucket.org/fathomteam/moab/commits/990cdc89551a/
Changeset: 990cdc89551a
Branch: None
User: vijaysm
Date: 2014-07-15 00:09:20
Summary: Fixing all the tests to conform to the new long long API change
Affected #: 4 files
diff --git a/test/MBTest.cpp b/test/MBTest.cpp
index d70753f..3b6795c 100644
--- a/test/MBTest.cpp
+++ b/test/MBTest.cpp
@@ -6044,7 +6044,7 @@ ErrorCode mb_poly_adjacency_test2()
ErrorCode mb_memory_use_test()
{
Core mb;
- unsigned long init_total, total_with_elem, total_with_tag, total_with_tag_data;
+ unsigned long long init_total, total_with_elem, total_with_tag, total_with_tag_data;
mb.estimated_memory_use(0,0,0,&init_total);
double coords[12] = { 1, 2, 0, 3, 4, 0, 5, 6, 0, 7, 8, 0 };
@@ -6060,7 +6060,7 @@ ErrorCode mb_memory_use_test()
if (total_with_elem <= init_total)
return MB_FAILURE;
- unsigned long min, am;
+ unsigned long long min, am;
Range r;
r.insert( elem );
mb.estimated_memory_use( r, &min, &am );
diff --git a/test/kd_tree_time.cpp b/test/kd_tree_time.cpp
index 9c34430..ecc3024 100644
--- a/test/kd_tree_time.cpp
+++ b/test/kd_tree_time.cpp
@@ -19,7 +19,7 @@ void print_file_stats(Interface& moab)
ErrorCode rval;
int num_tri;
Range sets;
- unsigned long set_mem, set_am, tag_mem, tag_am;
+ unsigned long long set_mem, set_am, tag_mem, tag_am;
rval = moab.get_number_entities_by_type(0, MBTRI, num_tri);
if (MB_SUCCESS != rval)
@@ -31,8 +31,8 @@ void print_file_stats(Interface& moab)
moab.estimated_memory_use(sets, 0, 0, &set_mem, &set_am, 0, 0, 0, 0, &tag_mem, &tag_am);
printf("Triangles: %d\n", num_tri);
printf("Sets: %lu\n", (unsigned long)sets.size());
- printf("Set storage: %lu (%lu)\n", set_mem, set_am);
- printf("Tag storage: %lu (%lu)\n", tag_mem, tag_am);
+ printf("Set storage: %llu (%llu)\n", set_mem, set_am);
+ printf("Tag storage: %llu (%llu)\n", tag_mem, tag_am);
}
int main(int argc, char* argv[])
diff --git a/test/obb/obb_tree_tool.cpp b/test/obb/obb_tree_tool.cpp
index f6fb539..bb76d88 100644
--- a/test/obb/obb_tree_tool.cpp
+++ b/test/obb/obb_tree_tool.cpp
@@ -60,10 +60,10 @@ static void usage( bool err = true )
}
#if defined(_MSC_VER) || defined(__MINGW32__)
-static void memory_use( unsigned long& vsize, unsigned long& rss )
+static void memory_use( unsigned long long& vsize, unsigned long long& rss )
{ vsize = rss = 0; }
#else
-static void memory_use( unsigned long& vsize, unsigned long& rss )
+static void memory_use( unsigned long long& vsize, unsigned long long& rss )
{
char buffer[512];
int filp = open( "/proc/self/stat", O_RDONLY );
@@ -80,7 +80,7 @@ static void memory_use( unsigned long& vsize, unsigned long& rss )
"%*u %*u %*d %*d " // utime stime cutime cstime
"%*d %*d %*d " // priority nice (unused)
"%*d %*u " // itrealval starttime
- "%lu %lu", &vsize, &rss );
+ "%llu %llu", &vsize, &rss );
rss *= getpagesize();
}
#endif
@@ -374,7 +374,7 @@ void print_stats( Interface* interface )
interface->get_entities_by_type( 0, MBVERTEX, verts );
triangles.merge( verts );
tree_sets.insert( root );
- unsigned long set_used, set_amortized, set_store_used, set_store_amortized,
+ unsigned long long set_used, set_amortized, set_store_used, set_store_amortized,
set_tag_used, set_tag_amortized, tri_used, tri_amortized;
interface->estimated_memory_use( tree_sets,
&set_used, &set_amortized,
@@ -388,7 +388,7 @@ void print_stats( Interface* interface )
tool.stats( root, std::cout );
- unsigned long real_rss, real_vsize;
+ unsigned long long real_rss, real_vsize;
memory_use( real_vsize, real_rss );
printf("------------------------------------------------------------------\n");
diff --git a/test/perf/point_location/point_location.cpp b/test/perf/point_location/point_location.cpp
index 4f5ddcc..39fde21 100644
--- a/test/perf/point_location/point_location.cpp
+++ b/test/perf/point_location/point_location.cpp
@@ -143,7 +143,7 @@ int main( int argc, char* argv[] )
// GET MEMORY USE BEFORE BUILDING TREE
- unsigned long init_total_storage;
+ unsigned long long init_total_storage;
mb.estimated_memory_use( 0, 0, &init_total_storage );
// RUN TIMING TEST
@@ -159,7 +159,7 @@ int main( int argc, char* argv[] )
break;
}
- unsigned long fini_total_storage;
+ unsigned long long fini_total_storage;
mb.estimated_memory_use( 0, 0, &fini_total_storage );
// VALIDATE RESULTS
https://bitbucket.org/fathomteam/moab/commits/b263db0d99a9/
Changeset: b263db0d99a9
Branch: None
User: vijaysm
Date: 2014-07-15 00:09:20
Summary: Updating the DagMC test to conform to API change.
Affected #: 1 file
diff --git a/tools/dagmc/ray_fire_test.cc b/tools/dagmc/ray_fire_test.cc
index cc73a38..e7496af 100644
--- a/tools/dagmc/ray_fire_test.cc
+++ b/tools/dagmc/ray_fire_test.cc
@@ -500,9 +500,9 @@ void write_obbtree_histogram( EntityHandle root, OrientedBoxTreeTool& tree, std:
}
-void moab_memory_estimates( Interface* mbi, int& moab_data_bytes, int& moab_alldata_est_bytes ){
+void moab_memory_estimates( Interface* mbi, unsigned long long& moab_data_bytes, unsigned long long& moab_alldata_est_bytes ){
- unsigned long storage, amortized_storage;
+ unsigned long long storage, amortized_storage;
mbi->estimated_memory_use( NULL, 0, &storage, &amortized_storage );
moab_data_bytes = storage;
@@ -550,7 +550,7 @@ void dump_pyfile( char* filename, double timewith, double timewithout, double tm
DICT_VAL(timewith-timewithout);
}
DICT_VAL(tmem);
- int moab_data_bytes, moab_alldata_est_bytes;
+ unsigned long long moab_data_bytes, moab_alldata_est_bytes;
moab_memory_estimates( dagmc.moab_instance(), moab_data_bytes, moab_alldata_est_bytes );
DICT_VAL( moab_data_bytes );
DICT_VAL( moab_alldata_est_bytes );
https://bitbucket.org/fathomteam/moab/commits/096ca89f28ef/
Changeset: 096ca89f28ef
Branch: vijaysm/memory_api_llu
User: vijaysm
Date: 2014-07-15 02:05:09
Summary: Conform to the correct data type when reading from file for vsize and rss (ref: http://man7.org/linux/man-pages/man5/proc.5.html ::# /proc/[pid]/stat)
Affected #: 2 files
diff --git a/test/obb/obb_tree_tool.cpp b/test/obb/obb_tree_tool.cpp
index bb76d88..1d59bbc 100644
--- a/test/obb/obb_tree_tool.cpp
+++ b/test/obb/obb_tree_tool.cpp
@@ -66,11 +66,13 @@ static void memory_use( unsigned long long& vsize, unsigned long long& rss )
static void memory_use( unsigned long long& vsize, unsigned long long& rss )
{
char buffer[512];
+ unsigned long lvsize;
+ long lrss;
int filp = open( "/proc/self/stat", O_RDONLY );
ssize_t r = read( filp, buffer, sizeof(buffer)-1 );
close( filp );
if (r < 0) r = 0;
- vsize = rss = 0;
+ lvsize = lrss = 0;
buffer[r] = '\0';
sscanf( buffer, "%*d %*s %*c " // pid command state
"%*d %*d " // ppid pgrp
@@ -80,8 +82,9 @@ static void memory_use( unsigned long long& vsize, unsigned long long& rss )
"%*u %*u %*d %*d " // utime stime cutime cstime
"%*d %*d %*d " // priority nice (unused)
"%*d %*u " // itrealval starttime
- "%llu %llu", &vsize, &rss );
- rss *= getpagesize();
+ "%lu %ld", &lvsize, &lrss );
+ rss = lrss*getpagesize();
+ vsize = lvsize;
}
#endif
diff --git a/tools/mbmem.cpp b/tools/mbmem.cpp
index 538abca..d49cdc1 100644
--- a/tools/mbmem.cpp
+++ b/tools/mbmem.cpp
@@ -271,7 +271,7 @@ void print_memory_stats( moab::Interface& mb,
if (sysstats) {
std::FILE* filp = std::fopen("/proc/self/stat", "r");
unsigned long long vsize;
- long long rss;
+ long rss;
if (filp && 2 == std::fscanf(filp,
"%*d " // pid
"%*s " // comm
@@ -296,14 +296,14 @@ void print_memory_stats( moab::Interface& mb,
"%*d " // itrealvalue
"%*u " // starttime
"%llu " // vsize
- "%lld", // rss
+ "%ld", // rss
&vsize, &rss )) {
#ifndef _MSC_VER
- rss *= getpagesize();
+ long long tmprss = rss * getpagesize();
#endif
std::cout << std::endl << "SYSTEM:"
<< std::endl << "Virtual memory: " << memstr(vsize)
- << std::endl << "Resident set size: " << memstr(rss)
+ << std::endl << "Resident set size: " << memstr(tmprss)
<< std::endl;
}
else {
@@ -313,10 +313,10 @@ void print_memory_stats( moab::Interface& mb,
std::cerr << "getrusage failed" << std::endl;
}
else {
- long long int tmp_rss = sysdata.ru_maxrss;
- rss *= getpagesize();
+ rss = sysdata.ru_maxrss;
+ long long tmprss = rss * getpagesize();
std::cerr << std::endl << "SYSTEM:"
- << std::endl << "Resident set size: " << memstr(tmp_rss)
+ << std::endl << "Resident set size: " << memstr(tmprss)
<< std::endl;
}
#endif
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list