]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
preliminary memory check
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 31 May 2001 06:19:40 +0000 (06:19 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Thu, 31 May 2001 06:19:40 +0000 (06:19 +0000)
git-svn-id: https://svn.dealii.org/trunk@4737 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/base/source/log.cc

index 351e30696a0b0f7189ef8347369d9d82838d4924..57304c984b4ce418dec95632c800dead25ecba7c 100644 (file)
 #include <base/memory_consumption.h>
 
 #include <sys/resource.h>
+#include <sys/types.h>
+#include <unistd.h>
 #include <iomanip>
+#include <fstream>
+#include <strstream>
 
 LogStream deallog;
 
@@ -131,6 +135,18 @@ LogStream::print_line_head()
          utime = diff;
        }
     }
+
+  static const pid_t id = getpid();
+  std::ostrstream statname;
+  statname << "/proc/" << id << "/stat" << std::ends;
+  static long size;
+  static string dummy;
+  ifstream stat(statname.str());
+                                  // ignore 22 values
+  stat >> dummy >> dummy >> dummy >> dummy >> dummy >> dummy >>
+    dummy >> dummy >> dummy >> dummy >> dummy >>
+    dummy >> dummy >> dummy >> dummy >> dummy >> dummy >>
+    dummy >> dummy >> dummy >> dummy >> dummy >> size;
   
   const std::string& head = get_prefix();
 
@@ -140,6 +156,9 @@ LogStream::print_line_head()
        {
          int p = std_out->width(5);
          *std_out << utime << ':';
+         std_out->width(16);
+         *std_out << size << ':';
+         
          std_out->width(p);
        }
       *std_out <<  head << ':';
@@ -151,6 +170,8 @@ LogStream::print_line_head()
        {
          int p = file->width(6);
          *file << utime << ':';
+         file->width(16);
+         *file << size << ':';
          file->width(p);
        }  
       *file << head << ':';

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.