Bug 1129249 - Expose the element id in Gecko profiler for Restyle. r=dholbert r=benwa
authorchiajung hung <chung@mozilla.com>
Wed, 25 Feb 2015 23:16:00 +0100
changeset 230848 e3eb286a2f3fe58e788a98232cbaa162f5ac9363
parent 230847 75d7c2a466104ce045ca8adb76e324735e1db0fb
child 230849 ece86f9a9c3b7b99e639635c943b37a8217b6099
push id56127
push usercbook@mozilla.com
push dateThu, 26 Feb 2015 08:42:47 +0000
treeherdermozilla-inbound@b7e05aa7a82b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert, benwa
bugs1129249
milestone39.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 1129249 - Expose the element id in Gecko profiler for Restyle. r=dholbert r=benwa
layout/base/RestyleManager.cpp
tools/profiler/TableTicker.h
--- a/layout/base/RestyleManager.cpp
+++ b/layout/base/RestyleManager.cpp
@@ -3589,20 +3589,31 @@ ElementRestyler::ComputeStyleChangeFor(n
                                        nsChangeHint       aMinChange,
                                        RestyleTracker&    aRestyleTracker,
                                        nsRestyleHint      aRestyleHint,
                                        nsTArray<ContextToClear>&
                                          aContextsToClear,
                                        nsTArray<nsRefPtr<nsStyleContext>>&
                                          aSwappedStructOwners)
 {
-  PROFILER_LABEL("ElementRestyler", "ComputeStyleChangeFor",
-    js::ProfileEntry::Category::CSS);
-
   nsIContent* content = aFrame->GetContent();
+  nsAutoCString idStr;
+  if (profiler_is_active() && content) {
+    nsIAtom* id = content->GetID();
+    if (id) {
+      id->ToUTF8String(idStr);
+    } else {
+      idStr.AssignLiteral("?");
+    }
+  }
+
+  PROFILER_LABEL_PRINTF("ElementRestyler", "ComputeStyleChangeFor",
+                        js::ProfileEntry::Category::CSS,
+                        content ? "Element: %s" : "%s",
+                        content ? idStr.get() : "");
   if (aMinChange) {
     aChangeList->AppendChange(aFrame, content, aMinChange);
   }
 
   NS_ASSERTION(!aFrame->GetPrevContinuation(),
                "must start with the first continuation");
 
   // We want to start with this frame and walk all its next-in-flows,
--- a/tools/profiler/TableTicker.h
+++ b/tools/profiler/TableTicker.h
@@ -72,16 +72,17 @@ class TableTicker: public Sampler {
     mUnwinderThread = hasFeature(aFeatures, aFeatureCount, "unwinder") || sps_version2();
     mAddLeafAddresses = hasFeature(aFeatures, aFeatureCount, "leaf");
     mPrivacyMode = hasFeature(aFeatures, aFeatureCount, "privacy");
     mAddMainThreadIO = hasFeature(aFeatures, aFeatureCount, "mainthreadio");
     mProfileMemory = hasFeature(aFeatures, aFeatureCount, "memory");
     mTaskTracer = hasFeature(aFeatures, aFeatureCount, "tasktracer");
     mLayersDump = hasFeature(aFeatures, aFeatureCount, "layersdump");
     mDisplayListDump = hasFeature(aFeatures, aFeatureCount, "displaylistdump");
+    mProfileRestyle = hasFeature(aFeatures, aFeatureCount, "restyle");
 
 #if defined(XP_WIN)
     if (mProfilePower) {
       mIntelPowerGadget = new IntelPowerGadget();
       mProfilePower = mIntelPowerGadget->Init();
     }
 #endif
 
@@ -205,16 +206,17 @@ class TableTicker: public Sampler {
   bool ProfilePower() const { return mProfilePower; }
   bool ProfileThreads() const MOZ_OVERRIDE { return mProfileThreads; }
   bool InPrivacyMode() const { return mPrivacyMode; }
   bool AddMainThreadIO() const { return mAddMainThreadIO; }
   bool ProfileMemory() const { return mProfileMemory; }
   bool TaskTracer() const { return mTaskTracer; }
   bool LayersDump() const { return mLayersDump; }
   bool DisplayListDump() const { return mDisplayListDump; }
+  bool ProfileRestyle() const { return mProfileRestyle; }
 
 protected:
   // Called within a signal. This function must be reentrant
   virtual void UnwinderTick(TickSample* sample);
 
   // Called within a signal. This function must be reentrant
   virtual void InplaceTick(TickSample* sample);
 
@@ -232,16 +234,17 @@ protected:
   bool mProfileJS;
   bool mProfileGPU;
   bool mProfileThreads;
   bool mUnwinderThread;
   bool mProfileJava;
   bool mProfilePower;
   bool mLayersDump;
   bool mDisplayListDump;
+  bool mProfileRestyle;
 
   // Keep the thread filter to check against new thread that
   // are started while profiling
   char** mThreadNameFilters;
   uint32_t mFilterCount;
   bool mPrivacyMode;
   bool mAddMainThreadIO;
   bool mProfileMemory;