Bug 1346776 - Add the process id in the Gecko Profiler; r=mstange
authorGreg Tatum <tatum.creative@gmail.com>
Mon, 13 Mar 2017 14:47:15 +0100
changeset 348928 f81dc0fe12d2b89836ee608743d193a2f1a63e3f
parent 348927 c0da600baaa0a9d00ee6f5caa9dcdb24540609ec
child 348929 88c4c948364cd476fc1ffd2fbf1a16645a472808
push id39332
push usergtatum@mozilla.com
push dateWed, 22 Mar 2017 18:36:55 +0000
treeherderautoland@f81dc0fe12d2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange
bugs1346776
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1346776 - Add the process id in the Gecko Profiler; r=mstange I also tweaked the int type of the JSON writer to match the IntProperty method. MozReview-Commit-ID: rtxLDKtJQZ
tools/profiler/core/ThreadInfo.cpp
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -7,16 +7,23 @@
 #include "ThreadInfo.h"
 
 #include "mozilla/DebugOnly.h"
 
 #if defined(GP_OS_darwin)
 #include <pthread.h>
 #endif
 
+#ifdef XP_WIN
+#include <process.h>
+#define getpid _getpid
+#else
+#include <unistd.h> // for getpid()
+#endif
+
 ThreadInfo::ThreadInfo(const char* aName, int aThreadId, bool aIsMainThread,
                        mozilla::NotNull<PseudoStack*> aPseudoStack,
                        void* aStackTop)
   : mName(strdup(aName))
   , mThreadId(aThreadId)
   , mIsMainThread(aIsMainThread)
   , mPseudoStack(aPseudoStack)
   , mPlatformData(AllocPlatformData(aThreadId))
@@ -132,17 +139,18 @@ ThreadInfo::StreamSamplesAndMarkers(Prof
                                     const TimeStamp& aStartTime,
                                     double aSinceTime,
                                     UniqueStacks& aUniqueStacks)
 {
   aWriter.StringProperty("processType",
                          XRE_ChildProcessTypeToString(XRE_GetProcessType()));
 
   aWriter.StringProperty("name", Name());
-  aWriter.IntProperty("tid", static_cast<int>(mThreadId));
+  aWriter.IntProperty("tid", static_cast<int64_t>(mThreadId));
+  aWriter.IntProperty("pid", static_cast<int64_t>(getpid()));
 
   aWriter.StartObjectProperty("samples");
   {
     {
       JSONSchemaWriter schema(aWriter);
       schema.WriteField("stack");
       schema.WriteField("time");
       schema.WriteField("responsiveness");
@@ -254,9 +262,8 @@ ThreadInfo::SizeOfIncludingThis(mozilla:
   // - mSavedStreamedMarkers
   // - mUniqueStacks
   //
   // The following members are not measured:
   // - mThread: because it is non-owning
 
   return n;
 }
-