]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
memory_consumption
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 Dec 2003 14:52:43 +0000 (14:52 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 Dec 2003 14:52:43 +0000 (14:52 +0000)
git-svn-id: https://svn.dealii.org/trunk@8244 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/vector_memory.h

index 7691c1d8e7b92d81696deb3305937db73beb407f..147f576c808f844b55223addf8eed3d8b1cb0685 100644 (file)
@@ -172,6 +172,13 @@ class GrowingVectorMemory : public VectorMemory<VECTOR>
                                      */
     unsigned int n_alloc;
 
+                                    /**
+                                     * Memory consumed by this class
+                                     * and all currently allocated
+                                     * vectors.
+                                     */
+    unsigned int memory_consumption() const;
+    
                                     /**
                                      * Mutex to synchronise access to
                                      * internal data of this object
@@ -277,4 +284,16 @@ GrowingVectorMemory<VECTOR>::free(const VECTOR* const v)
 }
 
 
+template<typename VECTOR>
+unsigned int
+GrowingVectorMemory<VECTOR>::memory_consumption () const
+{
+  unsigned int result = sizeof (*this);
+  const typename std::vector<entry_type>::const_iterator
+    end = pool.end();
+  for (typename std::vector<entry_type>::const_iterator i = pool.begin()
+                                                    ; i != end ; ++i)
+    result += i->memory_consumption();
+}
+
 #endif

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.