In some cases small changes in hot loops can show big differences. But it's difficult to identify these differences.
perf diff currently can only diff symbols (functions). We can also expand it to diff cycles of individual programs blocks as reported by timed LBR. This would allow to identify changes in specific code accurately. With this patch set, for example, perf record -b ./div perf record -b ./div perf diff --basic-block # Cycles diff Basic block (start:end) # ........... ....................... # -20 native_write_msr (7fff9a069900:7fff9a06990b) -3 __indirect_thunk_start (7fff9ac02ca0:7fff9ac02ca0) 1 __indirect_thunk_start (7fff9ac02cac:7fff9ac02cb0) 0 rand@plt (490:490) 0 rand (3af60:3af64) 0 rand (3af69:3af6d) 0 main (4e8:4ea) 0 main (4ef:500) 0 main (4ef:535) 0 compute_flag (640:644) 0 compute_flag (649:659) 0 __random_r (3ac40:3ac76) 0 __random_r (3ac40:3ac88) 0 __random_r (3ac90:3ac9c) 0 __random (3aac0:3aad2) 0 __random (3aae0:3aae7) 0 __random (3ab03:3ab0f) 0 __random (3ab14:3ab1b) 0 __random (3ab28:3ab2e) 0 __random (3ab4a:3ab53) The "basic-block" is a new perf-diff option, which enables the displaying of cycles difference of same program basic block amongst two or more perf.data. The program basic block is the code block between two branches in a function. Jin Yao (9): perf util: Create block_info structure perf util: Add block_info in hist_entry perf diff: Check if all data files with branch stacks perf diff: Get a list of symbols(functions) perf diff: Use hists to manage basic blocks perf diff: Link same basic blocks among different data files perf diff: Compute cycles diff of basic blocks perf diff: Print the basic block cycles diff perf diff: Documentation --basic-block option tools/perf/Documentation/perf-diff.txt | 5 + tools/perf/builtin-diff.c | 521 ++++++++++++++++++++++++++++++++- tools/perf/util/hist.c | 24 +- tools/perf/util/hist.h | 6 + tools/perf/util/sort.h | 4 + tools/perf/util/symbol.c | 22 ++ tools/perf/util/symbol.h | 23 ++ 7 files changed, 594 insertions(+), 11 deletions(-) -- 2.7.4