Title: [230956] trunk/Source/_javascript_Core
Revision
230956
Author
[email protected]
Date
2018-04-24 08:53:15 -0700 (Tue, 24 Apr 2018)

Log Message

$vm.totalGCTime() should be a thing
https://bugs.webkit.org/show_bug.cgi?id=184916

Reviewed by Sam Weinig.
        
When debugging regressions in tests that are GC heavy, it's nice to be able to query the total
time spent in GC to determine if the regression is because the GC got slower.
        
This adds $vm.totalGCTime(), which tells you the total time spent in GC, in seconds.

* heap/Heap.cpp:
(JSC::Heap::runEndPhase):
* heap/Heap.h:
(JSC::Heap::totalGCTime const):
* tools/JSDollarVM.cpp:
(JSC::functionTotalGCTime):
(JSC::JSDollarVM::finishCreation):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (230955 => 230956)


--- trunk/Source/_javascript_Core/ChangeLog	2018-04-24 15:27:46 UTC (rev 230955)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-04-24 15:53:15 UTC (rev 230956)
@@ -1,3 +1,23 @@
+2018-04-24  Filip Pizlo  <[email protected]>
+
+        $vm.totalGCTime() should be a thing
+        https://bugs.webkit.org/show_bug.cgi?id=184916
+
+        Reviewed by Sam Weinig.
+        
+        When debugging regressions in tests that are GC heavy, it's nice to be able to query the total
+        time spent in GC to determine if the regression is because the GC got slower.
+        
+        This adds $vm.totalGCTime(), which tells you the total time spent in GC, in seconds.
+
+        * heap/Heap.cpp:
+        (JSC::Heap::runEndPhase):
+        * heap/Heap.h:
+        (JSC::Heap::totalGCTime const):
+        * tools/JSDollarVM.cpp:
+        (JSC::functionTotalGCTime):
+        (JSC::JSDollarVM::finishCreation):
+
 2018-04-23  Zalan Bujtas  <[email protected]>
 
         [LayoutFormattingContext] Initial commit.

Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (230955 => 230956)


--- trunk/Source/_javascript_Core/heap/Heap.cpp	2018-04-24 15:27:46 UTC (rev 230955)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp	2018-04-24 15:53:15 UTC (rev 230956)
@@ -1512,6 +1512,7 @@
 
     m_lastGCStartTime = m_currentGCStartTime;
     m_lastGCEndTime = MonotonicTime::now();
+    m_totalGCTime += m_lastGCEndTime - m_lastGCStartTime;
         
     return changePhase(conn, CollectorPhase::NotRunning);
 }

Modified: trunk/Source/_javascript_Core/heap/Heap.h (230955 => 230956)


--- trunk/Source/_javascript_Core/heap/Heap.h	2018-04-24 15:27:46 UTC (rev 230955)
+++ trunk/Source/_javascript_Core/heap/Heap.h	2018-04-24 15:53:15 UTC (rev 230956)
@@ -382,6 +382,8 @@
     void forEachSlotVisitor(const Func&);
     
     ThreadLocalCacheLayout& threadLocalCacheLayout() { return *m_threadLocalCacheLayout; }
+    
+    Seconds totalGCTime() const { return m_totalGCTime; }
 
 private:
     friend class AllocatingScope;
@@ -723,6 +725,7 @@
     MonotonicTime m_lastGCStartTime;
     MonotonicTime m_lastGCEndTime;
     MonotonicTime m_currentGCStartTime;
+    Seconds m_totalGCTime;
     
     uintptr_t m_barriersExecuted { 0 };
     

Modified: trunk/Source/_javascript_Core/tools/JSDollarVM.cpp (230955 => 230956)


--- trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2018-04-24 15:27:46 UTC (rev 230955)
+++ trunk/Source/_javascript_Core/tools/JSDollarVM.cpp	2018-04-24 15:53:15 UTC (rev 230956)
@@ -1763,6 +1763,12 @@
     return JSValue::encode(jsNumber(static_cast<int32_t>(delta)));
 }
 
+static EncodedJSValue JSC_HOST_CALL functionTotalGCTime(ExecState* exec)
+{
+    VM& vm = exec->vm();
+    return JSValue::encode(jsNumber(vm.heap.totalGCTime().seconds()));
+}
+
 void JSDollarVM::finishCreation(VM& vm)
 {
     Base::finishCreation(vm);
@@ -1850,6 +1856,8 @@
     addFunction(vm, "createCustomTestGetterSetter", functionCreateCustomTestGetterSetter, 1);
 
     addFunction(vm, "deltaBetweenButterflies", functionDeltaBetweenButterflies, 2);
+    
+    addFunction(vm, "totalGCTime", functionTotalGCTime, 0);
 }
 
 void JSDollarVM::addFunction(VM& vm, JSGlobalObject* globalObject, const char* name, NativeFunction function, unsigned arguments)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to