Disable memory reporting for non-GNU C++ libraries.
authorPeter Griess <pgriess@fb.com>
Mon, 23 Sep 2013 21:44:57 +0000 (16:44 -0500)
committerPeter Griess <pgriess@fb.com>
Tue, 15 Oct 2013 01:46:30 +0000 (18:46 -0700)
Summary:
- Non-GNU standard C++ libraries may have a different layout; only
report memory usage when we know we're using GNU's.

Test Plan:
- fbconfig -r folly && fbmake runtests
- ./configure && make check on Ubuntu/FC/Mac

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D998584

folly/test/ConcurrentSkipListBenchmark.cpp

index 0eac9be1f5321ac99778350c71108c6c1dd62fad..c05bda736c3526dfcb95481ab58fd324e2af0c13 100644 (file)
@@ -350,6 +350,9 @@ class ConcurrentAccessData {
       if (i > 0) sets_[i] = sets_[0];
     }
 
+// This requires knowledge of the C++ library internals. Only use it if we're
+// using the GNU C++ library.
+#ifdef _GLIBCXX_SYMVER
     // memory usage
     int64_t setMemorySize = sets_[0].size() * sizeof(*sets_[0].begin()._M_node);
     int64_t cslMemorySize = 0;
@@ -360,6 +363,7 @@ class ConcurrentAccessData {
     LOG(INFO) << "size=" << sets_[0].size()
       << "; std::set memory size=" << setMemorySize
       << "; csl memory size=" << cslMemorySize;
+#endif
 
     readValues_.reserve(size);
     deleteValues_.reserve(size);