mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 03:01:12 +08:00
feat: 新增采样器按指令周期记录样本并输出热点直方图
This commit is contained in:
@@ -86,6 +86,11 @@ pub fn run_js_stress_bench(config: &BenchConfig, kernel: &Arc<KernelCore>, pool:
|
||||
let mut guard = pool.spawn();
|
||||
let vm = guard.vm_mut();
|
||||
|
||||
// 指令周期采样只对测量迭代开启:预热不采样,直方图不混入
|
||||
// 预热样本,stderr 输出也不随预热迭代重复。
|
||||
vm.set_sample_period(config.sample_period);
|
||||
vm.set_sample_top_k(config.sample_top);
|
||||
|
||||
let pre_session = vm.session_object_count();
|
||||
let pre_epoch = vm.epoch_object_count();
|
||||
|
||||
|
||||
@@ -32,6 +32,11 @@ pub struct BenchConfig {
|
||||
pub iterations: u32,
|
||||
pub update_baseline: bool,
|
||||
pub leak_check_interval: usize,
|
||||
/// 指令周期采样周期(2 的幂,0 关闭):开启时测量迭代每 period 条指令
|
||||
/// 记一条样本,run 末按 flat_id 输出 top-K 直方图。
|
||||
pub sample_period: u64,
|
||||
/// 采样直方图 top-K 大小(默认 10)。
|
||||
pub sample_top: usize,
|
||||
}
|
||||
|
||||
/// 按 mode 分派到具体 benchmark 实现(js/rust/leak)。
|
||||
|
||||
Reference in New Issue
Block a user