Skip to content

Commit

Permalink
Only allow tprof on elixir >= 1.17 - both for our tests and our suers
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob committed Jan 5, 2025
1 parent 37e9538 commit 19530f4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion lib/benchee/profile.ex
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ defmodule Benchee.Profile do
alias Benchee.Suite

@default_profiler :eprof
@builtin_profilers [:cprof, :eprof, :fprof, :tprof]
@builtin_profilers [:cprof, :eprof, :fprof]
# https://hexdocs.pm/mix/1.17.0/Mix.Tasks.Profile.Tprof.html
# Was introduced in 1.17.0, it also requires OTP 27 but I trust it to error fine for
# that case itself
if Version.match?(System.version(), ">= 1.17.0") do
@builtin_profilers [:tprof | @builtin_profilers]
end
# we run the function a bunch already, no need for further warmup
@default_profiler_opts [warmup: false]

Expand Down
3 changes: 1 addition & 2 deletions test/benchee/profile_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@ defmodule Benchee.ProfileTest do
assert_receive {:profiling, ^name, ^profiler}
end

@profilers Profile.builtin_profilers()
for profiler <- @profilers do
for profiler <- Profile.builtin_profilers() do
@profiler profiler
# can't say warmup as some profilers will have it in the profile messing with the test
describe "warming up behavior with #{@profiler}" do
Expand Down

0 comments on commit 19530f4

Please sign in to comment.