#!/usr/bin/awk -f # vim: ft=awk ts=4 sw=4 et # # This script summarizes the contents of the SWITCH_DEPTH_RESULTS files # generated by the conditionally-enabled statistics-gathering code # in switch_detection.m. # NF == 6 && $1 == "depth" { depth = $2; hit = $4; miss = $6; hits[depth] += hit; hit_and_miss = hit + miss; trials[depth] += hit_and_miss; } END { max_depth = 0; for (depth in trials) { if (depth > max_depth) { max_depth = depth; } hit_rate[depth] = (100 * hits[depth]) / trials[depth]; printf "depth %d: %5d trials, %5d hits, hit rate = %5.2f%%\n", depth, trials[depth], hits[depth], hit_rate[depth]; } i = 1; while (i <= max_depth) { leak_rate = (100 * trials[i]) / trials[i - 1]; printf "leak rate to depth %d: %5.2f%%\n", i, leak_rate; i = i + 1; } }