Skip to content

Commit

Permalink
Add warning for memory measurement on OTP 18
Browse files Browse the repository at this point in the history
This way folks won't think things just aren't working, and will know to
upgrade their version of OTP to something newer.
  • Loading branch information
devonestes committed Mar 14, 2018
1 parent 0acfe2d commit ce5c76a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/benchee/configuration.ex
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,20 @@ defmodule Benchee.Configuration do

defp update_measure_memory(config = %{measure_memory: measure_memory}) do
otp_version = List.to_integer(:erlang.system_info(:otp_release))
if measure_memory and otp_version <= 18, do: print_memory_measure_warning()
Map.put(config, :measure_memory, measure_memory and otp_version > 18)
end

defp print_memory_measure_warning do
IO.puts("""
Measuring memory consumption is only available on OTP 19 or greater.
If you would like to benchmark memory consumption, please upgrade to a
newer verion of OTP.
""")
end

defp save_option_conversion(config = %{save: false}) do
config
end
Expand Down

0 comments on commit ce5c76a

Please sign in to comment.