Skip to content

Commit

Permalink
run benchee tests with the builtin profilers automatically as well
Browse files Browse the repository at this point in the history
  • Loading branch information
PragTob committed Jan 5, 2025
1 parent 5565f25 commit 41a1cc1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 4 additions & 2 deletions lib/benchee/profile.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ defmodule Benchee.Profile do
@builtin_profilers [:cprof, :eprof, :fprof]
# https://hexdocs.pm/mix/1.17.0/Mix.Tasks.Profile.Tprof.html
# Tprof was introduced in elixir 1.17.0 and requires OTP 27
# Elixir errors out fine, but our test kind of put their trust into `builtin_profilers` being runnable.
if Version.match?(System.version(), ">= 1.17.0") && String.to_integer(System.otp_release()) >= 27 do
# Elixir errors out fine, but our test kind of put their trust into `builtin_profilers`
# being runnable.
if Version.match?(System.version(), ">= 1.17.0") &&
String.to_integer(System.otp_release()) >= 27 do
@builtin_profilers [:tprof | @builtin_profilers]
end

Expand Down
3 changes: 1 addition & 2 deletions test/benchee_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -925,8 +925,7 @@ defmodule BencheeTest do
assert output =~ end_of_profiling_regex(Profile.default_profiler())
end

@profilers [:cprof, :eprof, :fprof]
for profiler <- @profilers do
for profiler <- Benchee.Profile.builtin_profilers() do
@profiler profiler
test "integration profiling runs #{inspect(@profiler)} profiler" do
output =
Expand Down

0 comments on commit 41a1cc1

Please sign in to comment.