Changeset 97203 in webkit for trunk/Source/JavaScriptCore/heap/Heap.cpp
- Timestamp:
- Oct 11, 2011, 5:24:12 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/heap/Heap.cpp
r96760 r97203 44 44 static const size_t largeHeapSize = 16 * 1024 * 1024; 45 45 static const size_t smallHeapSize = 512 * 1024; 46 46 #define ENABLE_GC_LOGGING 1 47 47 #if ENABLE(GC_LOGGING) 48 48 #if COMPILER(CLANG) 49 #define DEFINE_GC_LOGGING_GLOBAL(type, name, arguments) \ 50 _Pragma("clang diagnostic push") \ 51 _Pragma("clang diagnostic ignored \"-Wglobal-constructors\"") \ 52 _Pragma("clang diagnostic ignored \"-Wexit-time-destructors\"") \ 53 static type name arguments; \ 54 _Pragma("clang diagnostic pop") 55 #else 56 #define DEFINE_GC_LOGGING_GLOBAL(type, name, arguments) \ 57 static type name arguments; 58 #endif // COMPILER(CLANG) 59 49 60 struct GCTimer { 50 61 GCTimer(const char* name) … … 87 98 }; 88 99 89 #define GCPHASE(name) static GCTimer name##Timer(#name); GCTimerScope name##TimerScope(&name##Timer) 90 #define COND_GCPHASE(cond, name1, name2) static GCTimer name1##Timer(#name1); static GCTimer name2##Timer(#name2); GCTimerScope name1##CondTimerScope(cond ? &name1##Timer : &name2##Timer) 91 100 struct GCCounter { 101 GCCounter(const char* name) 102 : m_name(name) 103 , m_count(0) 104 , m_total(0) 105 , m_min(10000000) 106 , m_max(0) 107 { 108 } 109 110 void count(size_t amount) 111 { 112 m_count++; 113 m_total += amount; 114 if (amount < m_min) 115 m_min = amount; 116 if (amount > m_max) 117 m_max = amount; 118 } 119 ~GCCounter() 120 { 121 printf("%s: %zu values (avg. %zu, min. %zu, max. %zu)\n", m_name, m_total, m_total / m_count, m_min, m_max); 122 } 123 const char* m_name; 124 size_t m_count; 125 size_t m_total; 126 size_t m_min; 127 size_t m_max; 128 }; 129 130 #define GCPHASE(name) DEFINE_GC_LOGGING_GLOBAL(GCTimer, name##Timer, (#name)); GCTimerScope name##TimerScope(&name##Timer) 131 #define COND_GCPHASE(cond, name1, name2) DEFINE_GC_LOGGING_GLOBAL(GCTimer, name1##Timer, (#name1)); DEFINE_GC_LOGGING_GLOBAL(GCTimer, name2##Timer, (#name2)); GCTimerScope name1##CondTimerScope(cond ? &name1##Timer : &name2##Timer) 132 #define GCCOUNTER(name, value) do { DEFINE_GC_LOGGING_GLOBAL(GCCounter, name##Counter, (#name)); name##Counter.count(value); } while (false) 133 92 134 #else 93 135 94 136 #define GCPHASE(name) do { } while (false) 95 137 #define COND_GCPHASE(cond, name1, name2) do { } while (false) 96 138 #define GCCOUNTER(name, value) do { } while (false) 97 139 #endif 98 140 … … 549 591 550 592 #if ENABLE(GGC) 551 if (size_t dirtyCellCount = dirtyCells.size()) { 593 { 594 size_t dirtyCellCount = dirtyCells.size(); 552 595 GCPHASE(VisitDirtyCells); 596 GCCOUNTER(DirtyCellCount, dirtyCellCount); 553 597 for (size_t i = 0; i < dirtyCellCount; i++) { 554 598 heapRootVisitor.visitChildren(dirtyCells[i]); … … 622 666 } while (lastOpaqueRootCount != visitor.opaqueRootCount()); 623 667 } 668 GCCOUNTER(VisitedValueCount, visitor.visitCount()); 624 669 visitor.reset(); 625 670
Note:
See TracChangeset
for help on using the changeset viewer.