Title: [199800] trunk/Source/_javascript_Core
Revision
199800
Author
sbar...@apple.com
Date
2016-04-20 17:55:03 -0700 (Wed, 20 Apr 2016)

Log Message

Improve sampling profiler CLI JSC tool
https://bugs.webkit.org/show_bug.cgi?id=156824

Reviewed by Mark Lam.

This patch enhances the Sampling Profiler CLI tool from the JSC shell
to display the JITType of a particular CodeBlock. Because this happens
once we process a log of stack frames, the data for a particular frame
being in LLInt vs. Baseline could be wrong. For example, we may have taken 
a stack trace of a CodeBlock while it was executing in the LLInt, then 
it tiers up to the baseline, then we process the log. We will show such CodeBlocks
as being in the baseline JIT. We could be smarter about this in the future if
it turns out to truly be a problem.

This patch also adds a 'samplingProfilerTimingInterval' JSC option to allow
CLI users to control the sleep time between stack traces.

* jsc.cpp:
(jscmain):
* runtime/Options.h:
* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::SamplingProfiler):
(JSC::SamplingProfiler::processUnverifiedStackTraces):
(JSC::SamplingProfiler::reportTopBytecodes):
* runtime/SamplingProfiler.h:
(JSC::SamplingProfiler::StackFrame::hasExpressionInfo):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (199799 => 199800)


--- trunk/Source/_javascript_Core/ChangeLog	2016-04-21 00:35:18 UTC (rev 199799)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-04-21 00:55:03 UTC (rev 199800)
@@ -1,3 +1,32 @@
+2016-04-20  Saam barati  <sbar...@apple.com>
+
+        Improve sampling profiler CLI JSC tool
+        https://bugs.webkit.org/show_bug.cgi?id=156824
+
+        Reviewed by Mark Lam.
+
+        This patch enhances the Sampling Profiler CLI tool from the JSC shell
+        to display the JITType of a particular CodeBlock. Because this happens
+        once we process a log of stack frames, the data for a particular frame
+        being in LLInt vs. Baseline could be wrong. For example, we may have taken 
+        a stack trace of a CodeBlock while it was executing in the LLInt, then 
+        it tiers up to the baseline, then we process the log. We will show such CodeBlocks
+        as being in the baseline JIT. We could be smarter about this in the future if
+        it turns out to truly be a problem.
+
+        This patch also adds a 'samplingProfilerTimingInterval' JSC option to allow
+        CLI users to control the sleep time between stack traces.
+
+        * jsc.cpp:
+        (jscmain):
+        * runtime/Options.h:
+        * runtime/SamplingProfiler.cpp:
+        (JSC::SamplingProfiler::SamplingProfiler):
+        (JSC::SamplingProfiler::processUnverifiedStackTraces):
+        (JSC::SamplingProfiler::reportTopBytecodes):
+        * runtime/SamplingProfiler.h:
+        (JSC::SamplingProfiler::StackFrame::hasExpressionInfo):
+
 2016-04-20  Benjamin Poulain  <bpoul...@apple.com>
 
         [JSC] DFG should not generate two jumps when the target of DoubleBranch is the next block  

Modified: trunk/Source/_javascript_Core/jsc.cpp (199799 => 199800)


--- trunk/Source/_javascript_Core/jsc.cpp	2016-04-21 00:35:18 UTC (rev 199799)
+++ trunk/Source/_javascript_Core/jsc.cpp	2016-04-21 00:55:03 UTC (rev 199800)
@@ -2275,6 +2275,7 @@
 
     if (options.m_dumpSamplingProfilerData) {
 #if ENABLE(SAMPLING_PROFILER)
+        JSLockHolder locker(vm);
         vm->samplingProfiler()->reportTopFunctions();
         vm->samplingProfiler()->reportTopBytecodes();
 #else

Modified: trunk/Source/_javascript_Core/runtime/Options.h (199799 => 199800)


--- trunk/Source/_javascript_Core/runtime/Options.h	2016-04-21 00:35:18 UTC (rev 199799)
+++ trunk/Source/_javascript_Core/runtime/Options.h	2016-04-21 00:55:03 UTC (rev 199800)
@@ -318,6 +318,7 @@
     v(bool, useTypeProfiler, false, nullptr) \
     v(bool, useControlFlowProfiler, false, nullptr) \
     v(bool, useSamplingProfiler, false, nullptr) \
+    v(unsigned, samplingProfilerTimingInterval, 1000, "Time between stack traces in microseconds.") \
     v(bool, collectSamplingProfilerDataForJSCShell, false, "This corresponds to the JSC shell's --reportSamplingProfilerData option.") \
     v(bool, alwaysGeneratePCToCodeOriginMap, false, "This will make sure we always generate a PCToCodeOriginMap for JITed code.") \
     \

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp (199799 => 199800)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2016-04-21 00:35:18 UTC (rev 199799)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2016-04-21 00:55:03 UTC (rev 199800)
@@ -185,7 +185,7 @@
 SamplingProfiler::SamplingProfiler(VM& vm, RefPtr<Stopwatch>&& stopwatch)
     : m_vm(vm)
     , m_stopwatch(WTFMove(stopwatch))
-    , m_timingInterval(std::chrono::microseconds(1000))
+    , m_timingInterval(std::chrono::microseconds(Options::samplingProfilerTimingInterval()))
     , m_threadIdentifier(0)
     , m_jscExecutionThread(nullptr)
     , m_isPaused(false)
@@ -368,8 +368,10 @@
                     stackTrace.frames.last().lineNumber, stackTrace.frames.last().columnNumber);
                 stackTrace.frames.last().bytecodeIndex = bytecodeIndex;
             }
-            if (Options::collectSamplingProfilerDataForJSCShell())
+            if (Options::collectSamplingProfilerDataForJSCShell()) {
                 stackTrace.frames.last().codeBlockHash = codeBlock->hash();
+                stackTrace.frames.last().jitType = codeBlock->jitType();
+            }
         };
 
         auto appendEmptyFrame = [&] {
@@ -832,7 +834,7 @@
         } else
             codeBlockHash = "<nil>";
 
-        String frameDescription = makeString(frame.displayName(m_vm), "#", codeBlockHash, ":", bytecodeIndex);
+        String frameDescription = makeString(frame.displayName(m_vm), "#", codeBlockHash, ":", JITCode::typeName(frame.jitType), ":", bytecodeIndex);
         bytecodeCounts.add(frameDescription, 0).iterator->value++;
     }
 
@@ -851,7 +853,7 @@
     };
 
     dataLog("\n\nSampling rate: ", m_timingInterval.count(), " microseconds\n");
-    dataLog("Hottest bytecodes as <numSamples   'functionName#hash:bytecodeIndex'>\n");
+    dataLog("Hottest bytecodes as <numSamples   'functionName#hash:JITType:bytecodeIndex'>\n");
     for (size_t i = 0; i < 80; i++) {
         auto pair = takeMax();
         if (pair.first.isEmpty())

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.h (199799 => 199800)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.h	2016-04-21 00:35:18 UTC (rev 199799)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.h	2016-04-21 00:55:03 UTC (rev 199800)
@@ -30,6 +30,7 @@
 
 #include "CallFrame.h"
 #include "CodeBlockHash.h"
+#include "JITCode.h"
 #include "MachineStackMarker.h"
 #include <wtf/HashSet.h>
 #include <wtf/Lock.h>
@@ -86,6 +87,7 @@
         unsigned columnNumber { std::numeric_limits<unsigned>::max() };
         unsigned bytecodeIndex { std::numeric_limits<unsigned>::max() };
         CodeBlockHash codeBlockHash;
+        JITCode::JITType jitType { JITCode::None };
 
         bool hasExpressionInfo() const
         {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to