Add more metrics to env progress reporter

This commit is contained in:
Markus Schirp 2015-11-01 20:46:19 +00:00
parent 8bfe09c970
commit 722aa76640
6 changed files with 60 additions and 12 deletions

View file

@ -1,3 +1,3 @@
---
threshold: 18
total_score: 1253
total_score: 1244

View file

@ -10,34 +10,51 @@ module Mutant
:amount_mutations,
:amount_mutations_alive,
:amount_mutations_killed,
:amount_mutation_results,
:runtime,
:killtime,
:overhead,
:env
)
# rubocop:disable SpaceInsideBrackets
FORMATS = IceNine.deep_freeze([
[:info, 'Subjects: %s', :amount_subjects ],
[:info, 'Mutations: %s', :amount_mutations ],
[:info, 'Results: %s', :amount_mutation_results ],
[:info, 'Kills: %s', :amount_mutations_killed ],
[:info, 'Alive: %s', :amount_mutations_alive ],
[:info, 'Runtime: %0.2fs', :runtime ],
[:info, 'Killtime: %0.2fs', :killtime ],
[:info, 'Overhead: %0.2f%%', :overhead_percent ],
[:info, 'Mutations/s: %0.2f', :mutations_per_second ],
[:status, 'Coverage: %0.2f%%', :coverage_percent ],
[:status, 'Expected: %0.2f%%', :expected_coverage_percent]
])
# Run printer
#
# @return [undefined]
#
# rubocop:disable AbcSize
#
# @api private
def run
visit(Config, env.config)
info 'Subjects: %s', amount_subjects
info 'Mutations: %s', amount_mutations
info 'Kills: %s', amount_mutations_killed
info 'Alive: %s', amount_mutations_alive
info 'Runtime: %0.2fs', runtime
info 'Killtime: %0.2fs', killtime
info 'Overhead: %0.2f%%', overhead_percent
status 'Coverage: %0.2f%%', coverage_percent
status 'Expected: %0.2f%%', (env.config.expected_coverage * 100)
FORMATS.each do |report, format, value|
__send__(report, format, __send__(value))
end
end
private
# Mutations processed per second
#
# @return [Float]
#
# @api private
def mutations_per_second
amount_mutation_results / runtime
end
# Coverage in percent
#
# @return [Float]
@ -47,6 +64,15 @@ module Mutant
coverage * 100
end
# Expected coverage in percent
#
# @return [Float]
#
# @api private
def expected_coverage_percent
env.config.expected_coverage * 100
end
# Overhead in percent
#
# @return [Float]

View file

@ -19,11 +19,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
Requires: []
Subjects: 1
Mutations: 2
Results: 0
Kills: 0
Alive: 0
Runtime: 4.00s
Killtime: 0.00s
Overhead: Inf%
Mutations/s: 0.00
Coverage: 100.00%
Expected: 10.00%
STR
@ -40,11 +42,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 2
Alive: 0
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 100.00%
Expected: 10.00%
STR
@ -63,11 +67,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvProgress do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 1
Alive: 1
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 50.00%
Expected: 10.00%
STR

View file

@ -23,11 +23,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::EnvResult do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 1
Alive: 1
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 50.00%
Expected: 100.00%
STR

View file

@ -17,11 +17,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
Requires: []
Subjects: 1
Mutations: 2
Results: 0
Kills: 0
Alive: 0
Runtime: 4.00s
Killtime: 0.00s
Overhead: Inf%
Mutations/s: 0.00
Coverage: 100.00%
Expected: 100.00%
Active subjects: 0
@ -40,11 +42,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
Requires: []
Subjects: 1
Mutations: 2
Results: 0
Kills: 0
Alive: 0
Runtime: 4.00s
Killtime: 0.00s
Overhead: Inf%
Mutations/s: 0.00
Coverage: 100.00%
Expected: 10.00%
Active subjects: 0
@ -66,11 +70,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 2
Alive: 0
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 100.00%
Expected: 100.00%
Active subjects: 0
@ -93,11 +99,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 1
Alive: 1
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 50.00%
Expected: 100.00%
Active Jobs:
@ -121,11 +129,13 @@ RSpec.describe Mutant::Reporter::CLI::Printer::Status do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 2
Alive: 0
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 100.00%
Expected: 100.00%
Active Jobs:

View file

@ -164,11 +164,13 @@ RSpec.describe Mutant::Reporter::CLI do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 2
Alive: 0
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 100.00%
Expected: 100.00%
REPORT
@ -190,11 +192,13 @@ RSpec.describe Mutant::Reporter::CLI do
Requires: []
Subjects: 1
Mutations: 2
Results: 2
Kills: 2
Alive: 0
Runtime: 4.00s
Killtime: 2.00s
Overhead: 100.00%
Mutations/s: 0.50
Coverage: 100.00%
Expected: 100.00%
Active subjects: 0