Hey everyone,
I'm finally working on a new Benchee release that will include profiling after benchmark runs. I did notice one problem, using the programmatic interface of the tasks (like:
https://hexdocs.pm/mix/main/Mix.Tasks.Profile.Eprof.html#profile/2) it only prints the report but doesn't give me access to the return value of the function that was profiled.
The return value of the Profiler.profile functions seems to be undocumented, can we change it to be the return value of the function / {:ok, value} & {:error, reason} / some structure that includes the return value?
I checked and it seems that all of eprof/fprof/cprof return the value so it should be relatively easy to implement. They do return the value in slightly different ways though:
iex(1)> :eprof.start()
{:ok, #PID<0.109.0>}
iex(2)> {:ok, val} = :eprof.profile([], fn -> 42 end)
{:ok, 42}
iex(3)> val
42
iex(4)> :fprof.start()
{:ok, #PID<0.114.0>}
iex(5)> :fprof.apply(fn -> 43 end, [])
43
Which raises the question that if we did this, do we want to pass on the value as they return it or normalize it.
Input welcome, and as always thanks for all you do!
Tobi