From 1373676764de5eef89e626987a20da4c7898e541 Mon Sep 17 00:00:00 2001 From: Guido Kanschat Date: Thu, 31 May 2001 06:19:40 +0000 Subject: [PATCH] preliminary memory check git-svn-id: https://svn.dealii.org/trunk@4737 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/base/source/log.cc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/deal.II/base/source/log.cc b/deal.II/base/source/log.cc index 351e30696a..57304c984b 100644 --- a/deal.II/base/source/log.cc +++ b/deal.II/base/source/log.cc @@ -17,7 +17,11 @@ #include #include +#include +#include #include +#include +#include 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 << ':'; -- 2.39.5