* configure.ac (AC_CHECK_HEADERS): Added time.h.
authortwisti <none@none>
Fri, 11 May 2007 22:33:15 +0000 (22:33 +0000)
committertwisti <none@none>
Fri, 11 May 2007 22:33:15 +0000 (22:33 +0000)
(AC_CHECK_FUNCS): Added localtime, localtime_r, time.

* src/vmcore/statistics.c [HAVE_TIME_H] (time.h): Added.
(statistics_print_date): New function.
* src/vmcore/statistics.h (statistics_print_date): Added.

* src/mm/memory.c (memory_thread) [ENABLE_STATISTICS]: Call
statistics_print_date.

configure.ac
src/mm/memory.c
src/vmcore/statistics.c
src/vmcore/statistics.h

index 884ab6766c09ecfff40534e15bab38eb35455675..62b76eb92258b3241ffa17c9e805271b2cfbeb15 100644 (file)
@@ -22,7 +22,7 @@ dnl along with this program; if not, write to the Free Software
 dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 dnl 02110-1301, USA.
 dnl 
-dnl $Id: configure.ac 7887 2007-05-08 13:03:07Z twisti $
+dnl $Id: configure.ac 7902 2007-05-11 22:33:15Z twisti $
 
 dnl Process this file with autoconf to produce a configure script.
 
@@ -216,6 +216,7 @@ AC_HEADER_STDC
 dnl keep them alpha-sorted!
 AC_CHECK_HEADERS([fcntl.h])
 AC_CHECK_HEADERS([string.h])
+AC_CHECK_HEADERS([time.h])
 AC_CHECK_HEADERS([unistd.h])
 AC_CHECK_HEADERS([sys/ioctl.h])
 AC_CHECK_HEADERS([sys/mman.h])
@@ -255,10 +256,13 @@ AC_CHECK_FUNCS([getcwd])
 AC_CHECK_FUNCS([gettimeofday])
 AC_CHECK_FUNCS([getrusage])
 AC_CHECK_FUNCS([isnan])
+AC_CHECK_FUNCS([localtime])
+AC_CHECK_FUNCS([localtime_r])
 AC_CHECK_FUNCS([mmap])
 AC_CHECK_FUNCS([mprotect])
 AC_CHECK_FUNCS([scandir])
 AC_CHECK_FUNCS([strdup])
+AC_CHECK_FUNCS([time])
 
 
 dnl Checks for libraries.
index bd864f8b7d98ba063a513125ecbd1f6aca6b9b0b..1b8839fb7a59b87cd348a0c939751ca6f8c51c7d 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: memory.c 7831 2007-04-26 12:48:16Z twisti $
+   $Id: memory.c 7902 2007-05-11 22:33:15Z twisti $
 
 */
 
@@ -378,6 +378,10 @@ static void memory_thread(void)
                threads_sleep(2 * 1000, 0);
 
 # if defined(ENABLE_STATISTICS)
+               /* print current date and time */
+
+               statistics_print_date();
+
                /* print memory usage */
 
                statistics_print_memory_usage();
index cab3c79a21ee279e74a77aeef72d24849e7d2eb5..27645d5f3c8c9275d5b137bc58d49440d57a96df 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: statistics.c 7901 2007-05-11 21:18:51Z twisti $
+   $Id: statistics.c 7902 2007-05-11 22:33:15Z twisti $
 
 */
 
 
 #include <string.h> 
 
+#if defined(HAVE_TIME_H)
+# include <time.h>
+#endif
+
 #if defined(HAVE_SYS_TIME_H)
 # include <sys/time.h>
 #endif
@@ -601,6 +605,35 @@ void print_stats(void)
 }
 
 
+/* statistics_print_date *******************************************************
+
+   Print current date and time.
+
+*******************************************************************************/
+
+void statistics_print_date(void)
+{
+  time_t t;
+  struct tm tm;
+
+#if defined(HAVE_TIME)
+  time(&t);
+#else
+# error !HAVE_TIME
+#endif
+
+#if defined(HAVE_LOCALTIME_R)
+  localtime_r(&t, &tm);
+#else
+# error !HAVE_LOCALTIME_R
+#endif
+
+  log_println("%d-%02d-%02d %02d:%02d:%02d",
+                         1900 + tm.tm_year, tm.tm_mon + 1, tm.tm_mday,
+                         tm.tm_hour, tm.tm_min, tm.tm_sec);
+}
+
+
 /* statistics_print_memory_usage ***********************************************
 
    Print current memory usage.
index e26da7172391c4a1e6540b763e7927f20e4ef017..01c503469b8e3744bc99fbcf4c27c8418eb36d72 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: statistics.h 7899 2007-05-11 19:31:04Z twisti $
+   $Id: statistics.h 7902 2007-05-11 22:33:15Z twisti $
 
 */
 
@@ -219,6 +219,7 @@ void compilingtime_stop(void);
 void print_times(void);
 void print_stats(void);
 
+void statistics_print_date(void);
 void statistics_print_memory_usage(void);
 void statistics_print_gc_memory_usage(void);