15
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
|
# File 'lib/test_prof/tps_prof/reporter/text.rb', line 15
def print(profiler)
groups = profiler.groups
total_tps = (profiler.total_count / profiler.total_time).round(2)
msgs = []
msgs <<
" Total TPS (tests per second): \#{total_tps}\n\n MSG\n\n if profiler.mode == :strict\n return if groups.empty?\n\n msgs << if groups.size < profiler.top_count\n <<~MSG\n Suites violating TPS limits:\n\n MSG\n else\n <<~MSG\n Top \#{profiler.top_count} suites violating TPS limits:\n\n MSG\n end\n else\n msgs <<\n <<~MSG\n Top \#{profiler.top_count} slowest suites by TPS (tests per second):\n\n MSG\n end\n\n groups.each do |group|\n description = group[:id].top_level_description\n location = group[:id].metadata[:location]\n time = group[:total_time]\n setup_time = group[:shared_setup_time]\n count = group[:count]\n tps = group[:tps]\n\n msgs <<\n <<~GROUP\n \#{description.truncate} (\#{location}) \u2013 \#{tps} TPS (\#{time.duration} / \#{count}, shared setup time: \#{setup_time.duration})\n GROUP\n end\n\n log((profiler.mode == :strict) ? :error : :info, msgs.join)\nend\n"
|