Index: /trunk/include/iprt/log.h
===================================================================
--- /trunk/include/iprt/log.h	(revision 6514)
+++ /trunk/include/iprt/log.h	(revision 6515)
@@ -287,7 +287,9 @@
     RTLOGFLAGS_USECRLF          = 0x00000010,
     /** Show relative timestamps with PREFIX_TSC and PREFIX_TS */
-    RTLOGFLAGS_REL_TS           = 0x00010000,
+    RTLOGFLAGS_REL_TS           = 0x00008000,
     /** Show decimal timestamps with PREFIX_TSC and PREFIX_TS */
-    RTLOGFLAGS_DECIMAL_TS       = 0x00020000,
+    RTLOGFLAGS_DECIMAL_TS       = 0x00010000,
+    /** New lines should be prefixed with the native process id. */
+    RTLOGFLAGS_PREFIX_PID       = 0x00020000,
     /** New lines should be prefixed with group flag number causing the output. */
     RTLOGFLAGS_PREFIX_FLAG_NO   = 0x00040000,
Index: /trunk/src/VBox/Runtime/VBox/log-vbox.cpp
===================================================================
--- /trunk/src/VBox/Runtime/VBox/log-vbox.cpp	(revision 6514)
+++ /trunk/src/VBox/Runtime/VBox/log-vbox.cpp	(revision 6515)
@@ -390,9 +390,9 @@
          */
 # if defined(DEBUG_bird) && !defined(IN_GUEST)
-        //RTLogGroupSettings(pLogger, "all=~0");
-        //RTLogFlags(pLogger, "enabled unbuffered");
-        RTLogGroupSettings(pLogger, "-all");
-        RTLogFlags(pLogger, "disabled unbuffered");
-        pLogger->fDestFlags |= /*RTLOGDEST_DEBUGGER |*/ RTLOGDEST_COM;
+        RTLogGroupSettings(pLogger, "all=~0");
+        RTLogFlags(pLogger, "enabled unbuffered pid");
+        //RTLogGroupSettings(pLogger, "-all");
+        //RTLogFlags(pLogger, "disabled unbuffered");
+        pLogger->fDestFlags |= RTLOGDEST_DEBUGGER;/* | RTLOGDEST_COM;*/
 # endif
 # if defined(DEBUG_sandervl) && !defined(IN_GUEST)
Index: /trunk/src/VBox/Runtime/common/log/log.cpp
===================================================================
--- /trunk/src/VBox/Runtime/common/log/log.cpp	(revision 6514)
+++ /trunk/src/VBox/Runtime/common/log/log.cpp	(revision 6515)
@@ -32,9 +32,9 @@
 #ifndef IN_GC
 # include <iprt/alloc.h>
+# include <iprt/process.h>
+# include <iprt/semaphore.h>
 # include <iprt/thread.h>
-# include <iprt/semaphore.h>
 #endif
 #ifdef IN_RING3
-# include <iprt/process.h>
 # include <iprt/file.h>
 # include <iprt/path.h>
@@ -1196,4 +1196,5 @@
             { "dec",          sizeof("dec"         ) - 1,   RTLOGFLAGS_DECIMAL_TS,          false },
             { "hex",          sizeof("hex"         ) - 1,   RTLOGFLAGS_DECIMAL_TS,          true  },
+            { "pid",          sizeof("pid"         ) - 1,   RTLOGFLAGS_PREFIX_PID,          false },
             { "flagno",       sizeof("flagno"      ) - 1,   RTLOGFLAGS_PREFIX_FLAG_NO,      false },
             { "flag",         sizeof("flag"        ) - 1,   RTLOGFLAGS_PREFIX_FLAG,         false },
@@ -1870,7 +1871,7 @@
                 /*
                  * Flush the buffer if there isn't enough room for the maximum prefix config.
-                 * Max is 124, add a couple of extra bytes.
+                 * Max is 198, add a couple of extra bytes.
                  */
-                if (cb < 128 + 18 + 22)
+                if (cb < 198 + 16)
                 {
                     rtlogFlush(pLogger);
@@ -1899,5 +1900,5 @@
                     if (pLogger->fFlags & RTLOGFLAGS_REL_TS)
                     {
-                        static uint64_t s_u64LastTs;
+                        static volatile uint64_t s_u64LastTs;
                         uint64_t        u64DiffTs = u64 - s_u64LastTs;
                         s_u64LastTs = u64;
@@ -1908,5 +1909,5 @@
                     }
                     /* 1E15 nanoseconds = 11 days */
-                    psz += RTStrFormatNumber(psz, u64, iBase, 16, 0, fFlags);
+                    psz += RTStrFormatNumber(psz, u64, iBase, 16, 0, fFlags);                       /* +17 */
                     *psz++ = ' ';
                 }
@@ -1923,5 +1924,5 @@
                     if (pLogger->fFlags & RTLOGFLAGS_REL_TS)
                     {
-                        static uint64_t s_u64LastTsc;
+                        static volatile uint64_t s_u64LastTsc;
                         uint64_t        u64DiffTsc = u64 - s_u64LastTsc;
                         s_u64LastTsc = u64;
@@ -1932,5 +1933,5 @@
                     }
                     /* 1E15 ticks at 4GHz = 69 hours */
-                    psz += RTStrFormatNumber(psz, u64, iBase, 16, 0, fFlags);
+                    psz += RTStrFormatNumber(psz, u64, iBase, 16, 0, fFlags);                       /* +17 */
                     *psz++ = ' ';
                 }
@@ -1959,5 +1960,5 @@
                     *psz++ = '.';
                     psz += RTStrFormatNumber(psz, Time.u32Nanosecond / 1000000, 10, 3, 0, RTSTR_F_ZEROPAD);
-                    *psz++ = ' ';
+                    *psz++ = ' ';                                                                   /* +17 (3+1+3+1+3+1+4+1) */
 #else
                     memset(psz, ' ', 13);
@@ -1978,5 +1979,5 @@
                     *psz++ = '.';
                     psz += RTStrFormatNumber(psz, u32 % 1000, 10, 3, 0, RTSTR_F_ZEROPAD);
-                    *psz++ = ' ';
+                    *psz++ = ' ';                                                               /* +20 (9+1+2+1+2+1+3+1) */
 #else
                     memset(psz, ' ', 13);
@@ -1993,10 +1994,20 @@
                     memcpy(psz, szDate, cch);
                     psz += cch;
-                    *psz++ = ' ';
+                    *psz++ = ' ';                                                               /* +32 */
                 }
 # endif
+                if (pLogger->fFlags & RTLOGFLAGS_PREFIX_PID)
+                {
+#ifndef IN_GC
+                    RTPROCESS Process = RTProcSelf();
+#else
+                    RTPROCESS Process = NIL_RTPROCESS;
+#endif
+                    psz += RTStrFormatNumber(psz, Process, 16, sizeof(RTPROCESS) * 2, 0, RTSTR_F_ZEROPAD);
+                    *psz++ = ' ';                                                               /* +9 */
+                }
                 if (pLogger->fFlags & RTLOGFLAGS_PREFIX_TID)
                 {
-#ifdef IN_RING3
+#ifndef IN_GC
                     RTNATIVETHREAD Thread = RTThreadNativeSelf();
 #else
@@ -2004,5 +2015,5 @@
 #endif
                     psz += RTStrFormatNumber(psz, Thread, 16, sizeof(RTNATIVETHREAD) * 2, 0, RTSTR_F_ZEROPAD);
-                    *psz++ = ' ';
+                    *psz++ = ' ';                                                               /* +17 */
                 }
                 if (pLogger->fFlags & RTLOGFLAGS_PREFIX_THREAD)
@@ -2025,10 +2036,10 @@
                     do
                         *psz++ = ' ';
-                    while (cch++ < 8);
+                    while (cch++ < 8);                                                          /* +17  */
                 }
                 if (pLogger->fFlags & RTLOGFLAGS_PREFIX_FLAG_NO)
                 {
                     psz += RTStrFormatNumber(psz, pArgs->fFlags, 16, 8, 0, RTSTR_F_ZEROPAD);
-                    *psz++ = ' ';
+                    *psz++ = ' ';                                                               /* +9 */
                 }
                 if (pLogger->fFlags & RTLOGFLAGS_PREFIX_FLAG)
@@ -2049,5 +2060,5 @@
                     do
                         *psz++ = ' ';
-                    while (cch++ < 8);
+                    while (cch++ < 8);                                                          /* +17 */
                 }
                 if (pLogger->fFlags & RTLOGFLAGS_PREFIX_GROUP_NO)
@@ -2062,5 +2073,5 @@
                         memcpy(psz, "-1  ", sizeof("-1  ") - 1);
                         psz += sizeof("-1  ") - 1;
-                    }
+                    }                                                                           /* +9 */
                 }
                 if (pLogger->fFlags & RTLOGFLAGS_PREFIX_GROUP)
@@ -2102,5 +2113,5 @@
                     do
                         *psz++ = ' ';
-                    while (cch++ < 8);
+                    while (cch++ < 8);                                                          /* +17 */
                 }
 
@@ -2109,5 +2120,5 @@
                  */
                 cb = psz - &pLogger->achScratch[pLogger->offScratch];
-                Assert(cb <= 124);
+                Assert(cb <= 198);
                 pLogger->offScratch += cb;
                 cb = sizeof(pLogger->achScratch) - pLogger->offScratch - 1;
