Skip to content

Commit 42ab635

Browse files
jbachorikclaude
andcommitted
Generate human-readable summary report after benchmark runs
Creates timestamped summary file with: - Statistical analysis table - Interpretation guide - Individual run data for verification Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent da21e36 commit 42ab635

1 file changed

Lines changed: 78 additions & 0 deletions

File tree

ddprof-lib/benchmarks/branch-prediction/run_stable_comparison.sh

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,3 +280,81 @@ log_info "Negative change % indicates improvement (fewer misses/cycles)"
280280
log_info "Positive IPC change % indicates improvement (more instructions per cycle)"
281281
log_info ""
282282
log_info "Individual run results in perf_results_run_*/ directories"
283+
284+
# Generate human-readable summary file
285+
SUMMARY_FILE="benchmark_summary_$(date +%Y%m%d_%H%M%S).txt"
286+
log_info ""
287+
log_info "Generating summary report: ${SUMMARY_FILE}"
288+
289+
cat > "${SUMMARY_FILE}" << EOF
290+
================================================================================
291+
Branch Prediction Benchmark Summary
292+
================================================================================
293+
Generated: $(date)
294+
Benchmark: ${BENCHMARK}
295+
Iterations: ${ITERATIONS}
296+
Baseline branch: main
297+
Optimized branch: jb/likely
298+
299+
================================================================================
300+
Statistical Analysis Results
301+
================================================================================
302+
303+
Metric | Baseline (mean ± σ) | Optimized (mean ± σ) | Change
304+
--------------------------|------------------------------------|------------------------------------|----------
305+
EOF
306+
307+
# Append the statistics table to file
308+
{
309+
calc_stats "Branch misses" "branch-misses"
310+
calc_stats "L1 icache misses" "L1-icache-load-misses"
311+
calc_stats "Instructions" "instructions"
312+
calc_stats "Cycles" "cycles"
313+
314+
# Re-calculate IPC for file output
315+
if [ ${#baseline_ipc_values[@]} -gt 0 ]; then
316+
echo "--------------------------|------------------------------------|------------------------------------|----------"
317+
printf "%-25s | %20s ± %10s | %20s ± %10s | %8s%%\n" \
318+
"IPC (insn/cycle)" \
319+
"$(printf "%.3f" ${baseline_ipc_mean})" "$(printf "%.6f" ${baseline_ipc_stddev})" \
320+
"$(printf "%.3f" ${optimized_ipc_mean})" "$(printf "%.6f" ${optimized_ipc_stddev})" \
321+
"${ipc_change}"
322+
fi
323+
} >> "${SUMMARY_FILE}"
324+
325+
cat >> "${SUMMARY_FILE}" << EOF
326+
327+
================================================================================
328+
Interpretation
329+
================================================================================
330+
- Negative change % = improvement (fewer misses/cycles)
331+
- Positive IPC change % = improvement (more instructions per cycle)
332+
- Standard deviation (σ) indicates measurement stability
333+
334+
================================================================================
335+
Individual Run Data
336+
================================================================================
337+
338+
EOF
339+
340+
# Append individual run data
341+
for i in $(seq 1 ${ITERATIONS}); do
342+
echo "--- Iteration $i ---" >> "${SUMMARY_FILE}"
343+
if [ -f "perf_results_run_${i}/baseline_stat.txt" ]; then
344+
echo "Baseline:" >> "${SUMMARY_FILE}"
345+
grep -E "(branch-misses|L1-icache-load-misses|instructions|cycles)" "perf_results_run_${i}/baseline_stat.txt" >> "${SUMMARY_FILE}" 2>/dev/null || echo " No data" >> "${SUMMARY_FILE}"
346+
fi
347+
if [ -f "perf_results_run_${i}/optimized_stat.txt" ]; then
348+
echo "Optimized:" >> "${SUMMARY_FILE}"
349+
grep -E "(branch-misses|L1-icache-load-misses|instructions|cycles)" "perf_results_run_${i}/optimized_stat.txt" >> "${SUMMARY_FILE}" 2>/dev/null || echo " No data" >> "${SUMMARY_FILE}"
350+
fi
351+
echo "" >> "${SUMMARY_FILE}"
352+
done
353+
354+
cat >> "${SUMMARY_FILE}" << EOF
355+
================================================================================
356+
End of Report
357+
================================================================================
358+
EOF
359+
360+
log_info "Summary saved to: ${SUMMARY_FILE}"

0 commit comments

Comments
 (0)