aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorthecharlesblake2018-01-24 18:05:41 +0000
committerthecharlesblake2018-01-24 18:05:41 +0000
commit22f1aad6338f0afdf9c631377d159e2105e1b03d (patch)
treedc3db8c2ae1d2ae7cc26c28ce167006b667a9460 /src/main
parentMerge pull request #30 from thecharlesblake/symmetrical-hash (diff)
downloadmetasol-22f1aad6338f0afdf9c631377d159e2105e1b03d.tar.gz
metasol-22f1aad6338f0afdf9c631377d159e2105e1b03d.zip

Fix profiling problem and improve instructions

Diffstat (limited to 'src/main')
-rw-r--r--src/main/solver/solver.cpp9
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;
}