d_channelsOut(),
d_channelsIn(),
d_ostringstreams(),
- d_statLastWinner("portfolio::lastWinner")
+ d_statLastWinner("portfolio::lastWinner"),
+ d_statWaitTime("portfolio::waitTime")
{
assert(d_threadOptions.size() == d_numThreads);
d_statLastWinner.setData(d_lastWinner);
d_stats.registerStat_(&d_statLastWinner);
+ d_stats.registerStat_(&d_statWaitTime);
/* Duplication, Individualisation */
d_exprMgrs.push_back(&d_exprMgr);
}
d_exprMgrs.clear();
d_smts.clear();
+
+ d_stats.unregisterStat_(&d_statLastWinner);
+ d_stats.unregisterStat_(&d_statWaitTime);
}
void CommandExecutorPortfolio::lemmaSharingInit()
assert(d_channelsOut.size() == d_numThreads
|| d_numThreads == 1);
assert(d_smts.size() == d_numThreads);
+ assert( !d_statWaitTime.running() );
+
boost::function<void()>
smFn = d_numThreads <= 1 ? boost::function<void()>() :
boost::bind(sharingManager<ChannelFormat>,
pair<int, bool> portfolioReturn =
runPortfolio(d_numThreads, smFn, fns,
- d_options[options::waitToJoin]);
+ d_options[options::waitToJoin], d_statWaitTime);
+
+ assert( d_statWaitTime.running() );
+ d_statWaitTime.stop();
delete d_seq;
d_seq = new CommandSequence();
// Stats
ReferenceStat<int> d_statLastWinner;
+ TimerStat d_statWaitTime;
public:
CommandExecutorPortfolio(ExprManager &exprMgr,
#include "smt/smt_engine.h"
#include "util/result.h"
+#include "util/statistics_registry.h"
#include "options/options.h"
+
namespace CVC4 {
/** Mutex to make sure at most one thread is winner */
std::pair<int, S> runPortfolio(int numThreads,
boost::function<T()> driverFn,
boost::function<S()> threadFns[],
- bool optionWaitToJoin) {
+ bool optionWaitToJoin,
+ TimerStat& statWaitTime) {
boost::thread thread_driver;
boost::thread* threads = new boost::thread[numThreads];
S* threads_returnValue = new S[numThreads];
condition_var_main_wait.wait(lock);
}
+ statWaitTime.start();
+
if(not driverFn.empty()) {
thread_driver.interrupt();
thread_driver.join();
runPortfolio<void, bool>(int,
boost::function<void()>,
boost::function<bool()>*,
- bool);
+ bool,
+ TimerStat&);
}/* CVC4 namespace */
#include "smt/smt_engine.h"
#include "expr/command.h"
#include "options/options.h"
+#include "util/statistics_registry.h"
namespace CVC4 {
template<typename T, typename S>
std::pair<int, S> runPortfolio(int numThreads,
- boost::function<T()> driverFn,
- boost::function<S()> threadFns[],
- bool optionWaitToJoin);
+ boost::function<T()> driverFn,
+ boost::function<S()> threadFns[],
+ bool optionWaitToJoin,
+ TimerStat& statWaitTime);
// as we have defined things, S=void would give compile errors
// do we want to fix this? yes, no, maybe?
}
}/* TimerStat::stop() */
+bool TimerStat::running() const {
+ return d_running;
+}/* TimerStat::running() */
+
timespec TimerStat::getData() const {
::timespec data = d_data;
if(__CVC4_USE_STATISTICS && d_running) {
*/
void stop();
+ /** If the timer is currently running */
+ bool running() const;
+
timespec getData() const;
SExpr getValue() const;