Changeset 245499 in webkit
- Timestamp:
- May 18, 2019, 12:12:17 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/jit/ExecutableAllocator.cpp (modified) (3 diffs)
-
Source/JavaScriptCore/runtime/Options.h (modified) (1 diff)
-
Source/WTF/ChangeLog (modified) (1 diff)
-
Source/WTF/wtf/SystemTracing.h (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/Tracing/SystemTracePoints.plist (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r245496 r245499 1 2019-05-18 Tadeu Zagallo <tzagallo@apple.com> 2 3 Add extra information to dumpJITMemory 4 https://bugs.webkit.org/show_bug.cgi?id=197998 5 6 Reviewed by Saam Barati. 7 8 Add ktrace events around the memory dump and mach_absolute_time to link the 9 events with the entries in the dump. Additionally, add a background queue 10 to flush on a configurable interval, since the atexit callback does not work 11 in every situation. 12 13 * jit/ExecutableAllocator.cpp: 14 (JSC::dumpJITMemory): 15 * runtime/Options.h: 16 1 17 2019-05-17 Justin Michaud <justin_michaud@apple.com> 2 18 -
trunk/Source/JavaScriptCore/jit/ExecutableAllocator.cpp
r244483 r245499 34 34 #include <wtf/MetaAllocator.h> 35 35 #include <wtf/PageReservation.h> 36 #include <wtf/SystemTracing.h> 37 #include <wtf/WorkQueue.h> 36 38 37 39 #if OS(DARWIN) 40 #include <mach/mach_time.h> 38 41 #include <sys/mman.h> 39 42 #endif … … 560 563 static constexpr size_t bufferSize = fixedExecutableMemoryPoolSize; 561 564 static size_t offset = 0; 562 static auto flush = [] { 565 static Lock dumpJITMemoryLock; 566 static bool needsToFlush = false; 567 static auto flush = [](const AbstractLocker&) { 563 568 if (fd == -1) { 564 569 fd = open(Options::dumpJITMemoryPath(), O_CREAT | O_TRUNC | O_APPEND | O_WRONLY | O_EXLOCK | O_NONBLOCK, 0666); … … 567 572 write(fd, buffer, offset); 568 573 offset = 0; 574 needsToFlush = false; 569 575 }; 570 576 571 static Lock dumpJITMemoryLock;572 577 static std::once_flag once; 578 static LazyNeverDestroyed<Ref<WorkQueue>> flushQueue; 573 579 std::call_once(once, [] { 574 580 buffer = bitwise_cast<uint8_t*>(malloc(bufferSize)); 581 flushQueue.construct(WorkQueue::create("jsc.dumpJITMemory.queue", WorkQueue::Type::Serial, WorkQueue::QOS::Background)); 575 582 std::atexit([] { 576 583 LockHolder locker(dumpJITMemoryLock); 577 flush( );584 flush(locker); 578 585 close(fd); 586 fd = -1; 579 587 }); 580 588 }); 581 589 582 static auto write = [](const void* src, size_t size) { 590 static auto enqueueFlush = [](const AbstractLocker&) { 591 if (needsToFlush) 592 return; 593 594 needsToFlush = true; 595 flushQueue.get()->dispatchAfter(Seconds(Options::dumpJITMemoryFlushInterval()), [] { 596 LockHolder locker(dumpJITMemoryLock); 597 if (!needsToFlush) 598 return; 599 flush(locker); 600 }); 601 }; 602 603 static auto write = [](const AbstractLocker& locker, const void* src, size_t size) { 583 604 if (UNLIKELY(offset + size > bufferSize)) 584 flush( );605 flush(locker); 585 606 memcpy(buffer + offset, src, size); 586 607 offset += size; 608 enqueueFlush(locker); 587 609 }; 588 610 589 611 LockHolder locker(dumpJITMemoryLock); 612 uint64_t time = mach_absolute_time(); 590 613 uint64_t dst64 = bitwise_cast<uintptr_t>(dst); 591 write(&dst64, sizeof(dst64));592 614 uint64_t size64 = size; 593 write(&size64, sizeof(size64)); 594 write(src, size); 615 TraceScope(DumpJITMemoryStart, DumpJITMemoryStop, time, dst64, size64); 616 write(locker, &time, sizeof(time)); 617 write(locker, &dst64, sizeof(dst64)); 618 write(locker, &size64, sizeof(size64)); 619 write(locker, src, size); 595 620 #else 596 621 UNUSED_PARAM(dst); -
trunk/Source/JavaScriptCore/runtime/Options.h
r245496 r245499 520 520 v(double, validateAbstractInterpreterStateProbability, 0.5, Normal, nullptr) \ 521 521 v(optionString, dumpJITMemoryPath, nullptr, Restricted, nullptr) \ 522 v(double, dumpJITMemoryFlushInterval, 10, Restricted, "Maximum time in between flushes of the JIT memory dump in seconds.") \ 522 523 523 524 -
trunk/Source/WTF/ChangeLog
r245492 r245499 1 2019-05-18 Tadeu Zagallo <tzagallo@apple.com> 2 3 Add extra information to dumpJITMemory 4 https://bugs.webkit.org/show_bug.cgi?id=197998 5 6 Reviewed by Saam Barati. 7 8 Add a new trace point code for JSC::dumpJITMemory 9 10 * wtf/SystemTracing.h: 11 1 12 2019-05-17 Don Olmstead <don.olmstead@sony.com> 2 13 -
trunk/Source/WTF/wtf/SystemTracing.h
r244182 r245499 48 48 WebAssemblyExecuteStart, 49 49 WebAssemblyExecuteEnd, 50 DumpJITMemoryStart, 51 DumpJITMemoryStop, 50 52 51 53 WebCoreRange = 5000, -
trunk/Tools/ChangeLog
r245496 r245499 1 2019-05-18 Tadeu Zagallo <tzagallo@apple.com> 2 3 Add extra information to dumpJITMemory 4 https://bugs.webkit.org/show_bug.cgi?id=197998 5 6 Reviewed by Saam Barati. 7 8 Add description for the new dumpJITMemory trace point code. 9 10 * Tracing/SystemTracePoints.plist: 11 1 12 2019-05-17 Justin Michaud <justin_michaud@apple.com> 2 13 -
trunk/Tools/Tracing/SystemTracePoints.plist
r244182 r245499 46 46 <dict> 47 47 <key>Name</key> 48 <string>Dump JIT Memory</string> 49 <key>Type</key> 50 <string>Interval</string> 51 <key>Component</key> 52 <string>47</string> 53 <key>CodeBegin</key> 54 <string>2507</string> 55 <key>CodeEnd</key> 56 <string>2508</string> 57 </dict> 58 <dict> 59 <key>Name</key> 48 60 <string>Main Resource Load</string> 49 61 <key>Type</key>
Note:
See TracChangeset
for help on using the changeset viewer.