Bug 1067547 - add more uses of MOZ_COUNT_CTOR to tools/profiler; r=bsmedberg
authorTom Tromey <tom@tromey.com>
Mon, 26 Sep 2016 11:05:44 -0600
changeset 316200 326e6c945c377e7a55a9de179cffc2ef0c711826
parent 316199 27f488a1f9efa704afc98f2319aca94eaed4b32d
child 316201 e8f4dc9c44cc79fcc35913c8d87063dfabbe127e
push id32770
push userttromey@mozilla.com
push dateMon, 03 Oct 2016 19:21:33 +0000
treeherderautoland@e8f4dc9c44cc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs1067547
milestone52.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 1067547 - add more uses of MOZ_COUNT_CTOR to tools/profiler; r=bsmedberg MozReview-Commit-ID: 5Gf5OkydkL0
tools/profiler/core/ThreadInfo.cpp
tools/profiler/core/platform-linux.cc
tools/profiler/public/PseudoStack.h
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -16,28 +16,30 @@ ThreadInfo::ThreadInfo(const char* aName
   , mThreadId(aThreadId)
   , mIsMainThread(aIsMainThread)
   , mPseudoStack(aPseudoStack)
   , mPlatformData(Sampler::AllocPlatformData(aThreadId))
   , mProfile(nullptr)
   , mStackTop(aStackTop)
   , mPendingDelete(false)
 {
+  MOZ_COUNT_CTOR(ThreadInfo);
 #ifndef SPS_STANDALONE
   mThread = NS_GetCurrentThread();
 #endif
 
   // We don't have to guess on mac
 #ifdef XP_MACOSX
   pthread_t self = pthread_self();
   mStackTop = pthread_get_stackaddr_np(self);
 #endif
 }
 
 ThreadInfo::~ThreadInfo() {
+  MOZ_COUNT_DTOR(ThreadInfo);
   free(mName);
 
   if (mProfile)
     delete mProfile;
 
   Sampler::FreePlatformData(mPlatformData);
 }
 
--- a/tools/profiler/core/platform-linux.cc
+++ b/tools/profiler/core/platform-linux.cc
@@ -272,17 +272,24 @@ static void ProfilerSignalThread(ThreadP
 
 int tgkill(pid_t tgid, pid_t tid, int signalno) {
   return syscall(SYS_tgkill, tgid, tid, signalno);
 }
 
 class PlatformData {
  public:
   PlatformData()
-  {}
+  {
+    MOZ_COUNT_CTOR(PlatformData);
+  }
+
+  ~PlatformData()
+  {
+    MOZ_COUNT_DTOR(PlatformData);
+  }
 };
 
 /* static */ PlatformData*
 Sampler::AllocPlatformData(int aThreadId)
 {
   return new PlatformData;
 }
 
@@ -382,19 +389,21 @@ static void* SignalSender(void* arg) {
 }
 
 Sampler::Sampler(double interval, bool profiling, int entrySize)
     : interval_(interval),
       profiling_(profiling),
       paused_(false),
       active_(false),
       entrySize_(entrySize) {
+  MOZ_COUNT_CTOR(Sampler);
 }
 
 Sampler::~Sampler() {
+  MOZ_COUNT_DTOR(Sampler);
   ASSERT(!signal_sender_launched_);
 }
 
 
 void Sampler::Start() {
   LOG("Sampler started");
 
 #if defined(USE_EHABI_STACKWALK)
--- a/tools/profiler/public/PseudoStack.h
+++ b/tools/profiler/public/PseudoStack.h
@@ -371,20 +371,23 @@ public:
     , mSleepIdObserved(0)
     , mSleeping(false)
     , mRefCnt(1)
 #ifndef SPS_STANDALONE
     , mContext(nullptr)
 #endif
     , mStartJSSampling(false)
     , mPrivacyMode(false)
-  { }
+  {
+    MOZ_COUNT_CTOR(PseudoStack);
+  }
 
   // A PseudoStack can only be deleted via deref.
   ~PseudoStack() {
+    MOZ_COUNT_DTOR(PseudoStack);
     if (mStackPointer != 0) {
       // We're releasing the pseudostack while it's still in use.
       // The label macros keep a non ref counted reference to the
       // stack to avoid a TLS. If these are not all cleared we will
       // get a use-after-free so better to crash now.
       abort();
     }
   }