Changeset 269597 in webkit
- Timestamp:
- Nov 9, 2020 1:18:08 PM (3 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r269576 r269597 1 2020-11-09 Keith Miller <keith_miller@apple.com> 2 3 Add total counts to sampling profiler dump 4 https://bugs.webkit.org/show_bug.cgi?id=218666 5 6 Reviewed by Yusuke Suzuki. 7 8 This is nice for computing the approximate percentage of total time in a function. 9 10 * runtime/SamplingProfiler.cpp: 11 (JSC::SamplingProfiler::reportTopFunctions): 12 (JSC::SamplingProfiler::reportTopBytecodes): 13 1 14 2020-11-08 Yusuke Suzuki <ysuzuki@apple.com> 2 15 -
trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp
r268077 r269597 1024 1024 } 1025 1025 1026 1026 size_t totalSamples = 0; 1027 1027 HashMap<String, size_t> functionCounts; 1028 1028 for (StackTrace& stackTrace : m_stackTraces) { … … 1040 1040 String frameDescription = makeString(frame.displayName(m_vm), '#', hash, ':', frame.sourceID()); 1041 1041 functionCounts.add(frameDescription, 0).iterator->value++; 1042 totalSamples++; 1042 1043 } 1043 1044 … … 1057 1058 1058 1059 if (Options::samplingProfilerTopFunctionsCount()) { 1059 out.print ("\n\nSampling rate: ", m_timingInterval.microseconds(), " microseconds\n");1060 out.print ("Top functions as <numSamples 'functionName#hash:sourceID'>\n");1060 out.println("\n\nSampling rate: ", m_timingInterval.microseconds(), " microseconds. Total samples: ", totalSamples); 1061 out.println("Top functions as <numSamples 'functionName#hash:sourceID'>"); 1061 1062 for (size_t i = 0; i < Options::samplingProfilerTopFunctionsCount(); i++) { 1062 1063 auto pair = takeMax(); … … 1064 1065 break; 1065 1066 out.printf("%6zu ", pair.second); 1066 out.print (" '", pair.first, "'\n");1067 out.println(" '", pair.first, "'"); 1067 1068 } 1068 1069 } … … 1084 1085 } 1085 1086 1087 size_t totalSamples = 0; 1086 1088 HashMap<String, size_t> bytecodeCounts; 1087 1089 for (StackTrace& stackTrace : m_stackTraces) { … … 1120 1122 } 1121 1123 bytecodeCounts.add(frameDescription, 0).iterator->value++; 1124 totalSamples++; 1122 1125 } 1123 1126 … … 1137 1140 1138 1141 if (Options::samplingProfilerTopBytecodesCount()) { 1139 out.print ("\n\nSampling rate: ", m_timingInterval.microseconds(), " microseconds\n");1140 out.print ("Hottest bytecodes as <numSamples 'functionName#hash:JITType:bytecodeIndex'>\n");1142 out.println("\n\nSampling rate: ", m_timingInterval.microseconds(), " microseconds. Total samples: ", totalSamples); 1143 out.println("Hottest bytecodes as <numSamples 'functionName#hash:JITType:bytecodeIndex'>"); 1141 1144 for (size_t i = 0; i < Options::samplingProfilerTopBytecodesCount(); i++) { 1142 1145 auto pair = takeMax(); … … 1144 1147 break; 1145 1148 out.printf("%6zu ", pair.second); 1146 out.print (" '", pair.first, "'\n");1149 out.println(" '", pair.first, "'"); 1147 1150 } 1148 1151 }
Note: See TracChangeset
for help on using the changeset viewer.