From 3d63b06faee13536710fc7db08979797182684fb Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Tue, 3 Jan 2023 22:21:26 -0800 Subject: Only update histogram when histogramming This is worth a 1.4x speedup on the slow path (when not histogramming). --- riscv/execute.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/riscv/execute.cc b/riscv/execute.cc index cd6ae1a..844f2b8 100644 --- a/riscv/execute.cc +++ b/riscv/execute.cc @@ -152,7 +152,8 @@ static void commit_log_print_insn(processor_t *p, reg_t pc, insn_t insn) inline void processor_t::update_histogram(reg_t UNUSED pc) { - pc_histogram[pc]++; + if (histogram_enabled) + pc_histogram[pc]++; } // These two functions are expected to be inlined by the compiler separately in -- cgit v1.1