Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit dc8fc11

Browse files
committed
新增数学表达式和字符串操作的JIT统计信息输出,提升性能报告的可读性和调试信息的丰富性。
1 parent e81bf49 commit dc8fc11

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

src/interpreter/jit.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2913,11 +2913,39 @@ pub fn print_jit_performance_report() {
29132913
}
29142914
}
29152915

2916+
// 数学表达式统计
2917+
println!("\n🧮 数学表达式JIT统计:");
2918+
println!(" 🔥 数学表达式热点数量: {}", stats.math_expression_hotspot_count);
2919+
println!(" ⚡ 成功编译的数学表达式数: {}", stats.compiled_math_expression_count);
2920+
println!(" 🔄 数学表达式总执行次数: {}", stats.total_math_expression_executions);
2921+
if stats.compiled_math_expression_count > 0 && stats.math_expression_hotspot_count > 0 {
2922+
let math_compilation_rate = (stats.compiled_math_expression_count as f64 / stats.math_expression_hotspot_count as f64) * 100.0;
2923+
println!(" 📈 数学表达式编译成功率: {:.1}%", math_compilation_rate);
2924+
if stats.total_math_expression_executions > 0 {
2925+
let avg_math_executions = stats.total_math_expression_executions as f64 / stats.math_expression_hotspot_count as f64;
2926+
println!(" 📊 数学表达式平均执行次数: {:.1}", avg_math_executions);
2927+
}
2928+
}
2929+
2930+
// 字符串操作统计
2931+
println!("\n📝 字符串操作JIT统计:");
2932+
println!(" 🔥 字符串操作热点数量: {}", stats.string_operation_hotspot_count);
2933+
println!(" ⚡ 成功编译的字符串操作数: {}", stats.compiled_string_operation_count);
2934+
println!(" 🔄 字符串操作总执行次数: {}", stats.total_string_operation_executions);
2935+
if stats.compiled_string_operation_count > 0 && stats.string_operation_hotspot_count > 0 {
2936+
let string_compilation_rate = (stats.compiled_string_operation_count as f64 / stats.string_operation_hotspot_count as f64) * 100.0;
2937+
println!(" 📈 字符串操作编译成功率: {:.1}%", string_compilation_rate);
2938+
if stats.total_string_operation_executions > 0 {
2939+
let avg_string_executions = stats.total_string_operation_executions as f64 / stats.string_operation_hotspot_count as f64;
2940+
println!(" 📊 字符串操作平均执行次数: {:.1}", avg_string_executions);
2941+
}
2942+
}
2943+
29162944
println!("=====================================");
29172945

29182946
// 总体状态
2919-
let total_compiled = stats.compiled_count + stats.compiled_loop_count;
2920-
let total_hotspots = stats.hotspot_count + stats.loop_hotspot_count;
2947+
let total_compiled = stats.compiled_count + stats.compiled_loop_count + stats.compiled_math_expression_count + stats.compiled_string_operation_count;
2948+
let total_hotspots = stats.hotspot_count + stats.loop_hotspot_count + stats.math_expression_hotspot_count + stats.string_operation_hotspot_count;
29212949

29222950
if total_compiled > 0 {
29232951
println!("✅ JIT编译器工作正常!");

0 commit comments

Comments
 (0)