diff --git a/tools/profiler/TableTicker.cpp b/tools/profiler/TableTicker.cpp index addbf233e8f..378dd5bef09 100644 --- a/tools/profiler/TableTicker.cpp +++ b/tools/profiler/TableTicker.cpp @@ -119,27 +119,33 @@ class ProfileEntry public: ProfileEntry() : mTagData(NULL) + , mLeafAddress(0) , mTagName(0) { } // aTagData must not need release (i.e. be a string from the text segment) ProfileEntry(char aTagName, const char *aTagData) : mTagData(aTagData) + , mLeafAddress(0) + , mTagName(aTagName) + { } + + // aTagData must not need release (i.e. be a string from the text segment) + ProfileEntry(char aTagName, const char *aTagData, Address aLeafAddress) + : mTagData(aTagData) + , mLeafAddress(aLeafAddress) , mTagName(aTagName) { } ProfileEntry(char aTagName, double aTagFloat) : mTagFloat(aTagFloat) + , mLeafAddress(0) , mTagName(aTagName) { } ProfileEntry(char aTagName, uintptr_t aTagOffset) : mTagOffset(aTagOffset) - , mTagName(aTagName) - { } - - ProfileEntry(char aTagName, Address aTagAddress) - : mTagAddress(aTagAddress) + , mLeafAddress(0) , mTagName(aTagName) { } @@ -153,6 +159,7 @@ private: Address mTagAddress; uintptr_t mTagOffset; }; + Address mLeafAddress; char mTagName; }; @@ -575,17 +582,15 @@ void doSampleStackTrace(ProfileStack *aStack, ThreadProfile &aProfile, TickSampl // followed by 0 or more 'c' tags. for (mozilla::sig_safe_t i = 0; i < aStack->mStackPointer; i++) { if (i == 0) { - aProfile.addTag(ProfileEntry('s', aStack->mStack[i])); + Address pc = 0; + if (sample) { + pc = sample->pc; + } + aProfile.addTag(ProfileEntry('s', aStack->mStack[i], pc)); } else { aProfile.addTag(ProfileEntry('c', aStack->mStack[i])); } } -#ifdef ENABLE_SPS_LEAF_DATA - if (sample) { - Address pc = sample->pc; - aProfile.addTag(ProfileEntry('l', sample->pc)); - } -#endif } /* used to keep track of the last event that we sampled during */ @@ -674,6 +679,12 @@ std::ostream& operator<<(std::ostream& stream, const ProfileEntry& entry) } else { stream << entry.mTagName << "-" << entry.mTagData << "\n"; } + +#ifdef ENABLE_SPS_LEAF_DATA + if (entry.mLeafAddress) { + stream << entry.mTagName << "-" << entry.mLeafAddress << "\n"; + } +#endif return stream; }