mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 11:11:11 +08:00
feat: 新增采样器按指令周期记录样本并输出热点直方图
This commit is contained in:
@@ -234,6 +234,15 @@ impl Vm {
|
||||
}
|
||||
}
|
||||
|
||||
// 指令周期采样:开启时(周期为 2 的幂)每 period 条指令记一条样本
|
||||
// (flat_id, pc, opcode, frames 深度),run 末聚合成 top-K 直方图;
|
||||
// 关闭时仅这一条可预测分支,零写零分配。
|
||||
if self.sampling.period != 0 && (steps & (self.sampling.period - 1)) == 0 {
|
||||
self.sampling
|
||||
.records
|
||||
.push((self.active_flat_id, pc as u32, op as u8, self.frames.len() as u32));
|
||||
}
|
||||
|
||||
match op {
|
||||
OpCode::NOP => {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user