     end
   end
 
+  defp bench_func_name(bench_name) do
+    :"bench:#{bench_name}"
+  end
+
   defp fatal(msg) do
     IO.puts :stderr, ["** (Error) ", msg]
     System.halt(1)

    ignored_vars = Enum.map(vars, fn _ -> quote do _ end end)

    quote bind_quoted: [
      fella: __MODULE__, name: name, body: Macro.escape(body),
      values: Macro.escape(values),
      vars: Macro.escape(vars),
      ignored_vars: Macro.escape(ignored_vars)]
    do
      name = String.to_atom(name)
      fella.add_bench(__MODULE__, name)

      def unquote(name)(var!(bench_context)) do
        _ = var!(bench_context)
        [unquote_splicing(values)]
      end

      def unquote(name)(0, result, _, unquote_splicing(ignored_vars)) do
        result
      end

      def unquote(name)(n, _, var!(bench_context), unquote_splicing(vars)) do
        unquote(name)(n-1, unquote(body), var!(bench_context), unquote_splicing(vars))
      end
    end
  end


  defp run_bench({mod, func}, log_msg_func, config, mod_context) do
    run_bench_with_context(mod, mod_context, log_msg_func.(func), fn context ->
      func_name = :"bench:#{func}"
      inputs = apply(mod, func_name, [context])
      measure_func(mod, func_name, context, inputs, config)
    end)
  end

