5 #include <boost/foreach.hpp>
14 assert(shared_timer->stop_all);
26 if (shared_timer->stop_all)
28 if (shared_timer->next_node_count > node_count)
30 const double elapsed = this->elapsed();
31 if (elapsed > shared_timer->assigned.max.toSeconds()
32 || (shared_timer->stable && elapsed > shared_timer->assigned.standard.toSeconds())
33 || node_count > shared_timer->node_count_hard_limit) {
35 shared_timer->stop_all =
true;
38 MilliSeconds now = MilliSeconds::now();
39 shared_timer->nps = node_count / (0.1+(now - shared_timer->start_time).toSeconds());
43 shared_timer->next_node_count = node_count +
static_cast<int>(shared_timer->nps * period100 / 100.0);
44 shared_timer->last_tested = now;
46 if (++skip % (100 / period100) == 0) {
48 shared_timer->last_memory_use1000 =
static_cast<int>(1000*memory_use_ratio);
49 if (memory_use_ratio > 0.85) {
54 || (memory_use_ratio > 0.87
62 shared_timer->stop_all =
true;
63 std::cerr <<
"stop by memory full " << memory_use_ratio <<
" " << node_count <<
"\n";
68 }
else if (memory_use_ratio < 0.82) {
75 BOOST_FOREACH(
const boost::shared_ptr<SearchMonitor>& monitor,
77 monitor->timeInfo(node_count, elapsed);
78 monitor->hashInfo(memory_use_ratio);
91 addMonitor(
const boost::shared_ptr<SearchMonitor>& monitor)
93 shared_timer->monitors.push_back(monitor);