Bug 733792 - Leave original symbol addresses in the profile report. r=bgirard
authorMarkus Stange <mstange@themasta.com>
Fri, 09 Mar 2012 16:20:03 +0100
changeset 88649 34050c0da8444f5d21cc27bedb1b3582b8e8a073
parent 88648 d674eb1d1aa4f83bd0eb049c352784656f5104fb
child 88650 d8946e02941094ef76faf4e3f668f3bc5fdb099f
push id22213
push usermak77@bonardo.net
push dateSat, 10 Mar 2012 10:22:54 +0000
treeherdermozilla-central@7c071cef1797 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbgirard
bugs733792
milestone13.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 733792 - Leave original symbol addresses in the profile report. r=bgirard
tools/profiler/TableTicker.cpp
--- a/tools/profiler/TableTicker.cpp
+++ b/tools/profiler/TableTicker.cpp
@@ -159,17 +159,16 @@ class Profile
 public:
   Profile(int aEntrySize)
     : mWritePos(0)
     , mLastFlushPos(0)
     , mReadPos(0)
     , mEntrySize(aEntrySize)
   {
     mEntries = new ProfileEntry[mEntrySize];
-    mNeedsSharedLibraryInfo = true;
   }
 
   ~Profile()
   {
     delete[] mEntries;
   }
 
   void addTag(ProfileEntry aTag)
@@ -247,63 +246,44 @@ public:
 
   void erase()
   {
     mWritePos = mLastFlushPos;
   }
 
   void ToString(StringBuilder &profile)
   {
-    if (mNeedsSharedLibraryInfo) {
-      // Can't be called from signal because
-      // getting the shared library information can call non-reentrant functions.
-      mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
-    }
-
     //XXX: this code is not thread safe and needs to be fixed
     int oldReadPos = mReadPos;
     while (mReadPos != mLastFlushPos) {
       profile.Append(mEntries[mReadPos].TagToString(this).c_str());
       mReadPos = (mReadPos + 1) % mEntrySize;
     }
     mReadPos = oldReadPos;
   }
 
   void WriteProfile(FILE* stream)
   {
-    if (mNeedsSharedLibraryInfo) {
-      // Can't be called from signal because
-      // getting the shared library information can call non-reentrant functions.
-      mSharedLibraryInfo = SharedLibraryInfo::GetInfoForSelf();
-    }
-
     //XXX: this code is not thread safe and needs to be fixed
     int oldReadPos = mReadPos;
     while (mReadPos != mLastFlushPos) {
       string tag = mEntries[mReadPos].TagToString(this);
       fwrite(tag.data(), 1, tag.length(), stream);
       mReadPos = (mReadPos + 1) % mEntrySize;
     }
     mReadPos = oldReadPos;
   }
-
-  SharedLibraryInfo& getSharedLibraryInfo()
-  {
-    return mSharedLibraryInfo;
-  }
 private:
   // Circular buffer 'Keep One Slot Open' implementation
   // for simplicity
   ProfileEntry *mEntries;
   int mWritePos; // points to the next entry we will write to
   int mLastFlushPos; // points to the next entry since the last flush()
   int mReadPos;  // points to the next entry we will read to
   int mEntrySize;
-  bool mNeedsSharedLibraryInfo;
-  SharedLibraryInfo mSharedLibraryInfo;
 };
 
 class SaveProfileTask;
 
 static bool
 hasFeature(const char** aFeatures, uint32_t aFeatureCount, const char* aFeature) {
   for(size_t i = 0; i < aFeatureCount; i++) {
     if (strcmp(aFeatures[i], aFeature) == 0)
@@ -565,64 +545,30 @@ void TableTicker::Tick(TickSample* sampl
 string ProfileEntry::TagToString(Profile *profile)
 {
   string tag = "";
   if (mTagName == 'r') {
     char buff[50];
     snprintf(buff, 50, "%-40f", mTagFloat);
     tag += string(1, mTagName) + string("-") + string(buff) + string("\n");
   } else if (mTagName == 'l') {
-    bool found = false;
     char tagBuff[1024];
-    SharedLibraryInfo& shlibInfo = profile->getSharedLibraryInfo();
     Address pc = mTagAddress;
-    // TODO Use binary sort (STL)
-    for (size_t i = 0; i < shlibInfo.GetSize(); i++) {
-      SharedLibrary &e = shlibInfo.GetEntry(i);
-      if (pc > (Address)e.GetStart() && pc < (Address)e.GetEnd()) {
-        if (e.GetName()) {
-          found = true;
-
-          snprintf(tagBuff, 1024, "l-%s@%p\n", e.GetName(), pc - e.GetStart());
-          tag += string(tagBuff);
-
-          break;
-        }
-      }
-    }
-    if (!found) {
-      snprintf(tagBuff, 1024, "l-???@%p\n", pc);
-      tag += string(tagBuff);
-    }
+    snprintf(tagBuff, 1024, "l-%p\n", pc);
+    tag += string(tagBuff);
   } else {
     tag += string(1, mTagName) + string("-") + string(mTagData) + string("\n");
   }
 
 #ifdef ENABLE_SPS_LEAF_DATA
   if (mLeafAddress) {
-    bool found = false;
     char tagBuff[1024];
-    SharedLibraryInfo& shlibInfo = profile->getSharedLibraryInfo();
     unsigned long pc = (unsigned long)mLeafAddress;
-    // TODO Use binary sort (STL)
-    for (size_t i = 0; i < shlibInfo.GetSize(); i++) {
-      SharedLibrary &e = shlibInfo.GetEntry(i);
-      if (pc > e.GetStart() && pc < e.GetEnd()) {
-        if (e.GetName()) {
-          found = true;
-          snprintf(tagBuff, 1024, "l-%900s@%llu\n", e.GetName(), pc - e.GetStart());
-          tag += string(tagBuff);
-          break;
-        }
-      }
-    }
-    if (!found) {
-      snprintf(tagBuff, 1024, "l-???@%llu\n", pc);
-      tag += string(tagBuff);
-    }
+    snprintf(tagBuff, 1024, "l-%llu\n", pc);
+    tag += string(tagBuff);
   }
 #endif
   return tag;
 }
 
 #define PROFILE_DEFAULT_ENTRY 100000
 #define PROFILE_DEFAULT_INTERVAL 10
 #define PROFILE_DEFAULT_FEATURES NULL