-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The example puzzle is the same as the one in the Sudoku solver test, except with several more cells filled in. Using the original causes :eflame to time out while creating the final report (see proger/eflame#13). Ensure rebar is installed (the original, not rebar3), and run the following: $ MIX_ENV=prod mix do clean, deps.get, deps.compile, compile $ MIX_ENV=prod iex -S mix run -e "Backtrex.Profiler.eflame; exit(:normal)" $ ./deps/eflame/stack_to_flame.sh < stacks.out > flame-prod.svg Credit goes to http://learningelixir.joekain.com/profiling-elixir-2/ for getting me started.
- Loading branch information
Showing
3 changed files
with
28 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
defmodule Backtrex.Profiler do | ||
alias Backtrex.Examples.Sudoku | ||
|
||
def eflame do | ||
:eflame.apply(&run_test/0, []) | ||
end | ||
|
||
def example_puzzle do | ||
{:ok, puzzle} = Sudoku.Puzzle.from_list([ | ||
[5, 3, :_, :_, 7, :_, :_, 1, 2], | ||
[6, 7, :_, 1, 9, 5, :_, 4, :_], | ||
[1, 9, 8, 3, :_, :_, 5, 6, 7], | ||
[8, :_, 9, :_, 6, :_, 4, :_, 3], | ||
[4, 2, :_, 8, :_, 3, 7, :_, 1], | ||
[7, :_, 3, :_, 2, 4, :_, 5, 6], | ||
[:_, 6, :_, 5, :_, 7, 2, 8, :_], | ||
[2, :_, :_, 4, 1, 9, 6, :_, 5], | ||
[:_, 4, 5, :_, 8, 6, :_, 7, 9]]) | ||
puzzle | ||
end | ||
|
||
def run_test do | ||
{:ok, :solution, _} = example_puzzle() |> Sudoku.Solver.solve | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters