Bug 1341255 - Profiler tidyups: remove StackEntry, rename ProfileEntry to ProfileBufferEntry (part 2: rename ProfileEntry). r=n.nethercote.
authorJulian Seward <jseward@acm.org>
Thu, 23 Feb 2017 23:05:23 +0100
changeset 373705 6ef5dd99b45cf4b556e7204ba29c6446f550702a
parent 373704 5cb0e7cf804be7479edfd75b3cbffd9179691b53
child 373706 be661bae6cb9a53935c5b87744bf68879d9ebcc5
child 373785 7e72aa400561c7767ca4734f23ff3903e55d4e0a
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersn
bugs1341255
milestone54.0a1
Bug 1341255 - Profiler tidyups: remove StackEntry, rename ProfileEntry to ProfileBufferEntry (part 2: rename ProfileEntry). r=n.nethercote.
tools/profiler/core/ProfileBuffer.cpp
tools/profiler/core/ProfileBuffer.h
tools/profiler/core/ProfileBufferEntry.cpp
tools/profiler/core/ProfileBufferEntry.h
tools/profiler/core/ProfileEntry.cpp
tools/profiler/core/ProfileEntry.h
tools/profiler/core/SyncProfile.h
tools/profiler/core/ThreadInfo.cpp
tools/profiler/core/ThreadInfo.h
tools/profiler/core/platform-linux-android.cpp
tools/profiler/core/platform-win32.cpp
tools/profiler/core/platform.cpp
tools/profiler/gecko/ThreadResponsiveness.cpp
tools/profiler/moz.build
tools/profiler/tests/gtest/ThreadProfileTest.cpp
--- a/tools/profiler/core/ProfileBuffer.cpp
+++ b/tools/profiler/core/ProfileBuffer.cpp
@@ -1,45 +1,45 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ProfileBuffer.h"
 
 ProfileBuffer::ProfileBuffer(int aEntrySize)
-  : mEntries(mozilla::MakeUnique<ProfileEntry[]>(aEntrySize))
+  : mEntries(mozilla::MakeUnique<ProfileBufferEntry[]>(aEntrySize))
   , mWritePos(0)
   , mReadPos(0)
   , mEntrySize(aEntrySize)
   , mGeneration(0)
 {
 }
 
 ProfileBuffer::~ProfileBuffer()
 {
   while (mStoredMarkers.peek()) {
     delete mStoredMarkers.popHead();
   }
 }
 
 // Called from signal, call only reentrant functions
-void ProfileBuffer::addTag(const ProfileEntry& aTag)
+void ProfileBuffer::addTag(const ProfileBufferEntry& aTag)
 {
   mEntries[mWritePos++] = aTag;
   if (mWritePos == mEntrySize) {
     // Wrapping around may result in things referenced in the buffer (e.g.,
     // JIT code addresses and markers) being incorrectly collected.
     MOZ_ASSERT(mGeneration != UINT32_MAX);
     mGeneration++;
     mWritePos = 0;
   }
   if (mWritePos == mReadPos) {
     // Keep one slot open.
-    mEntries[mReadPos] = ProfileEntry();
+    mEntries[mReadPos] = ProfileBufferEntry();
     mReadPos = (mReadPos + 1) % mEntrySize;
   }
 }
 
 void ProfileBuffer::addStoredMarker(ProfilerMarker *aStoredMarker) {
   aStoredMarker->SetGeneration(mGeneration);
   mStoredMarkers.insert(aStoredMarker);
 }
@@ -80,17 +80,17 @@ char* ProfileBuffer::processDynamicTag(i
 {
   int readAheadPos = (readPos + 1) % mEntrySize;
   int tagBuffPos = 0;
 
   // Read the string stored in mTagData until the null character is seen
   bool seenNullByte = false;
   while (readAheadPos != mWritePos && !seenNullByte) {
     (*tagsConsumed)++;
-    ProfileEntry readAheadEntry = mEntries[readAheadPos];
+    ProfileBufferEntry readAheadEntry = mEntries[readAheadPos];
     for (size_t pos = 0; pos < sizeof(void*); pos++) {
       tagBuff[tagBuffPos] = readAheadEntry.mTagChars[pos];
       if (tagBuff[tagBuffPos] == '\0' || tagBuffPos == DYNAMIC_MAX_STRING-2) {
         seenNullByte = true;
         break;
       }
       tagBuffPos++;
     }
--- a/tools/profiler/core/ProfileBuffer.h
+++ b/tools/profiler/core/ProfileBuffer.h
@@ -1,32 +1,32 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZ_PROFILE_BUFFER_H
 #define MOZ_PROFILE_BUFFER_H
 
-#include "ProfileEntry.h"
+#include "ProfileBufferEntry.h"
 #include "platform.h"
 #include "ProfileJSONWriter.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/RefCounted.h"
 
 class ProfileBuffer : public mozilla::RefCounted<ProfileBuffer>
 {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ProfileBuffer)
 
   explicit ProfileBuffer(int aEntrySize);
 
   virtual ~ProfileBuffer();
 
-  void addTag(const ProfileEntry& aTag);
+  void addTag(const ProfileBufferEntry& aTag);
   void StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId, double aSinceTime,
                            JSContext* cx, UniqueStacks& aUniqueStacks);
   void StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId, double aSinceTime,
                            UniqueStacks& aUniqueStacks);
   void DuplicateLastSample(int aThreadId, const mozilla::TimeStamp& aStartTime);
 
   void addStoredMarker(ProfilerMarker* aStoredMarker);
 
@@ -37,17 +37,17 @@ public:
   size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
 
 protected:
   char* processDynamicTag(int readPos, int* tagsConsumed, char* tagBuff);
   int FindLastSampleOfThread(int aThreadId);
 
 public:
   // Circular buffer 'Keep One Slot Open' implementation for simplicity
-  mozilla::UniquePtr<ProfileEntry[]> mEntries;
+  mozilla::UniquePtr<ProfileBufferEntry[]> mEntries;
 
   // Points to the next entry we will write to, which is also the one at which
   // we need to stop reading.
   int mWritePos;
 
   // Points to the entry at which we can start reading.
   int mReadPos;
 
rename from tools/profiler/core/ProfileEntry.cpp
rename to tools/profiler/core/ProfileBufferEntry.cpp
--- a/tools/profiler/core/ProfileEntry.cpp
+++ b/tools/profiler/core/ProfileBufferEntry.cpp
@@ -11,76 +11,76 @@
 #include "nsXULAppAPI.h"
 
 // JS
 #include "jsapi.h"
 #include "jsfriendapi.h"
 #include "js/TrackedOptimizationInfo.h"
 
 // Self
-#include "ProfileEntry.h"
+#include "ProfileBufferEntry.h"
 
 using mozilla::JSONWriter;
 using mozilla::MakeUnique;
 using mozilla::Maybe;
 using mozilla::Nothing;
 using mozilla::Some;
 using mozilla::TimeStamp;
 using mozilla::UniquePtr;
 
 ////////////////////////////////////////////////////////////////////////
-// BEGIN ProfileEntry
+// BEGIN ProfileBufferEntry
 
-ProfileEntry::ProfileEntry()
+ProfileBufferEntry::ProfileBufferEntry()
   : mTagData(nullptr)
   , mKind(Kind::INVALID)
 { }
 
 // aTagData must not need release (i.e. be a string from the text segment)
-ProfileEntry::ProfileEntry(Kind aKind, const char *aTagData)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, const char *aTagData)
   : mTagData(aTagData)
   , mKind(aKind)
 { }
 
-ProfileEntry::ProfileEntry(Kind aKind, ProfilerMarker *aTagMarker)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, ProfilerMarker *aTagMarker)
   : mTagMarker(aTagMarker)
   , mKind(aKind)
 { }
 
-ProfileEntry::ProfileEntry(Kind aKind, void *aTagPtr)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, void *aTagPtr)
   : mTagPtr(aTagPtr)
   , mKind(aKind)
 { }
 
-ProfileEntry::ProfileEntry(Kind aKind, double aTagDouble)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, double aTagDouble)
   : mTagDouble(aTagDouble)
   , mKind(aKind)
 { }
 
-ProfileEntry::ProfileEntry(Kind aKind, uintptr_t aTagOffset)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, uintptr_t aTagOffset)
   : mTagOffset(aTagOffset)
   , mKind(aKind)
 { }
 
-ProfileEntry::ProfileEntry(Kind aKind, Address aTagAddress)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, Address aTagAddress)
   : mTagAddress(aTagAddress)
   , mKind(aKind)
 { }
 
-ProfileEntry::ProfileEntry(Kind aKind, int aTagInt)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, int aTagInt)
   : mTagInt(aTagInt)
   , mKind(aKind)
 { }
 
-ProfileEntry::ProfileEntry(Kind aKind, char aTagChar)
+ProfileBufferEntry::ProfileBufferEntry(Kind aKind, char aTagChar)
   : mTagChar(aTagChar)
   , mKind(aKind)
 { }
 
-// END ProfileEntry
+// END ProfileBufferEntry
 ////////////////////////////////////////////////////////////////////////
 
 class JSONSchemaWriter
 {
   JSONWriter& mWriter;
   uint32_t mIndex;
 
 public:
@@ -148,18 +148,18 @@ public:
     {
       mUniqueStrings.WriteProperty(mWriter, "site", JS::TrackedTypeSiteString(site));
       mUniqueStrings.WriteProperty(mWriter, "mirType", mirType);
     }
     mWriter.EndObject();
   }
 };
 
-// As mentioned in ProfileEntry.h, the JSON format contains many arrays whose
-// elements are laid out according to various schemas to help
+// As mentioned in ProfileBufferEntry.h, the JSON format contains many
+// arrays whose elements are laid out according to various schemas to help
 // de-duplication. This RAII class helps write these arrays by keeping track of
 // the last non-null element written and adding the appropriate number of null
 // elements when writing new non-null elements. It also automatically opens and
 // closes an array element on the given JSON writer.
 //
 // Example usage:
 //
 //     // Define the schema of elements in this type of array: [FOO, BAR, BAZ]
@@ -584,51 +584,51 @@ void ProfileBuffer::StreamSamplesToJSON(
 {
   Maybe<ProfileSample> sample;
   int readPos = mReadPos;
   int currentThreadID = -1;
   Maybe<double> currentTime;
   UniquePtr<char[]> tagBuff = MakeUnique<char[]>(DYNAMIC_MAX_STRING);
 
   while (readPos != mWritePos) {
-    ProfileEntry entry = mEntries[readPos];
+    ProfileBufferEntry entry = mEntries[readPos];
     if (entry.isThreadId()) {
       currentThreadID = entry.mTagInt;
       currentTime.reset();
       int readAheadPos = (readPos + 1) % mEntrySize;
       if (readAheadPos != mWritePos) {
-        ProfileEntry readAheadEntry = mEntries[readAheadPos];
+        ProfileBufferEntry readAheadEntry = mEntries[readAheadPos];
         if (readAheadEntry.isTime()) {
           currentTime = Some(readAheadEntry.mTagDouble);
         }
       }
     }
     if (currentThreadID == aThreadId && (currentTime.isNothing() || *currentTime >= aSinceTime)) {
       switch (entry.kind()) {
-      case ProfileEntry::Kind::Responsiveness:
+      case ProfileBufferEntry::Kind::Responsiveness:
         if (sample.isSome()) {
           sample->mResponsiveness = Some(entry.mTagDouble);
         }
         break;
-      case ProfileEntry::Kind::ResidentMemory:
+      case ProfileBufferEntry::Kind::ResidentMemory:
         if (sample.isSome()) {
           sample->mRSS = Some(entry.mTagDouble);
         }
         break;
-      case ProfileEntry::Kind::UnsharedMemory:
+      case ProfileBufferEntry::Kind::UnsharedMemory:
         if (sample.isSome()) {
           sample->mUSS = Some(entry.mTagDouble);
          }
         break;
-      case ProfileEntry::Kind::FrameNumber:
+      case ProfileBufferEntry::Kind::FrameNumber:
         if (sample.isSome()) {
           sample->mFrameNumber = Some(entry.mTagInt);
         }
         break;
-      case ProfileEntry::Kind::Sample:
+      case ProfileBufferEntry::Kind::Sample:
         {
           // end the previous sample if there was one
           if (sample.isSome()) {
             WriteSample(aWriter, *sample);
             sample.reset();
           }
           // begin the next sample
           sample.emplace();
@@ -637,17 +637,17 @@ void ProfileBuffer::StreamSamplesToJSON(
           // Seek forward through the entire sample, looking for frames
           // this is an easier approach to reason about than adding more
           // control variables and cases to the loop that goes through the buffer once
 
           UniqueStacks::Stack stack =
             aUniqueStacks.BeginStack(UniqueStacks::OnStackFrameKey("(root)"));
 
           int framePos = (readPos + 1) % mEntrySize;
-          ProfileEntry frame = mEntries[framePos];
+          ProfileBufferEntry frame = mEntries[framePos];
           while (framePos != mWritePos && !frame.isSample() && !frame.isThreadId()) {
             int incBy = 1;
             frame = mEntries[framePos];
 
             // Read ahead to the next tag, if it's an EmbeddedString
             // tag process it now
             const char* tagStringData = frame.mTagData;
             int readAheadPos = (framePos + 1) % mEntrySize;
@@ -720,17 +720,17 @@ void ProfileBuffer::StreamSamplesToJSON(
 }
 
 void ProfileBuffer::StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId,
                                         double aSinceTime, UniqueStacks& aUniqueStacks)
 {
   int readPos = mReadPos;
   int currentThreadID = -1;
   while (readPos != mWritePos) {
-    ProfileEntry entry = mEntries[readPos];
+    ProfileBufferEntry entry = mEntries[readPos];
     if (entry.isThreadId()) {
       currentThreadID = entry.mTagInt;
     } else if (currentThreadID == aThreadId && entry.isMarker()) {
       const ProfilerMarker* marker = entry.getMarker();
       if (marker->GetTime() >= aSinceTime) {
         entry.getMarker()->StreamJSON(aWriter, aUniqueStacks);
       }
     }
@@ -740,17 +740,17 @@ void ProfileBuffer::StreamMarkersToJSON(
 
 int ProfileBuffer::FindLastSampleOfThread(int aThreadId)
 {
   // We search backwards from mWritePos-1 to mReadPos.
   // Adding mEntrySize makes the result of the modulus positive.
   for (int readPos  = (mWritePos + mEntrySize - 1) % mEntrySize;
            readPos !=  (mReadPos + mEntrySize - 1) % mEntrySize;
            readPos  =   (readPos + mEntrySize - 1) % mEntrySize) {
-    ProfileEntry entry = mEntries[readPos];
+    ProfileBufferEntry entry = mEntries[readPos];
     if (entry.isThreadId() && entry.mTagInt == aThreadId) {
       return readPos;
     }
   }
 
   return -1;
 }
 
@@ -766,24 +766,25 @@ ProfileBuffer::DuplicateLastSample(int a
 
   addTag(mEntries[lastSampleStartPos]);
 
   // Go through the whole entry and duplicate it, until we find the next one.
   for (int readPos = (lastSampleStartPos + 1) % mEntrySize;
        readPos != mWritePos;
        readPos = (readPos + 1) % mEntrySize) {
     switch (mEntries[readPos].kind()) {
-      case ProfileEntry::Kind::ThreadId:
+      case ProfileBufferEntry::Kind::ThreadId:
         // We're done.
         return;
-      case ProfileEntry::Kind::Time:
+      case ProfileBufferEntry::Kind::Time:
         // Copy with new time
-        addTag(ProfileEntry::Time((TimeStamp::Now() - aStartTime).ToMilliseconds()));
+        addTag(ProfileBufferEntry::Time((TimeStamp::Now() -
+                                         aStartTime).ToMilliseconds()));
         break;
-      case ProfileEntry::Kind::Marker:
+      case ProfileBufferEntry::Kind::Marker:
         // Don't copy markers
         break;
       default:
         // Copy anything else we don't know about
         addTag(mEntries[readPos]);
         break;
     }
   }
rename from tools/profiler/core/ProfileEntry.h
rename to tools/profiler/core/ProfileBufferEntry.h
--- a/tools/profiler/core/ProfileEntry.h
+++ b/tools/profiler/core/ProfileBufferEntry.h
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef MOZ_PROFILE_ENTRY_H
-#define MOZ_PROFILE_ENTRY_H
+#ifndef ProfileBufferEntry_h
+#define ProfileBufferEntry_h
 
 #include <ostream>
 #include "GeckoProfiler.h"
 #include "platform.h"
 #include "ProfileJSONWriter.h"
 #include "ProfilerBacktrace.h"
 #include "mozilla/RefPtr.h"
 #include <string>
@@ -20,17 +20,17 @@
 #include "nsHashKeys.h"
 #include "nsDataHashtable.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/Vector.h"
 #include "gtest/MozGtestFriend.h"
 #include "mozilla/HashFunctions.h"
 #include "mozilla/UniquePtr.h"
 
-#define PROFILE_ENTRY_KIND_LIST(_) \
+#define PROFILE_BUFFER_ENTRY_KIND_LIST(_) \
     _(Category,        int)               \
     _(CodeLocation,    const char *)      \
     _(EmbeddedString,  void *)            \
     _(FrameNumber,     int)               \
     _(JitReturnAddr,   void *)            \
     _(LineNumber,      int)               \
     _(NativeLeafAddr,  void *)            \
     _(Marker,          ProfilerMarker *)  \
@@ -41,52 +41,54 @@
     _(Time,            double)            \
     _(UnsharedMemory,  double)
 
 // NB: Packing this structure has been shown to cause SIGBUS issues on ARM.
 #if !defined(GP_ARCH_arm)
 #pragma pack(push, 1)
 #endif
 
-class ProfileEntry
+class ProfileBufferEntry
 {
 public:
   enum class Kind : uint8_t {
     INVALID = 0,
 #   define DEF_ENUM_(k, t) k,
-    PROFILE_ENTRY_KIND_LIST(DEF_ENUM_)
+    PROFILE_BUFFER_ENTRY_KIND_LIST(DEF_ENUM_)
 #   undef DEF_ENUM_
     LIMIT
   };
 
-  ProfileEntry();
+  ProfileBufferEntry();
 
 private:
   // aTagData must not need release (i.e. be a string from the text segment)
-  ProfileEntry(Kind aKind, const char *aTagData);
-  ProfileEntry(Kind aKind, void *aTagPtr);
-  ProfileEntry(Kind aKind, ProfilerMarker *aTagMarker);
-  ProfileEntry(Kind aKind, double aTagDouble);
-  ProfileEntry(Kind aKind, uintptr_t aTagOffset);
-  ProfileEntry(Kind aKind, Address aTagAddress);
-  ProfileEntry(Kind aKind, int aTagLine);
-  ProfileEntry(Kind aKind, char aTagChar);
+  ProfileBufferEntry(Kind aKind, const char *aTagData);
+  ProfileBufferEntry(Kind aKind, void *aTagPtr);
+  ProfileBufferEntry(Kind aKind, ProfilerMarker *aTagMarker);
+  ProfileBufferEntry(Kind aKind, double aTagDouble);
+  ProfileBufferEntry(Kind aKind, uintptr_t aTagOffset);
+  ProfileBufferEntry(Kind aKind, Address aTagAddress);
+  ProfileBufferEntry(Kind aKind, int aTagLine);
+  ProfileBufferEntry(Kind aKind, char aTagChar);
 
 public:
 # define DEF_MAKE_(k, t) \
-    static ProfileEntry k(t val) { return ProfileEntry(Kind::k, val); }
-  PROFILE_ENTRY_KIND_LIST(DEF_MAKE_)
+    static ProfileBufferEntry k(t val) { \
+      return ProfileBufferEntry(Kind::k, val); \
+    }
+  PROFILE_BUFFER_ENTRY_KIND_LIST(DEF_MAKE_)
 # undef DEF_MAKE_
 
   Kind kind() const { return mKind; }
   bool hasKind(Kind k) const { return kind() == k; }
 
 # define DEF_METHODS_(k, t) \
     bool is##k() const { return hasKind(Kind::k); }
-  PROFILE_ENTRY_KIND_LIST(DEF_METHODS_)
+  PROFILE_BUFFER_ENTRY_KIND_LIST(DEF_METHODS_)
 # undef DEF_METHODS_
 
   const ProfilerMarker* getMarker() {
     MOZ_ASSERT(isMarker());
     return mTagMarker;
   }
 
 private:
@@ -403,9 +405,9 @@ private:
 //     "(root)",
 //     "foo.js",
 //     "baseline",
 //     "example marker"
 //   ]
 // }
 //
 
-#endif /* ndef MOZ_PROFILE_ENTRY_H */
+#endif /* ndef ProfileBufferEntry_h */
--- a/tools/profiler/core/SyncProfile.h
+++ b/tools/profiler/core/SyncProfile.h
@@ -2,17 +2,16 @@
 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __SYNCPROFILE_H
 #define __SYNCPROFILE_H
 
-#include "ProfileEntry.h"
 #include "ThreadInfo.h"
 
 class SyncProfile : public ThreadInfo
 {
 public:
   SyncProfile(int aThreadId, PseudoStack* aStack);
   ~SyncProfile();
 
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -59,17 +59,17 @@ ThreadInfo::CanInvokeJS() const
   }
   bool result;
   mozilla::DebugOnly<nsresult> rv = mThread->GetCanInvokeJS(&result);
   MOZ_ASSERT(NS_SUCCEEDED(rv));
   return result;
 }
 
 void
-ThreadInfo::addTag(const ProfileEntry& aTag)
+ThreadInfo::addTag(const ProfileBufferEntry& aTag)
 {
   mBuffer->addTag(aTag);
 }
 
 void
 ThreadInfo::addStoredMarker(ProfilerMarker* aStoredMarker) {
   mBuffer->addStoredMarker(aStoredMarker);
 }
--- a/tools/profiler/core/ThreadInfo.h
+++ b/tools/profiler/core/ThreadInfo.h
@@ -52,17 +52,17 @@ class ThreadInfo {
   //
   // The following code is only used for threads that are being profiled, i.e.
   // for which SetProfile() has been called.
   //
 
 public:
   bool hasProfile() { return !!mBuffer; }
 
-  void addTag(const ProfileEntry& aTag);
+  void addTag(const ProfileBufferEntry& aTag);
 
   // Track a marker which has been inserted into the thread profile.
   // This marker can safely be deleted once the generation has
   // expired.
   void addStoredMarker(ProfilerMarker* aStoredMarker);
   mozilla::Mutex& GetMutex();
   void StreamJSON(SpliceableJSONWriter& aWriter, double aSinceTime = 0);
 
--- a/tools/profiler/core/platform-linux-android.cpp
+++ b/tools/profiler/core/platform-linux-android.cpp
@@ -58,17 +58,16 @@
 #endif  // def __GLIBC__
 #include <strings.h>    // index
 #include <errno.h>
 #include <stdarg.h>
 
 #include "prenv.h"
 #include "mozilla/LinuxSignal.h"
 #include "mozilla/DebugOnly.h"
-#include "ProfileEntry.h"
 
 // Memory profile
 #include "nsMemoryReporterManager.h"
 
 #include <string.h>
 #include <list>
 
 using namespace mozilla;
--- a/tools/profiler/core/platform-win32.cpp
+++ b/tools/profiler/core/platform-win32.cpp
@@ -26,17 +26,16 @@
 // AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 // OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 // SUCH DAMAGE.
 
 #include <windows.h>
 #include <mmsystem.h>
 #include <process.h>
-#include "ProfileEntry.h"
 
 // Memory profile
 #include "nsMemoryReporterManager.h"
 
 class PlatformData {
  public:
   // Get a handle to the calling thread. This is the thread that we are
   // going to profile. We need to make a copy of the handle because we are
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -227,31 +227,31 @@ public:
   mozilla::TimeStamp timestamp;
   int64_t rssMemory;
   int64_t ussMemory;
 };
 
 static void
 AddDynamicCodeLocationTag(ThreadInfo& aInfo, const char* aStr)
 {
-  aInfo.addTag(ProfileEntry::CodeLocation(""));
+  aInfo.addTag(ProfileBufferEntry::CodeLocation(""));
 
   size_t strLen = strlen(aStr) + 1;   // +1 for the null terminator
   for (size_t j = 0; j < strLen; ) {
     // Store as many characters in the void* as the platform allows.
     char text[sizeof(void*)];
     size_t len = sizeof(void*) / sizeof(char);
     if (j+len >= strLen) {
       len = strLen - j;
     }
     memcpy(text, &aStr[j], len);
     j += sizeof(void*) / sizeof(char);
 
     // Cast to *((void**) to pass the text data to a void*.
-    aInfo.addTag(ProfileEntry::EmbeddedString(*((void**)(&text[0]))));
+    aInfo.addTag(ProfileBufferEntry::EmbeddedString(*((void**)(&text[0]))));
   }
 }
 
 static void
 AddPseudoEntry(volatile js::ProfileEntry& entry, ThreadInfo& aInfo,
                PseudoStack* stack, void* lastpc)
 {
   // Pseudo-frames with the BEGIN_PSEUDO_JS flag are just annotations and
@@ -288,35 +288,35 @@ AddPseudoEntry(volatile js::ProfileEntry
         } else {
           lineno = JS_PCToLineNumber(script, entry.pc());
         }
       }
     } else {
       lineno = entry.line();
     }
   } else {
-    aInfo.addTag(ProfileEntry::CodeLocation(sampleLabel));
+    aInfo.addTag(ProfileBufferEntry::CodeLocation(sampleLabel));
 
     // XXX: Bug 1010578. Don't assume a CPP entry and try to get the line for
     // js entries as well.
     if (entry.isCpp()) {
       lineno = entry.line();
     }
   }
 
   if (lineno != -1) {
-    aInfo.addTag(ProfileEntry::LineNumber(lineno));
+    aInfo.addTag(ProfileBufferEntry::LineNumber(lineno));
   }
 
   uint32_t category = entry.category();
   MOZ_ASSERT(!(category & js::ProfileEntry::IS_CPP_ENTRY));
   MOZ_ASSERT(!(category & js::ProfileEntry::FRAME_LABEL_COPY));
 
   if (category) {
-    aInfo.addTag(ProfileEntry::Category((int)category));
+    aInfo.addTag(ProfileBufferEntry::Category((int)category));
   }
 }
 
 struct NativeStack
 {
   void** pc_array;
   void** sp_array;
   size_t size;
@@ -394,17 +394,17 @@ MergeStacksIntoProfile(ThreadInfo& aInfo
             jsFrames[jsCount++] = frame.value();
           }
         }
       }
     }
   }
 
   // Start the sample with a root entry.
-  aInfo.addTag(ProfileEntry::Sample("(root)"));
+  aInfo.addTag(ProfileBufferEntry::Sample("(root)"));
 
   // While the pseudo-stack array is ordered oldest-to-youngest, the JS and
   // native arrays are ordered youngest-to-oldest. We must add frames to aInfo
   // oldest-to-youngest. Thus, iterate over the pseudo-stack forwards and JS
   // and native arrays backwards. Note: this means the terminating condition
   // jsIndex and nativeIndex is being < 0.
   uint32_t pseudoIndex = 0;
   int32_t jsIndex = jsCount - 1;
@@ -497,29 +497,29 @@ MergeStacksIntoProfile(ThreadInfo& aInfo
       // with stale JIT code return addresses.
       if (aSample->isSamplingCurrentThread ||
           jsFrame.kind == JS::ProfilingFrameIterator::Frame_Wasm) {
         AddDynamicCodeLocationTag(aInfo, jsFrame.label);
       } else {
         MOZ_ASSERT(jsFrame.kind == JS::ProfilingFrameIterator::Frame_Ion ||
                    jsFrame.kind == JS::ProfilingFrameIterator::Frame_Baseline);
         aInfo.addTag(
-          ProfileEntry::JitReturnAddr(jsFrames[jsIndex].returnAddress));
+          ProfileBufferEntry::JitReturnAddr(jsFrames[jsIndex].returnAddress));
       }
 
       jsIndex--;
       continue;
     }
 
     // If we reach here, there must be a native stack entry and it must be the
     // greatest entry.
     if (nativeStackAddr) {
       MOZ_ASSERT(nativeIndex >= 0);
       void* addr = (void*)aNativeStack.pc_array[nativeIndex];
-      aInfo.addTag(ProfileEntry::NativeLeafAddr(addr));
+      aInfo.addTag(ProfileBufferEntry::NativeLeafAddr(addr));
     }
     if (nativeIndex >= 0) {
       nativeIndex--;
     }
   }
 
   // Update the JS context with the current profile sample buffer generation.
   //
@@ -767,31 +767,32 @@ DoNativeBacktrace(ThreadInfo& aInfo, Tic
 static void
 DoSampleStackTrace(ThreadInfo& aInfo, TickSample* aSample,
                    bool aAddLeafAddresses)
 {
   NativeStack nativeStack = { nullptr, nullptr, 0, 0 };
   MergeStacksIntoProfile(aInfo, aSample, nativeStack);
 
   if (aSample && aAddLeafAddresses) {
-    aInfo.addTag(ProfileEntry::NativeLeafAddr((void*)aSample->pc));
+    aInfo.addTag(ProfileBufferEntry::NativeLeafAddr((void*)aSample->pc));
   }
 }
 
 // This function is called for each sampling period with the current program
 // counter. It is called within a signal and so must be re-entrant.
 static void
 Tick(TickSample* aSample)
 {
   ThreadInfo& currThreadInfo = *aSample->threadInfo;
 
-  currThreadInfo.addTag(ProfileEntry::ThreadId(currThreadInfo.ThreadId()));
+  currThreadInfo.addTag(
+    ProfileBufferEntry::ThreadId(currThreadInfo.ThreadId()));
 
   mozilla::TimeDuration delta = aSample->timestamp - gStartTime;
-  currThreadInfo.addTag(ProfileEntry::Time(delta.ToMilliseconds()));
+  currThreadInfo.addTag(ProfileBufferEntry::Time(delta.ToMilliseconds()));
 
   PseudoStack* stack = currThreadInfo.Stack();
 
 #if defined(USE_NS_STACKWALK) || defined(USE_EHABI_STACKWALK) || \
     defined(USE_LUL_STACKWALK)
   if (gUseStackWalk) {
     DoNativeBacktrace(currThreadInfo, aSample);
   } else {
@@ -803,41 +804,42 @@ Tick(TickSample* aSample)
 
   // Don't process the PeudoStack's markers if we're synchronously sampling the
   // current thread.
   if (!aSample->isSamplingCurrentThread) {
     ProfilerMarkerLinkedList* pendingMarkersList = stack->getPendingMarkers();
     while (pendingMarkersList && pendingMarkersList->peek()) {
       ProfilerMarker* marker = pendingMarkersList->popHead();
       currThreadInfo.addStoredMarker(marker);
-      currThreadInfo.addTag(ProfileEntry::Marker(marker));
+      currThreadInfo.addTag(ProfileBufferEntry::Marker(marker));
     }
   }
 
   if (currThreadInfo.GetThreadResponsiveness()->HasData()) {
     mozilla::TimeDuration delta =
       currThreadInfo.GetThreadResponsiveness()->GetUnresponsiveDuration(
         aSample->timestamp);
-    currThreadInfo.addTag(ProfileEntry::Responsiveness(delta.ToMilliseconds()));
+    currThreadInfo.addTag(
+      ProfileBufferEntry::Responsiveness(delta.ToMilliseconds()));
   }
 
   // rssMemory is equal to 0 when we are not recording.
   if (aSample->rssMemory != 0) {
-    currThreadInfo.addTag(ProfileEntry::ResidentMemory(
+    currThreadInfo.addTag(ProfileBufferEntry::ResidentMemory(
       static_cast<double>(aSample->rssMemory)));
   }
 
   // ussMemory is equal to 0 when we are not recording.
   if (aSample->ussMemory != 0) {
-    currThreadInfo.addTag(ProfileEntry::UnsharedMemory(
+    currThreadInfo.addTag(ProfileBufferEntry::UnsharedMemory(
       static_cast<double>(aSample->ussMemory)));
   }
 
   if (gLastFrameNumber != gFrameNumber) {
-    currThreadInfo.addTag(ProfileEntry::FrameNumber(gFrameNumber));
+    currThreadInfo.addTag(ProfileBufferEntry::FrameNumber(gFrameNumber));
     gLastFrameNumber = gFrameNumber;
   }
 }
 
 // END tick/unwinding code
 ////////////////////////////////////////////////////////////////////////
 
 ////////////////////////////////////////////////////////////////////////
--- a/tools/profiler/gecko/ThreadResponsiveness.cpp
+++ b/tools/profiler/gecko/ThreadResponsiveness.cpp
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ThreadResponsiveness.h"
 #include "platform.h"
 #include "nsComponentManagerUtils.h"
 #include "nsThreadUtils.h"
 #include "nsITimer.h"
 #include "mozilla/Monitor.h"
-#include "ProfileEntry.h"
 
 using mozilla::Monitor;
 using mozilla::MonitorAutoLock;
 using mozilla::TimeStamp;
 
 class CheckResponsivenessTask : public mozilla::Runnable,
                                 public nsITimerCallback {
 public:
--- a/tools/profiler/moz.build
+++ b/tools/profiler/moz.build
@@ -17,17 +17,17 @@ if CONFIG['MOZ_GECKO_PROFILER']:
         'public/shared-libraries.h',
     ]
     EXTRA_JS_MODULES += [
         'gecko/Profiler.jsm',
     ]
     UNIFIED_SOURCES += [
         'core/platform.cpp',
         'core/ProfileBuffer.cpp',
-        'core/ProfileEntry.cpp',
+        'core/ProfileBufferEntry.cpp',
         'core/ProfileJSONWriter.cpp',
         'core/ProfilerBacktrace.cpp',
         'core/ProfilerMarkers.cpp',
         'core/StackTop.cpp',
         'core/SyncProfile.cpp',
         'core/ThreadInfo.cpp',
         'gecko/nsProfiler.cpp',
         'gecko/nsProfilerFactory.cpp',
--- a/tools/profiler/tests/gtest/ThreadProfileTest.cpp
+++ b/tools/profiler/tests/gtest/ThreadProfileTest.cpp
@@ -1,16 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "gtest/gtest.h"
 
-#include "ProfileEntry.h"
+#include "ProfileBufferEntry.h"
 #include "ThreadInfo.h"
 
 // Make sure we can initialize our thread profile
 TEST(ThreadProfile, Initialization) {
   PseudoStack* stack = new PseudoStack();
   Thread::tid_t tid = 1000;
   ThreadInfo info("testThread", tid, true, stack, nullptr);
   RefPtr<ProfileBuffer> pb = new ProfileBuffer(10);
@@ -18,58 +18,61 @@ TEST(ThreadProfile, Initialization) {
 }
 
 // Make sure we can record one tag and read it
 TEST(ThreadProfile, InsertOneTag) {
   PseudoStack* stack = new PseudoStack();
   Thread::tid_t tid = 1000;
   ThreadInfo info("testThread", tid, true, stack, nullptr);
   RefPtr<ProfileBuffer> pb = new ProfileBuffer(10);
-  pb->addTag(ProfileEntry::Time(123.1));
+  pb->addTag(ProfileBufferEntry::Time(123.1));
   ASSERT_TRUE(pb->mEntries != nullptr);
-  ASSERT_TRUE(pb->mEntries[pb->mReadPos].kind() == ProfileEntry::Kind::Time);
+  ASSERT_TRUE(pb->mEntries[pb->mReadPos].kind() ==
+              ProfileBufferEntry::Kind::Time);
   ASSERT_TRUE(pb->mEntries[pb->mReadPos].mTagDouble == 123.1);
 }
 
 // See if we can insert some tags
 TEST(ThreadProfile, InsertTagsNoWrap) {
   PseudoStack* stack = new PseudoStack();
   Thread::tid_t tid = 1000;
   ThreadInfo info("testThread", tid, true, stack, nullptr);
   RefPtr<ProfileBuffer> pb = new ProfileBuffer(100);
   int test_size = 50;
   for (int i = 0; i < test_size; i++) {
-    pb->addTag(ProfileEntry::Time(i));
+    pb->addTag(ProfileBufferEntry::Time(i));
   }
   ASSERT_TRUE(pb->mEntries != nullptr);
   int readPos = pb->mReadPos;
   while (readPos != pb->mWritePos) {
-    ASSERT_TRUE(pb->mEntries[readPos].kind() == ProfileEntry::Kind::Time);
+    ASSERT_TRUE(pb->mEntries[readPos].kind() ==
+                ProfileBufferEntry::Kind::Time);
     ASSERT_TRUE(pb->mEntries[readPos].mTagDouble == readPos);
     readPos = (readPos + 1) % pb->mEntrySize;
   }
 }
 
 // See if wrapping works as it should in the basic case
 TEST(ThreadProfile, InsertTagsWrap) {
   PseudoStack* stack = new PseudoStack();
   Thread::tid_t tid = 1000;
   // we can fit only 24 tags in this buffer because of the empty slot
   int tags = 24;
   int buffer_size = tags + 1;
   ThreadInfo info("testThread", tid, true, stack, nullptr);
   RefPtr<ProfileBuffer> pb = new ProfileBuffer(buffer_size);
   int test_size = 43;
   for (int i = 0; i < test_size; i++) {
-    pb->addTag(ProfileEntry::Time(i));
+    pb->addTag(ProfileBufferEntry::Time(i));
   }
   ASSERT_TRUE(pb->mEntries != nullptr);
   int readPos = pb->mReadPos;
   int ctr = 0;
   while (readPos != pb->mWritePos) {
-    ASSERT_TRUE(pb->mEntries[readPos].kind() == ProfileEntry::Kind::Time);
+    ASSERT_TRUE(pb->mEntries[readPos].kind() ==
+                ProfileBufferEntry::Kind::Time);
     // the first few tags were discarded when we wrapped
     ASSERT_TRUE(pb->mEntries[readPos].mTagDouble == ctr + (test_size - tags));
     ctr++;
     readPos = (readPos + 1) % pb->mEntrySize;
   }
 }