Mercurial > hg > truffle
comparison src/share/vm/compiler/compileBroker.cpp @ 12779:f6c511451e4a
made Graal report its compilation info under -XX:+CITime in the same format as c1 and c2
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 19 Nov 2013 01:31:19 +0100 |
parents | 359f7e70ae7f |
children | 096c224171c4 |
comparison
equal
deleted
inserted
replaced
12778:c125485642e2 | 12779:f6c511451e4a |
---|---|
2123 | 2123 |
2124 _t_total_compilation.add(time); | 2124 _t_total_compilation.add(time); |
2125 _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time; | 2125 _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time; |
2126 | 2126 |
2127 if (CITime) { | 2127 if (CITime) { |
2128 int bytes_compiled = method->code_size() + task->num_inlined_bytecodes(); | |
2129 GRAAL_ONLY(CompilerStatistics* stats = compiler(task->comp_level())->stats();) | |
2128 if (is_osr) { | 2130 if (is_osr) { |
2129 _t_osr_compilation.add(time); | 2131 _t_osr_compilation.add(time); |
2130 _sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); | 2132 _sum_osr_bytes_compiled += bytes_compiled; |
2131 #ifdef GRAAL | 2133 GRAAL_ONLY(stats->_osr.update(time, bytes_compiled);) |
2132 compiler(task->comp_level())->stats()->_t_osr_compilation.add(time); | |
2133 compiler(task->comp_level())->stats()->_sum_osr_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); | |
2134 #endif | |
2135 } else { | 2134 } else { |
2136 _t_standard_compilation.add(time); | 2135 _t_standard_compilation.add(time); |
2137 _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); | 2136 _sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); |
2138 #ifdef GRAAL | 2137 GRAAL_ONLY(stats->_standard.update(time, bytes_compiled);) |
2139 compiler(task->comp_level())->stats()->_t_standard_compilation.add(time); | |
2140 compiler(task->comp_level())->stats()->_sum_standard_bytes_compiled += method->code_size() + task->num_inlined_bytecodes(); | |
2141 #endif | |
2142 } | 2138 } |
2139 GRAAL_ONLY(stats->_nmethods_size += code->total_size();) | |
2140 GRAAL_ONLY(stats->_nmethods_code_size += code->insts_size();) | |
2143 } | 2141 } |
2144 | 2142 |
2145 if (UsePerfData) { | 2143 if (UsePerfData) { |
2146 // save the name of the last method compiled | 2144 // save the name of the last method compiled |
2147 _perf_last_method->set_value(counters->current_method()); | 2145 _perf_last_method->set_value(counters->current_method()); |
2194 return (comp->name()); | 2192 return (comp->name()); |
2195 } | 2193 } |
2196 } | 2194 } |
2197 | 2195 |
2198 void CompileBroker::print_times() { | 2196 void CompileBroker::print_times() { |
2197 #ifdef GRAAL | |
2198 elapsedTimer standard_compilation; | |
2199 elapsedTimer total_compilation; | |
2200 elapsedTimer osr_compilation; | |
2201 | |
2202 int standard_bytes_compiled = 0; | |
2203 int osr_bytes_compiled = 0; | |
2204 | |
2205 int standard_compile_count = 0; | |
2206 int osr_compile_count = 0; | |
2207 int total_compile_count = 0; | |
2208 | |
2209 int nmethods_size = 0; | |
2210 int nmethods_code_size = 0; | |
2211 bool printedHeader = false; | |
2212 | |
2213 for (unsigned int i = 0; i < sizeof(_compilers) / sizeof(AbstractCompiler*); i++) { | |
2214 AbstractCompiler* comp = _compilers[i]; | |
2215 if (comp != NULL) { | |
2216 if (!printedHeader) { | |
2217 printedHeader = true; | |
2218 tty->cr(); | |
2219 tty->print_cr("Individual compiler times (for compiled methods only)"); | |
2220 tty->print_cr("------------------------------------------------"); | |
2221 tty->cr(); | |
2222 } | |
2223 CompilerStatistics* stats = comp->stats(); | |
2224 | |
2225 standard_compilation.add(stats->_standard._time); | |
2226 osr_compilation.add(stats->_osr._time); | |
2227 | |
2228 standard_bytes_compiled += stats->_standard._bytes; | |
2229 osr_bytes_compiled += stats->_osr._bytes; | |
2230 | |
2231 standard_compile_count += stats->_standard._count; | |
2232 osr_compile_count += stats->_osr._count; | |
2233 | |
2234 nmethods_size += stats->_nmethods_size; | |
2235 nmethods_code_size += stats->_nmethods_code_size; | |
2236 | |
2237 tty->print_cr(" %s { speed: %d bytes/s; standard: %6.3f s, %d bytes, %d methods; osr: %6.3f s, %d bytes, %d methods; nmethods_size: %d bytes; nmethods_code_size: %d bytes}", | |
2238 comp->name(), stats->bytes_per_second(), | |
2239 stats->_standard._time.seconds(), stats->_standard._bytes, stats->_standard._count, | |
2240 stats->_osr._time.seconds(), stats->_osr._bytes, stats->_osr._count, | |
2241 stats->_nmethods_size, stats->_nmethods_code_size); | |
2242 } | |
2243 } | |
2244 total_compile_count = osr_compile_count + standard_compile_count; | |
2245 total_compilation.add(osr_compilation); | |
2246 total_compilation.add(standard_compilation); | |
2247 #else | |
2248 elapsedTimer standard_compilation = CompileBroker::_t_standard_compilation; | |
2249 elapsedTimer osr_compilation = CompileBroker::_t_osr_compilation; | |
2250 elapsedTimer total_compilation = CompileBroker::_t_total_compilation; | |
2251 | |
2252 int standard_bytes_compiled = CompileBroker::_sum_standard_bytes_compiled; | |
2253 int osr_bytes_compiled = CompileBroker::_sum_osr_bytes_compiled; | |
2254 | |
2255 int standard_compile_count = CompileBroker::_total_standard_compile_count; | |
2256 int osr_compile_count = CompileBroker::_total_osr_compile_count; | |
2257 int total_compile_count = CompileBroker::_total_compile_count; | |
2258 | |
2259 int nmethods_size = CompileBroker::_sum_nmethod_code_size; | |
2260 int nmethods_code_size = CompileBroker::_sum_nmethod_size; | |
2261 #endif | |
2262 | |
2199 tty->cr(); | 2263 tty->cr(); |
2200 tty->print_cr("Accumulated compiler times (for compiled methods only)"); | 2264 tty->print_cr("Accumulated compiler times (for compiled methods only)"); |
2201 tty->print_cr("------------------------------------------------"); | 2265 tty->print_cr("------------------------------------------------"); |
2202 //0000000000111111111122222222223333333333444444444455555555556666666666 | 2266 //0000000000111111111122222222223333333333444444444455555555556666666666 |
2203 //0123456789012345678901234567890123456789012345678901234567890123456789 | 2267 //0123456789012345678901234567890123456789012345678901234567890123456789 |
2204 tty->print_cr(" Total compilation time : %6.3f s", CompileBroker::_t_total_compilation.seconds()); | 2268 tty->print_cr(" Total compilation time : %6.3f s", total_compilation.seconds()); |
2205 tty->print_cr(" Standard compilation : %6.3f s, Average : %2.3f", | 2269 tty->print_cr(" Standard compilation : %6.3f s, Average : %2.3f", |
2206 CompileBroker::_t_standard_compilation.seconds(), | 2270 standard_compilation.seconds(), |
2207 CompileBroker::_t_standard_compilation.seconds() / CompileBroker::_total_standard_compile_count); | 2271 standard_compilation.seconds() / standard_compile_count); |
2208 tty->print_cr(" On stack replacement : %6.3f s, Average : %2.3f", CompileBroker::_t_osr_compilation.seconds(), CompileBroker::_t_osr_compilation.seconds() / CompileBroker::_total_osr_compile_count); | 2272 tty->print_cr(" On stack replacement : %6.3f s, Average : %2.3f", osr_compilation.seconds(), osr_compilation.seconds() / osr_compile_count); |
2209 | 2273 |
2210 AbstractCompiler *comp = compiler(CompLevel_simple); | 2274 AbstractCompiler *comp = compiler(CompLevel_simple); |
2211 if (comp != NULL) { | 2275 if (comp != NULL) { |
2212 comp->print_timers(); | 2276 comp->print_timers(); |
2213 } | 2277 } |
2214 comp = compiler(CompLevel_full_optimization); | 2278 comp = compiler(CompLevel_full_optimization); |
2215 if (comp != NULL) { | 2279 if (comp != NULL) { |
2216 comp->print_timers(); | 2280 comp->print_timers(); |
2217 } | 2281 } |
2218 tty->cr(); | 2282 tty->cr(); |
2219 tty->print_cr(" Total compiled methods : %6d methods", CompileBroker::_total_compile_count); | 2283 tty->print_cr(" Total compiled methods : %6d methods", total_compile_count); |
2220 tty->print_cr(" Standard compilation : %6d methods", CompileBroker::_total_standard_compile_count); | 2284 tty->print_cr(" Standard compilation : %6d methods", standard_compile_count); |
2221 tty->print_cr(" On stack replacement : %6d methods", CompileBroker::_total_osr_compile_count); | 2285 tty->print_cr(" On stack replacement : %6d methods", osr_compile_count); |
2222 int tcb = CompileBroker::_sum_osr_bytes_compiled + CompileBroker::_sum_standard_bytes_compiled; | 2286 int tcb = osr_bytes_compiled + standard_bytes_compiled; |
2223 tty->print_cr(" Total compiled bytecodes : %6d bytes", tcb); | 2287 tty->print_cr(" Total compiled bytecodes : %6d bytes", tcb); |
2224 tty->print_cr(" Standard compilation : %6d bytes", CompileBroker::_sum_standard_bytes_compiled); | 2288 tty->print_cr(" Standard compilation : %6d bytes", standard_bytes_compiled); |
2225 tty->print_cr(" On stack replacement : %6d bytes", CompileBroker::_sum_osr_bytes_compiled); | 2289 tty->print_cr(" On stack replacement : %6d bytes", osr_bytes_compiled); |
2226 double tcs = CompileBroker::_t_total_compilation.seconds(); | 2290 double tcs = total_compilation.seconds(); |
2227 int bps = tcs == 0.0 ? 0 : (int)(tcb / tcs); | 2291 int bps = tcs == 0.0 ? 0 : (int)(tcb / tcs); |
2228 tty->print_cr(" Average compilation speed: %6d bytes/s", bps); | 2292 tty->print_cr(" Average compilation speed: %6d bytes/s", bps); |
2229 #ifdef GRAAL | |
2230 for (unsigned int i = 0; i < sizeof(_compilers) / sizeof(AbstractCompiler*); i++) { | |
2231 AbstractCompiler* comp = _compilers[i]; | |
2232 if (comp != NULL) { | |
2233 CompilerStatistics* stats = comp->stats(); | |
2234 int bytecodes = stats->_sum_osr_bytes_compiled + stats->_sum_standard_bytes_compiled; | |
2235 if (bytecodes != 0) { | |
2236 double seconds = stats->_t_osr_compilation.seconds() + stats->_t_standard_compilation.seconds(); | |
2237 int bps = seconds == 0.0 ? 0 : (int) (bytecodes / seconds); | |
2238 tty->print_cr(" %7s compilation speed: %6d bytes/s {standard: %6.3f s, %6d bytes; osr: %6.3f s, %6d bytes}", | |
2239 comp->name(), bps, stats->_t_standard_compilation.seconds(), stats->_sum_standard_bytes_compiled, | |
2240 stats->_t_osr_compilation.seconds(), stats->_sum_osr_bytes_compiled); | |
2241 } | |
2242 } | |
2243 } | |
2244 #endif | |
2245 tty->cr(); | 2293 tty->cr(); |
2246 tty->print_cr(" nmethod code size : %6d bytes", CompileBroker::_sum_nmethod_code_size); | 2294 tty->print_cr(" nmethod code size : %6d bytes", nmethods_code_size); |
2247 tty->print_cr(" nmethod total size : %6d bytes", CompileBroker::_sum_nmethod_size); | 2295 tty->print_cr(" nmethod total size : %6d bytes", nmethods_size); |
2248 } | 2296 } |
2249 | 2297 |
2250 // Debugging output for failure | 2298 // Debugging output for failure |
2251 void CompileBroker::print_last_compile() { | 2299 void CompileBroker::print_last_compile() { |
2252 if ( _last_compile_level != CompLevel_none && | 2300 if ( _last_compile_level != CompLevel_none && |