diff options
| author | Charlie Blake | 2018-01-24 18:08:49 +0000 |
|---|---|---|
| committer | GitHub | 2018-01-24 18:08:49 +0000 |
| commit | 9d1a12f864396ec666af57a88b3f789868ceb63c (patch) | |
| tree | dc3db8c2ae1d2ae7cc26c28ce167006b667a9460 /src/main/solver/solver.cpp | |
| parent | Merge pull request #30 from thecharlesblake/symmetrical-hash (diff) | |
| parent | Fix profiling problem and improve instructions (diff) | |
| download | metasol-9d1a12f864396ec666af57a88b3f789868ceb63c.tar.gz metasol-9d1a12f864396ec666af57a88b3f789868ceb63c.zip | |
Merge pull request #31 from thecharlesblake/profiling-fix
Fix profiling problem and improve instructions
Diffstat (limited to 'src/main/solver/solver.cpp')
| -rw-r--r-- | src/main/solver/solver.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main/solver/solver.cpp b/src/main/solver/solver.cpp index 9d25c35..19fa79b 100644 --- a/src/main/solver/solver.cpp +++ b/src/main/solver/solver.cpp @@ -7,6 +7,8 @@ #include <iostream> #include <algorithm> +#include <gperftools/profiler.h> + #include "solver.h" #include "../input-output/output/log_helper.h" @@ -22,6 +24,7 @@ solver::node::node(const game_state::move m, } bool solver::run() { + ProfilerStart("solvitaire"); game_state state = initial_state; states_searched++; @@ -33,7 +36,10 @@ bool solver::run() { node& current = frontier.back(); // If we have a solution, returns true - if (state.is_solved()) return true; + if (state.is_solved()) { + ProfilerStop(); + return true; + } // If the current node has no unsearched children if (current.unsearched_children.empty()) { @@ -69,6 +75,7 @@ bool solver::run() { } } + ProfilerStop(); return false; } |
