]> https://gitweb.dealii.org/ - dealii.git/commitdiff
LogStream: Remove timestamp machinery and memory_consumption
authorMatthias Maier <tamiko@43-1.org>
Sun, 13 Aug 2017 21:41:11 +0000 (16:41 -0500)
committerMatthias Maier <tamiko@43-1.org>
Sun, 13 Aug 2017 21:41:11 +0000 (16:41 -0500)
cmake/checks/check_02_system_features.cmake
include/deal.II/base/config.h.in
include/deal.II/base/logstream.h
source/base/logstream.cc

index caaa3f0824c5bdfe4178778e1c503db010f55318..ac41f12f74e57361b1b560a0999ebce7b8246360 100644 (file)
@@ -21,9 +21,7 @@
 #   DEAL_II_HAVE_JN
 #   DEAL_II_HAVE_SYS_RESOURCE_H
 #   DEAL_II_HAVE_SYS_TIME_H
-#   DEAL_II_HAVE_SYS_TIMES_H
 #   DEAL_II_HAVE_SYS_TYPES_H
-#   DEAL_II_HAVE_TIMES
 #   DEAL_II_HAVE_UNISTD_H
 #   DEAL_II_MSVC
 #
@@ -42,9 +40,6 @@ CHECK_INCLUDE_FILE_CXX("sys/resource.h" DEAL_II_HAVE_SYS_RESOURCE_H)
 
 CHECK_INCLUDE_FILE_CXX("sys/time.h" DEAL_II_HAVE_SYS_TIME_H)
 
-CHECK_INCLUDE_FILE_CXX("sys/times.h" DEAL_II_HAVE_SYS_TIMES_H)
-CHECK_CXX_SYMBOL_EXISTS("times" "sys/times.h" DEAL_II_HAVE_TIMES)
-
 CHECK_INCLUDE_FILE_CXX("sys/types.h" DEAL_II_HAVE_SYS_TYPES_H)
 
 CHECK_INCLUDE_FILE_CXX("unistd.h" DEAL_II_HAVE_UNISTD_H)
index 4e84a3388888b1839878f60fefeffb675f15dc1a..7319dc1285101de8f792beb8978edca858a63ed8 100644 (file)
 
 #cmakedefine DEAL_II_HAVE_SYS_RESOURCE_H
 #cmakedefine DEAL_II_HAVE_SYS_TIME_H
-#cmakedefine DEAL_II_HAVE_SYS_TIMES_H
 #cmakedefine DEAL_II_HAVE_SYS_TYPES_H
 #cmakedefine DEAL_II_HAVE_UNISTD_H
 #cmakedefine DEAL_II_HAVE_GETHOSTNAME
 #cmakedefine DEAL_II_HAVE_GETPID
-#cmakedefine DEAL_II_HAVE_TIMES
 #cmakedefine DEAL_II_HAVE_JN
 
 #cmakedefine DEAL_II_MSVC
index 6a8d04bd84a981cd60e16709217f5981258087a2..0724eb443a966c30a7505fa61fe827793056905f 100644 (file)
 #include <sstream>
 #include <memory>
 
-#ifdef DEAL_II_HAVE_SYS_TIMES_H
-#  include <sys/times.h>
-#else
-struct tms
-{
-  int tms_utime, tms_stime, tms_cutime, tms_cstime;
-};
-#endif
-
 
 DEAL_II_NAMESPACE_OPEN
 
@@ -226,36 +217,6 @@ public:
   unsigned int depth_file (const unsigned int n);
 
 
-  /**
-   * Set time printing flag. If this flag is true, each output line will be
-   * prepended by the user time used by the running program so far.
-   *
-   * The previous value of this parameter is returned.
-   */
-  bool log_execution_time (const bool flag);
-
-
-  /**
-   * Output time differences between consecutive logs. If this function is
-   * invoked with <tt>true</tt>, the time difference between the previous log
-   * line and the recent one is printed. If it is invoked with <tt>false</tt>,
-   * the accumulated time since start of the program is printed (default
-   * behavior).
-   *
-   * The measurement of times is not changed by this function, just the
-   * output.
-   *
-   * The previous value of this parameter is returned.
-   */
-  bool log_time_differences (const bool flag);
-
-
-  /**
-   * Write detailed timing information.
-   */
-  void timestamp();
-
-
   /**
    * Log the thread id.
    */
@@ -356,44 +317,18 @@ private:
    */
   unsigned int file_depth;
 
-  /**
-   * Flag for printing execution time.
-   */
-  bool print_utime;
-
-  /**
-   * Flag for printing time differences.
-   */
-  bool diff_utime;
-
-  /**
-   * Time of last output line.
-   */
-  double last_time;
-
   /**
    * Flag for printing thread id.
    */
   bool print_thread_id;
 
-  /**
-   * The value times() returned on initialization.
-   */
-  double reference_time_val;
-
-  /**
-   * The tms structure times() filled on initialization.
-   */
-  struct tms reference_tms;
-
   /**
    * A flag indicating whether output is currently at a new line
    */
   bool at_newline;
 
   /**
-   * Print head of line. This prints optional time information and the
-   * contents of the prefix stack.
+   * Print head of line.
    */
   void print_line_head ();
 
index 94ebc8f78c6cf1f9518858f1a28f504587c2071f..de9757600dcb4b2fe27ddfe662e029355606c9e7 100644 (file)
 
 #include <deal.II/base/logstream.h>
 #include <deal.II/base/job_identifier.h>
-#include <deal.II/base/memory_consumption.h>
 #include <deal.II/base/thread_management.h>
 
-#ifdef DEAL_II_HAVE_SYS_RESOURCE_H
-#  include <sys/resource.h>
-#endif
-
-#ifdef DEAL_II_HAVE_UNISTD_H
-#  include <unistd.h>
-#endif
-
 #include <iostream>
 #include <iomanip>
 #include <fstream>
@@ -51,18 +42,10 @@ LogStream::LogStream()
   file(nullptr),
   std_depth(0),
   file_depth(10000),
-  print_utime(false),
-  diff_utime(false),
-  last_time (0.),
   print_thread_id(false),
   at_newline(true)
 {
   get_prefixes().push("DEAL:");
-
-#if defined(DEAL_II_HAVE_UNISTD_H) && defined(DEAL_II_HAVE_TIMES)
-  reference_time_val = 1./sysconf(_SC_CLK_TCK) * times(&reference_tms);
-#endif
-
 }
 
 
@@ -307,26 +290,6 @@ LogStream::depth_file (const unsigned int n)
 }
 
 
-bool
-LogStream::log_execution_time (const bool flag)
-{
-  Threads::Mutex::ScopedLock lock(log_lock);
-  const bool h = print_utime;
-  print_utime = flag;
-  return h;
-}
-
-
-bool
-LogStream::log_time_differences (const bool flag)
-{
-  Threads::Mutex::ScopedLock lock(log_lock);
-  const bool h = diff_utime;
-  diff_utime = flag;
-  return h;
-}
-
-
 bool
 LogStream::log_thread_id (const bool flag)
 {
@@ -372,36 +335,11 @@ LogStream::get_prefixes() const
 void
 LogStream::print_line_head()
 {
-#ifdef DEAL_II_HAVE_SYS_RESOURCE_H
-  rusage usage;
-  double utime = 0.;
-  if (print_utime)
-    {
-      getrusage(RUSAGE_SELF, &usage);
-      utime = usage.ru_utime.tv_sec + 1.e-6 * usage.ru_utime.tv_usec;
-      if (diff_utime)
-        {
-          double diff = utime - last_time;
-          last_time = utime;
-          utime = diff;
-        }
-    }
-#else
-//TODO[BG]: Do something useful here
-  double utime = 0.;
-#endif
-
   const std::string &head = get_prefix();
   const unsigned int thread = Threads::this_thread_id();
 
   if (get_prefixes().size() <= std_depth)
     {
-      if (print_utime)
-        {
-          int p = std_out->width(5);
-          *std_out << utime << ':';
-          std_out->width(p);
-        }
       if (print_thread_id)
         *std_out << '[' << thread << ']';
 
@@ -411,12 +349,6 @@ LogStream::print_line_head()
 
   if (file && (get_prefixes().size() <= file_depth))
     {
-      if (print_utime)
-        {
-          int p = file->width(6);
-          *file << utime << ':';
-          file->width(p);
-        }
       if (print_thread_id)
         *file << '[' << thread << ']';
 
@@ -425,50 +357,4 @@ LogStream::print_line_head()
     }
 }
 
-
-void
-LogStream::timestamp ()
-{
-  struct tms current_tms;
-#if defined(DEAL_II_HAVE_UNISTD_H) && defined(DEAL_II_HAVE_TIMES)
-  const clock_t tick = sysconf(_SC_CLK_TCK);
-  const double time = 1./tick * times(&current_tms);
-#else
-  const double time = 0.;
-  const unsigned int tick = 100;
-  current_tms.tms_utime = 0;
-  current_tms.tms_stime = 0;
-  current_tms.tms_cutime = 0;
-  current_tms.tms_cstime = 0;
-#endif
-  (*this) << "Wall: " << time - reference_time_val
-          << " User: " << 1./tick * (current_tms.tms_utime - reference_tms.tms_utime)
-          << " System: " << 1./tick * (current_tms.tms_stime - reference_tms.tms_stime)
-          << " Child-User: " << 1./tick * (current_tms.tms_cutime - reference_tms.tms_cutime)
-          << " Child-System: " << 1./tick * (current_tms.tms_cstime - reference_tms.tms_cstime)
-          << std::endl;
-}
-
-
-std::size_t
-LogStream::memory_consumption () const
-{
-  // TODO
-  Assert(false, ExcNotImplemented());
-
-  std::size_t mem = sizeof(*this);
-  // to determine size of stack
-  // elements, we have to copy the
-  // stack since we can't access
-  // elements from further below
-//   std::stack<std::string> tmp = prefixes;
-//   while (tmp.empty() == false)
-//     {
-//       mem += MemoryConsumption::memory_consumption (tmp.top());
-//       tmp.pop ();
-//     }
-
-  return mem;
-}
-
 DEAL_II_NAMESPACE_CLOSE

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.