Title: [266560] trunk/Source/_javascript_Core
Revision
266560
Author
sbar...@apple.com
Date
2020-09-03 15:47:33 -0700 (Thu, 03 Sep 2020)

Log Message

Sampling profiler should dump hash as part of the top function key to prevent incorrectly grouping nameless functions together
https://bugs.webkit.org/show_bug.cgi?id=216087

Reviewed by Tadeu Zagallo.

* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::reportTopFunctions):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (266559 => 266560)


--- trunk/Source/_javascript_Core/ChangeLog	2020-09-03 21:43:41 UTC (rev 266559)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-09-03 22:47:33 UTC (rev 266560)
@@ -1,3 +1,13 @@
+2020-09-03  Saam Barati  <sbar...@apple.com>
+
+        Sampling profiler should dump hash as part of the top function key to prevent incorrectly grouping nameless functions together
+        https://bugs.webkit.org/show_bug.cgi?id=216087
+
+        Reviewed by Tadeu Zagallo.
+
+        * runtime/SamplingProfiler.cpp:
+        (JSC::SamplingProfiler::reportTopFunctions):
+
 2020-09-03  Devin Rousso  <drou...@apple.com>
 
         Web Inspector: allow url breakpoints to be configured

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp (266559 => 266560)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2020-09-03 21:43:41 UTC (rev 266559)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2020-09-03 22:47:33 UTC (rev 266560)
@@ -1030,7 +1030,14 @@
             continue;
 
         StackFrame& frame = stackTrace.frames.first();
-        String frameDescription = makeString(frame.displayName(m_vm), ':', frame.sourceID());
+        String hash = ""_s;
+        if (frame.semanticLocation.hasCodeBlockHash()) {
+            StringPrintStream stream;
+            frame.semanticLocation.codeBlockHash.dump(stream);
+            hash = stream.toString();
+        } else
+            hash = "<nil>"_s;
+        String frameDescription = makeString(frame.displayName(m_vm), '#', hash, ':', frame.sourceID());
         functionCounts.add(frameDescription, 0).iterator->value++;
     }
 
@@ -1050,7 +1057,7 @@
 
     if (Options::samplingProfilerTopFunctionsCount()) {
         out.print("\n\nSampling rate: ", m_timingInterval.microseconds(), " microseconds\n");
-        out.print("Top functions as <numSamples  'functionName:sourceID'>\n");
+        out.print("Top functions as <numSamples  'functionName#hash:sourceID'>\n");
         for (size_t i = 0; i < Options::samplingProfilerTopFunctionsCount(); i++) {
             auto pair = takeMax();
             if (pair.first.isEmpty())
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to