Skip to content

Commit

Permalink
add prominent warning about missing memory measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob committed May 1, 2018
1 parent a62aadc commit aba2913
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
23 changes: 15 additions & 8 deletions lib/benchee/formatters/console/memory.ex
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,21 @@ defmodule Benchee.Formatters.Console.Memory do
label_width,
_) do

"~*ts~*ts\n"
|> :io_lib.format([
-label_width,
scenario.name,
@average_width,
@na
])
|> to_string
warning = "WARNING the scenario \"#{scenario.name}\" has no memory measurements!" <>
" This is probably a bug please report it!\n" <>
"https://github.com/PragTob/benchee/issues/new"

data =
"~*ts~*ts\n"
|> :io_lib.format([
-label_width,
scenario.name,
@average_width,
@na
])
|> to_string

warning <> "\n" <> data
end

defp format_scenario(scenario, %{memory: memory_unit}, label_width, false) do
Expand Down
2 changes: 2 additions & 0 deletions test/benchee/formatters/console/memory_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,8 @@ defmodule Benchee.Formatters.Console.MemoryTest do
assert output =~ "First"
assert output =~ ~r/Second.+N\/A/i
assert output =~ "N/A"
assert output =~ "WARNING"
assert output =~ "report"
end

test "it doesn't blow up if some come back with a median of 0.0" do
Expand Down

0 comments on commit aba2913

Please sign in to comment.