gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Sandro Santilli
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-352-ga0e8aa9
Date: Thu, 19 May 2011 13:47:20 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  a0e8aa9e0ada082837a7143f126dc40414736991 (commit)
      from  ae88d8572b8bf2e57700aa43c10a2219ded95e69 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=a0e8aa9e0ada082837a7143f126dc40414736991


commit a0e8aa9e0ada082837a7143f126dc40414736991
Author: Sandro Santilli <address@hidden>
Date:   Thu May 19 15:46:30 2011 +0200

    Use number of milliseconds since start as the log timestamp.

diff --git a/libbase/log.cpp b/libbase/log.cpp
index d519f09..a12124d 100644
--- a/libbase/log.cpp
+++ b/libbase/log.cpp
@@ -34,6 +34,7 @@
 #include <unistd.h> // for getpid
 
 #include "GnashAlgorithm.h"
+#include "ClockTime.h"
 
 using std::cout;
 using std::endl;
@@ -76,31 +77,6 @@ hexify(const unsigned char *p, size_t length, bool ascii)
 
 }
 
-std::ostream&
-timestamp(std::ostream& o)
-{
-
-    const char fmt[] = "%H:%M:%S";
-
-    time_t t;
-    char buf[sizeof fmt];
-
-    std::time(&t);
-    std::strftime(buf, sizeof buf, fmt, std::localtime(&t));
-
-    static std::map<int, int> threadMap;
-    int tid = get_thread_id();
-    int& htid = threadMap[tid];
-    if (!htid) {
-        htid = threadMap.size();
-        // TODO: notify actual thread id for index
-    }
-
-    o << getpid() << ":" << htid << "] " << buf;
-    return o;
-
-}
-
 LogFile&
 LogFile::getDefaultInstance()
 {
@@ -108,8 +84,36 @@ LogFile::getDefaultInstance()
     return o;
 }
 
+
 namespace {
+
     LogFile& dbglogfile = LogFile::getDefaultInstance();
+
+    struct Timestamp {
+        boost::uint64_t startTicks;
+        std::map<int, int> threadMap;
+        Timestamp() : startTicks(clocktime::getTicks()) {}
+    };
+
+    std::ostream& operator<< (std::ostream& o, Timestamp& t)
+    {
+        int tid = get_thread_id();
+        int& htid = t.threadMap[tid];
+        if (!htid) {
+            htid = t.threadMap.size();
+            // TODO: notify actual thread id for index
+        }
+
+        boost::uint64_t diff = clocktime::getTicks() - t.startTicks;
+        // should we split in seconds/ms ?
+        o << getpid() << ":" << htid << "] " << diff;
+
+        return o;
+
+    }
+
+    Timestamp timestamp;
+
 }
 
 // boost format functions to process the objects

-----------------------------------------------------------------------

Summary of changes:
 libbase/log.cpp |   54 +++++++++++++++++++++++++++++-------------------------
 1 files changed, 29 insertions(+), 25 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]