16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/corkscrews/report.rb', line 16
def to_text(limit: 10)
aggregate = @analysis.aggregate
lines = []
lines << "corkscrews report: #{@path}"
lines << "runs: #{aggregate[:run_count]} samples: #{aggregate[:total_samples]} duration: #{format_seconds(aggregate[:duration_ns])}"
unless aggregate[:native].empty?
lines << "native: samples=#{aggregate[:native][:samples].to_i} target_hits=#{aggregate[:native][:target_hits].to_i} ring_events=#{aggregate[:native][:ring_events].to_i} monitor_ticks=#{aggregate[:native][:monitor_ticks].to_i} monitor_signals=#{aggregate[:native][:monitor_signals].to_i} monitor_signal_failures=#{aggregate[:native][:monitor_signal_failures].to_i} live_threads=#{aggregate[:native][:thread_live_count].to_i} max_live_threads=#{aggregate[:native][:thread_max_live_count].to_i} debt_settled_ns=#{aggregate[:native][:debt_settled_ns].to_i} gc_pause_ns=#{aggregate[:native][:gc_pause_ns].to_i}"
end
lines << "runtime: fiber_switches=#{aggregate[:runtime][:fiber_switches]} max_fibers=#{aggregate[:runtime][:max_fiber_count]} fiber_threads=#{aggregate[:runtime][:fiber_thread_count]} fiber_scheduler=#{aggregate[:runtime][:fiber_scheduler]} max_ractors=#{aggregate[:runtime][:max_ractor_count]}"
lines << ""
if aggregate[:progress].empty?
lines << "progress: none"
else
lines << "progress:"
aggregate[:progress].each do |name, stats|
ci = stats[:rate_ci]
lines << format(
" %-16s rate=%10.2f/s ci=[%10.2f,%10.2f] count=%d",
name,
stats[:mean_rate],
ci[0],
ci[1],
stats[:count]
)
end
end
unless aggregate[:latency].empty?
lines << ""
lines << "latency:"
aggregate[:latency].each do |name, stats|
ci = stats[:mean_ms_ci]
little_ci = stats[:little_mean_ms_ci]
lines << format(
" %-16s mean=%8.3fms little=%8.3fms ci=[%8.3f,%8.3f] little_ci=[%8.3f,%8.3f] completed=%d",
name,
stats[:mean_ms],
stats[:little_mean_ms],
ci[0],
ci[1],
little_ci[0],
little_ci[1],
stats[:completed_count]
)
end
end
lines << ""
lines << "top targets:"
lines << " share causal verdict samples target predicted improvement at 25% / 50% / 90%"
aggregate[:targets].first(limit).each do |target|
curve = target[:curve]
i25 = curve.find { |point| point[:speedup_pct] == 25 }[:improvement_pct]
i50 = curve.find { |point| point[:speedup_pct] == 50 }[:improvement_pct]
i90 = curve.find { |point| point[:speedup_pct] == 90 }[:improvement_pct]
lines << format(
" %5.1f%% %5.1f%% %-10s %7d %-62s %6.2f%% / %6.2f%% / %6.2f%%",
target[:sample_share] * 100.0,
target[:causal_share].to_f * 100.0,
target[:verdict],
target[:samples],
target_label(target),
i25,
i50,
i90
)
end
disagreements = disagreement_targets(aggregate[:targets]).first(5)
unless disagreements.empty?
lines << ""
lines << "disagreement highlights:"
disagreements.each do |target|
lines << format(
" %-70s observed=%5.1f%% causal=%5.1f%% verdict=%s",
target_label(target),
target[:sample_share] * 100.0,
target[:causal_share].to_f * 100.0,
target[:verdict]
)
end
end
lines.join("\n")
end
|