Commit 6d93f2ce authored by Federico Mena Quintero's avatar Federico Mena Quintero Committed by Federico Mena Quintero

Print user and system time on each checkpoint

Signed-off-by: 's avatarFederico Mena Quintero <federico@gnu.org>

svn path=/trunk/; revision=407
parent 24c8587b
......@@ -9,6 +9,7 @@
#include <unistd.h>
#include <time.h>
#include <sys/stat.h>
#include <sys/resource.h>
#include <sys/time.h>
#include <gconf/gconf-value.h>
#include <libgnome/gnome-url.h>
......@@ -617,6 +618,7 @@ libslab_checkpoint (const char *format, ...)
va_list args;
struct timeval tv;
struct tm tm;
struct rusage rusage;
if (!checkpoint_file)
return;
......@@ -624,12 +626,18 @@ libslab_checkpoint (const char *format, ...)
gettimeofday (&tv, NULL);
tm = *localtime (&tv.tv_sec);
getrusage (RUSAGE_SELF, &rusage);
fprintf (checkpoint_file,
"%02d:%02d:%02d.%04d - ",
tm.tm_hour,
tm.tm_min,
tm.tm_sec,
(int) (tv.tv_usec / 100));
"%02d:%02d:%02d.%04d (user:%d.%04d, sys:%d.%04d) - ",
(int) tm.tm_hour,
(int) tm.tm_min,
(int) tm.tm_sec,
(int) (tv.tv_usec / 100),
(int) rusage.ru_utime.tv_sec,
(int) (rusage.ru_utime.tv_usec / 100),
(int) rusage.ru_stime.tv_sec,
(int) (rusage.ru_stime.tv_usec / 100));
va_start (args, format);
vfprintf (checkpoint_file, format, args);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment