Ejemplo n.º 1
0
void ComputationManager::optimize(Computation &c) {
    updateStats(c);
    
    if (optUnsatCheckInterval.getValue() > 0) {
        optUnsatCheckCounter++;
        optUnsatCheckCounter %= optUnsatCheckInterval.getValue();

        if (optUnsatCheckCounter == 0) {
            RESULT result = decide(c); 
            if (result == RESULT::UNSAT) {
                throw AbortException("Intermediate unsat check successful", RESULT::UNSAT);
            }
        }
    }
    
    if (optOptimizeInterval.getValue() > 0) {
        optIntervalCounter++;
        optIntervalCounter %= optOptimizeInterval.getValue();

        if (optIntervalCounter == 0) {
            while ((maxGlobalNSFSizeEstimation < optMaxGlobalNSFSize.getValue()) || (optMaxGlobalNSFSize.getValue() <= -1)) {
                unsigned int oldLeavesCount = c.leavesCount();
//    divideGlobalNSFSizeEstimation(c.leavesCount());
                if (!(c.optimize(left))) {
                    break;
                }
                left = !left;
                divideGlobalNSFSizeEstimation(oldLeavesCount);
                multiplyGlobalNSFSizeEstimation(c.leavesCount());
            }
        }
    }
    updateStats(c);
}
Ejemplo n.º 2
0
void State_selectPart::KeyDown(const int &key, const int &unicode)
{
    if (key == SDLK_ESCAPE)
    {
        resultRef = -1;
        popMe = true;
    }
    else if (key == SDLK_DOWN)
    {
        int size = getInventorySize();
        if (selector < size - 1)
        {
            selector++;
            redraw();
            updateStats();
        }
    }
    else if (key == SDLK_UP)
    {
        int size = getInventorySize();
        if (selector > 0)
        {
            selector--;
            redraw();
            updateStats();
        }
    }
    else if (key == SDLK_RETURN)
    {
        resultRef = selector;
        popMe = true;
    }

}
Ejemplo n.º 3
0
// ~Game()
// Description: game ends, calculate & dump results to log
Game::~Game(){
    m_objCount--;
    if(m_objCount == 0 && m_objInit){
        m_endTime = cpuTime();
        updateStats();
        dumpLog("open_src_version.log");
    }
    else
        updateStats();
}
Ejemplo n.º 4
0
MainWindow::MainWindow(QWidget *parent)
 : QMainWindow(parent)
{
  setupUi(this);
  setupActions();

  mStatLabel = new QLabel;
  statusBar()->addPermanentWidget(mStatLabel);
  connect(textEdit, SIGNAL(textChanged()), this, SLOT(updateStats()));
  updateStats();
}
Ejemplo n.º 5
0
void Testsuite::execute() {
	// Main Loop for a testsuite

	uint count = 0;
	Common::Point pt = getDisplayRegionCoordinates();
	pt.y += getLineSeparation();
	int numEnabledTests = getNumTestsEnabled();

	for (Common::Array<Test *>::iterator i = _testsToExecute.begin(); i != _testsToExecute.end(); ++i) {
		if (!(*i)->enabled) {
			logPrintf("Info! Skipping Test: %s, Skipped by configuration.\n", ((*i)->featureName).c_str());
			_numTestsSkipped++;
			continue;
		}

		if((*i)->isInteractive && !ConfParams.isSessionInteractive()) {
			logPrintf("Info! Skipping Test: %s, non-interactive environment is selected\n", ((*i)->featureName).c_str());
			_numTestsSkipped++;
			continue;
		}

		logPrintf("Info! Executing Test: %s\n", ((*i)->featureName).c_str());
		updateStats("Test", ((*i)->featureName).c_str(), count++, numEnabledTests, pt);

		// Run the test and capture exit status.
		TestExitStatus eStatus = (*i)->driver();
		if (kTestPassed == eStatus) {
			logPrintf("Result: Passed\n");
			_numTestsExecuted++;
			_numTestsPassed++;
		} else if (kTestSkipped == eStatus){
			logPrintf("Result: Skipped\n");
			_numTestsSkipped++;
		} else {
			_numTestsExecuted++;
			logPrintf("Result: Failed\n");
		}

		updateStats("Test", ((*i)->featureName).c_str(), count, numEnabledTests, pt);
		// TODO: Display a screen here to user with details of upcoming test, he can skip it or Quit or RTL
		// Check if user wants to quit/RTL/Skip next test by parsing events.
		// Quit directly if explicitly requested

		if (Engine::shouldQuit()) {
			_toQuit = kEngineQuit;
			genReport();
			return;
		}

		_toQuit = parseEvents();
	}
	genReport();
}
Ejemplo n.º 6
0
void FPSGraph::update(float dt)
{
	time += dt;
	++frames;
	if (time > GUIFPS_MIN_TIME)
	{
		tpfLast = time / frames;
		fpsLast = frames / time;
		time = 0.0f;
		frames = 0;
		
		currentSample = (currentSample + 1) % GUIFPS_NUM_SAMPLES;
		times[currentSample] = tpfLast;
		
		updateStats();
		
		if (print)
			printf("%.2ffps %.2fms\n", fpsLast, 1000.0*tpfLast);
		
		gotNewSample = true;
	}
	else
		gotNewSample = false;
	
	if (tpfMaximum > 0)
	{
		float step = dt * 10000.0;
		float targetHeight = 0.6666 / tpfMaximum;
		float to = targetHeight - heightScale;
		if (fabs(to) > step)
			heightScale += step * to / fabs(to);
		else
			heightScale = targetHeight;
	}
}
	void ChunkManager::prioritise(Uint32 from,Uint32 to,Priority priority)
	{
		if (from > to)
			std::swap(from,to);

		Uint32 i = from;
		while (i <= to && i < (Uint32)d->chunks.size())
		{
			Chunk* c = d->chunks[i];
			c->setPriority(priority);
			
			if (priority == ONLY_SEED_PRIORITY)
			{
				only_seed_chunks.set(i,true);
				d->todo.set(i,false);
			}
			else if (priority == EXCLUDED)
			{
				only_seed_chunks.set(i,false);
				d->todo.set(i,false);
			}
			else
			{
				only_seed_chunks.set(i,false);
				d->todo.set(i,!bitset.get(i));
			}
			
			i++;
		}
		updateStats();
	}
CWidgetSearchTemplate::CWidgetSearchTemplate(QString searchString, QWidget* parent) :
	QWidget(parent),
	ui(new Ui::CWidgetSearchTemplate)
{
	ui->setupUi(this);
	searchMenu = new QMenu(this);
	searchMenu->addAction(ui->actionDownload);
	searchMenu->addSeparator();
	searchMenu->addAction(ui->actionBanNode);
	searchMenu->addAction(ui->actionMarkAsJunk);
	searchMenu->addAction(ui->actionClearResults);
	searchMenu->addSeparator();
	searchMenu->addAction(ui->actionViewReviews);
	searchMenu->addAction(ui->actionVirusTotalCheck);

	m_sSearchString = searchString;
	m_pSearch = 0;
	m_nFiles = 0;
	m_nHits = 0;
	m_nHubs = 0;
	m_nLeaves = 0;
	m_searchState = SearchState::Default;
	m_pSortModel = new QSortFilterProxyModel(this);
	m_pSearchModel = new SearchTreeModel();
	m_pSortModel->setSourceModel(m_pSearchModel);
	ui->treeViewSearchResults->setModel(m_pSortModel);
	m_pSortModel->setDynamicSortFilter(false);
	connect(m_pSearchModel, SIGNAL(sort()), this, SLOT(Sort()));
	connect(m_pSearchModel, SIGNAL(updateStats()), this, SLOT(OnStatsUpdated()));
	loadHeaderState();
	connect(ui->treeViewSearchResults->header(), SIGNAL(sectionMoved(int,int,int)), this, SLOT(saveHeaderState()));
	connect(ui->treeViewSearchResults->header(), SIGNAL(sectionResized(int,int,int)), this, SLOT(saveHeaderState()));
	connect(ui->treeViewSearchResults->header(), SIGNAL(sectionClicked(int)), this, SLOT(saveHeaderState()));
	setSkin();
}
Ejemplo n.º 9
0
/*------------------------------------------------------------------------------------------------------------------
-- FUNCTION: SendPacket
--
-- DATE: November 25, 2015
--
-- REVISIONS: (Date and Description)
--
-- DESIGNER: Alvin Man
--
-- PROGRAMMER: Alvin Man
--
-- INTERFACE:  SendPacket(char* str)
--					-char* str : the packet to be sent
--
-- RETURNS: VOID
--
-- NOTES:
--		Sends a packet to the serial port.  If we get an ACK back acknowledging the packet we just sent, the packet is
--  considered sent successfully, and we return.  If we don't get an ACK back, we assume something went wrong with the
--  transmission and we resend the same packet, up to the maximum specified tries.  
----------------------------------------------------------------------------------------------------------------------*/
VOID SendPacket(char* str) { 
	DWORD numTries_sendPacket = 0;

	//Try to send the packet until we reach the maximum number of tries
	while (numTries_sendPacket < SEND_PACKET_MAX_TRIES) {
		//Send the packet
		Send(str, strlen(str), hWrite_Lock);

		//Wait for a response for the Packet we sent
		char *response = "";
		if (!Wait_For_Data(&response, 1, 3000))
		{
			updateStats(stats.packetSent++, IDC_SDATA0);

			//Time'd out, increment counter and restart the loop to send the packet again
			OutputDebugString("Packet sending timeout\n");
			numTries_sendPacket++;
			continue;
		}
		else if (Evaluate_Response (response[0])) {
			updateProgressBar (progressSize / Write_Packets.size());
			return;
		}

	}
}
Ejemplo n.º 10
0
void Application::go()
{
	Ogre::Timer loopTimer;

	bool continueRunning = true;
	while ( continueRunning )
	{
		Ogre::WindowEventUtilities::messagePump();
		
		SimpleInputManager::capture();

		// Update logic stuff
		float elapsedSeconds = loopTimer.getMicroseconds() * 1.0 / 1000000;
		updateLogic( elapsedSeconds );

		// Update graphics stuff
		updateAnimations( elapsedSeconds );
		
		bool windowClosed = m_window->isClosed();
		continueRunning &= ! windowClosed;

		updateStats();

		loopTimer.reset();
		bool renderFrameSuccess = m_root->renderOneFrame();
		continueRunning &= renderFrameSuccess;

		continueRunning &= ! m_exitRequested;		
	}
}
Ejemplo n.º 11
0
/* instruments a Binary Operation Expression in a Ist_WrTmp statement */
static void instrument_Triop(IRSB* sb, IRStmt* st, Addr64 cia) {
  Char thisFct[]="instrument_Triop";
  IRDirty* di;
  IRExpr** argv;
  IRExpr *op = st->Ist.WrTmp.data;
  IRExpr* oa_event_expr;
  IROp irop=op->Iex.Triop.details->op;
  void* f=callbackFromIROp(irop);
  if (f == NULL) return;
  OA_InstrumentContext inscon=contextFor(cia, irop);
  if (not_worth_watching(inscon))
    return;  // filter events that can't be attached to source-code location
  updateStats(inscon->op);
  oa_event_expr = mkIRExpr_HWord( (HWord)inscon );
  IRExpr * args1[2];
  packToI32orI64(sb, op->Iex.Triop.details->arg2, args1, irop);
  IRExpr * args2[2];
  packToI32orI64(sb, op->Iex.Triop.details->arg3, args2, irop);
  argv = mkIRExprVec_3(args1[0], args2[0], oa_event_expr);
  di = unsafeIRDirty_0_N( 3, thisFct, VG_(fnptr_to_fnentry)( f ), argv);
  addStmtToIRSB( sb, IRStmt_Dirty(di) );
  if (args1[1] != NULL) {
    // we need a second callback for 64bit types
    argv = mkIRExprVec_3(args1[1], args2[1], oa_event_expr);
    di = unsafeIRDirty_0_N( 3, thisFct, VG_(fnptr_to_fnentry)( f ), argv);
    addStmtToIRSB( sb, IRStmt_Dirty(di) );
  }

}
Ejemplo n.º 12
0
void ConditionAttributes::addCondition(Creature* creature, const Condition* condition)
{
	if (updateCondition(condition)) {
		setTicks(condition->getTicks());

		const ConditionAttributes& conditionAttrs = static_cast<const ConditionAttributes&>(*condition);
		//Remove the old condition
		endCondition(creature);

		//Apply the new one
		memcpy(skills, conditionAttrs.skills, sizeof(skills));
		memcpy(specialSkills, conditionAttrs.specialSkills, sizeof(specialSkills));
		memcpy(skillsPercent, conditionAttrs.skillsPercent, sizeof(skillsPercent));
		memcpy(stats, conditionAttrs.stats, sizeof(stats));
		memcpy(statsPercent, conditionAttrs.statsPercent, sizeof(statsPercent));
		disableDefense = conditionAttrs.disableDefense;

		if (Player* player = creature->getPlayer()) {
			updatePercentSkills(player);
			updateSkills(player);
			updatePercentStats(player);
			updateStats(player);
		}
	}
}
Ejemplo n.º 13
0
void ServerMonitorWindow::loadServers()
{
	ScrollBarLayout = new QWidget(this);
	Layout = new QGridLayout(ScrollBarLayout);

	AvailableServers = 0;
	UnavailableServers = 0;
	ServerStatusWidgetList.clear();

	(ProtocolsManager::instance()->byName("gadu") && config_file.readBoolEntry("serverMonitor", "useGaduServersList", true))?
			loadServersListFromGaduManager() : loadServersListFromFile();

	int serverCounter = 0;
	foreach (ServerStatusWidget* serverStatusWidget, ServerStatusWidgetList)
	{
		int row = serverCounter;
		if (serverCounter % 2)
			--row;
		Layout->addWidget(serverStatusWidget, row, (serverCounter) % 2);

		connect (serverStatusWidget, SIGNAL(statusChanged (ServerStatusWidget::ServerState, ServerStatusWidget::ServerState)),
			this, SLOT(updateStats (ServerStatusWidget::ServerState, ServerStatusWidget::ServerState)));

		serverCounter++;
	}
Ejemplo n.º 14
0
    void RenderTarget::update(void)
    {

        // notify listeners (pre)
        firePreUpdate();

        mStats.triangleCount = 0;
        mStats.batchCount = 0;
        // Go through viewports in Z-order
        // Tell each to refresh
        ViewportList::iterator it = mViewportList.begin();
        while (it != mViewportList.end())
        {
            fireViewportPreUpdate((*it).second);
            (*it).second->update();
            mStats.triangleCount += (*it).second->_getNumRenderedFaces();
            mStats.batchCount += (*it).second->_getNumRenderedBatches();
            fireViewportPostUpdate((*it).second);
            ++it;
        }

        // notify listeners (post)
        firePostUpdate();

        // Update statistics (always on top)
        updateStats();


    }
Ejemplo n.º 15
0
void ConditionAttributes::addCondition(Creature* creature, const Condition* addCondition)
{
	if(updateCondition(addCondition))
	{
		setTicks(addCondition->getTicks());

		const ConditionAttributes& conditionAttrs = static_cast<const ConditionAttributes&>(*addCondition);
		//Remove the old condition
		endCondition(creature, CONDITIONEND_ABORT);

		//Apply the new one
		memcpy(skills, conditionAttrs.skills, sizeof(skills));
		memcpy(skillsPercent, conditionAttrs.skillsPercent, sizeof(skillsPercent));
		memcpy(stats, conditionAttrs.stats, sizeof(stats));
		memcpy(statsPercent, conditionAttrs.statsPercent, sizeof(statsPercent));

		if(Player* player = creature->getPlayer())
		{
			updatePercentSkills(player);
			updateSkills(player);
			updatePercentStats(player);
			updateStats(player);
		}
	}
}
Ejemplo n.º 16
0
void InventoryState::onAutoequip(Action *)
{
	// don't act when moving items
	if (_inv->getSelectedItem() != 0)
	{
		return;
	}

	BattleUnit               *unit          = _battleGame->getSelectedUnit();
	Tile                     *groundTile    = unit->getTile();
	std::vector<BattleItem*> *groundInv     = groundTile->getInventory();
	Mod                      *mod           = _game->getMod();
	RuleInventory            *groundRuleInv = mod->getInventory("STR_GROUND", true);
	int                       worldShade    = _battleGame->getGlobalShade();

	std::vector<BattleUnit*> units;
	units.push_back(unit);
	BattlescapeGenerator::autoEquip(units, mod, NULL, groundInv, groundRuleInv, worldShade, true, true);

	// refresh ui
	_inv->arrangeGround(false);
	updateStats();
	_refreshMouse();

	// give audio feedback
	_game->getMod()->getSoundByDepth(_battleGame->getDepth(), Mod::ITEM_DROP)->play();
}
Ejemplo n.º 17
0
Computation* ComputationManager::newComputation(const std::vector<NTYPE>& quantifierSequence, const std::vector<BDD>& cubesAtLevels, const BDD& bdd) {
    bool keepFirstLevel = false;
    if (quantifierSequence.size() >= 1) { // && quantifierSequence.at(0) == NTYPE::EXISTS) {
        keepFirstLevel = app.enumerate() || app.modelCount();
    }
    if (keepFirstLevel) {
        if (optUnsatCheckInterval.getValue() > 0 && quantifierSequence.size() >= 1 && quantifierSequence.at(0) == NTYPE::FORALL) {
            throw std::runtime_error("Intermediate UNSAT checking must be disabled for enumeration and counting if outermost quantifier is universal");
        }
        if (optDisableCache.isUsed()) {
            throw std::runtime_error("Removal cache must be enabled for enumeration and counting");

        }
    }
    if (optDisableCache.isUsed()) {
        if ((optMaxGlobalNSFSize.isUsed() && optMaxGlobalNSFSize.getValue() != -1) ||
                (optMaxBDDSize.isUsed() && optMaxBDDSize.getValue() != 0) ||
                (optDependencyScheme.isUsed() && optDependencyScheme.getValue() != "naive")) {
            throw std::runtime_error("Cache can only be disabled if none of NSF size, BDD size, and dependency scheme are set");
        }
        optMaxGlobalNSFSize.setValue("-1");
        optMaxBDDSize.setValue("0");
        optDependencyScheme.setValue("naive");
    }

    
    
    Computation* c = NULL;
    
#ifdef DEPQBF_ENABLED
    if (optDependencyScheme.getValue() == "standard" || (optDependencyScheme.getValue() == "dynamic" && quantifierSequence.size() > 2)) {
        if (depqbf == NULL) {
            initializeDepqbf();
        }
        if (cuddToOriginalIds == NULL) {
            initializeCuddToOriginalIds();
        }
        // always return a new vector
        std::vector<std::set < htd::vertex_t>> notYetRemovedAtLevels = initializeNotYetRemovedAtLevels();

        c = new StandardDependencyCacheComputation(*this, quantifierSequence, cubesAtLevels, bdd, optMaxBDDSize.getValue(), keepFirstLevel, *depqbf, *cuddToOriginalIds, notYetRemovedAtLevels);
    }
#endif
    if (optDependencyScheme.getValue() == "simple") {
        if (variableCountAtLevels == NULL) {
            initializeVariableCountAtLevels();
        }
        c = new SimpleDependencyCacheComputation(*this, quantifierSequence, cubesAtLevels, bdd, optMaxBDDSize.getValue(), keepFirstLevel, *variableCountAtLevels);
    } 
    if (c == NULL) {
        if (!optDisableCache.isUsed()) {
            c = new CacheComputation(*this, quantifierSequence, cubesAtLevels, bdd, optMaxBDDSize.getValue(), keepFirstLevel);
        } else {
            c = new Computation(*this, quantifierSequence, cubesAtLevels, bdd);
        }
    }
    updateStats(*c);
    return c;
}
Ejemplo n.º 18
0
SignStats * CoreData::addStats(QDate &sdate, QDate &edate)
{
    SignStats * stats = new SignStats(sdate, edate);
    updateStats(stats);
    statsReports.insert(stats->getKey(), stats);

    return stats;
}
Ejemplo n.º 19
0
    void RenderTarget::_endUpdate()
    {
         // notify listeners (post)
        firePostUpdate();

        // Update statistics (always on top)
        updateStats();
    }
Ejemplo n.º 20
0
state_t * ship_fail()
{
   printf("Failed to ship parts...\n");
   refund();
   updateStats(LOST);
   return &accepting;
   
}
Ejemplo n.º 21
0
state_t * ship_success()
{
   printf("Successfully shipped parts...\n");
   start_warranty();
   updateStats(DONE);
   exit_from();
   return &accepting;
}
Ejemplo n.º 22
0
GUIPlayer::GUIPlayer( Player* p )
{
  player = p;
  if(nameLabel == NULL)
      nameLabel = new QLabel( this );
  nameLabel->setTextFormat(Qt::RichText);
  updateStats();
}
Ejemplo n.º 23
0
State_selectPart::State_selectPart(Fleet& fleet, const int& shipnum, const char& type, int& resultsave)
: refToFleet(fleet), parttype(type), resultRef(resultsave), page(shipnum)
{
    selector = 0;
    console = new TCODConsole(screenwidth/2, screenheight);
    partConsole = new TCODConsole(screenwidth / 2, screenheight);
    redraw();
    updateStats();
}
Ejemplo n.º 24
0
void CoreData::updateReport()
{
    QMapIterator<QString, SignStats*> ist(statsReports);
    while (ist.hasNext()) {
        ist.next();
        SignStats * stats = ist.value();
        updateStats(stats);
    }
}
Ejemplo n.º 25
0
void ReliabilitySystem::update( float deltaTime ) {
	acked.clear();
	advanceQueueTime( deltaTime );
	updateQueues();
	updateStats();
#ifdef NET_UNIT_TEST
	validate();
#endif
}
Ejemplo n.º 26
0
/**
 * Unloads the selected weapon.
 * @param action Pointer to an action.
 */
void InventoryState::btnUnloadClick(Action *)
{
	if (_inv->unload())
	{
		_txtItem->setText(L"");
		_txtAmmo->setText(L"");
		_selAmmo->clear();
		updateStats();
	}
}
Ejemplo n.º 27
0
void KBBGame::abortGame()
{
  if (running) {
    running = FALSE;
    ballsPlaced = 0;
    updateStats();
    gr->clearFocus();
    emit gameRuns( running );
  }
}
Ejemplo n.º 28
0
/** Public driver routine to call
  * other private update methods */
void Window::update()
{
	updateRink();
	updatePlayers();
	updatePuck();
	updateStats();

	// Swap buffers to show the whole thing
	SDL_Flip(mainSurface);
}
Ejemplo n.º 29
0
// Inicializa los elementos necesarios para la aplicación
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
	setupUi(this);
	setupActions();
	
	// Configura la barra de herramienta
	QMenu *toolBarMenu = menuSettings->addMenu(tr("&Toolbars"));
	toolBar->toggleViewAction()->setShortcut(tr("CTRL+T"));
	toolBar->toggleViewAction()->setStatusTip(tr("Show/Hide Main Toolbar"));
	toolBar->toggleViewAction()->setText(tr("&Main Toolbar"));
	toolBarMenu->addAction(toolBar->toggleViewAction());
	
	actionUndo->setEnabled(false);
	actionRepeat->setEnabled(false);
	
	mStatLabel = new QLabel();
	statusBar()->addPermanentWidget(mStatLabel);
	
	connect(textEdit, SIGNAL(textChanged()),
			this, SLOT(updateStats()));
	
	updateStats();
	
	QDockWidget *templateDocker = new QDockWidget;
	templateDocker->setAllowedAreas(Qt::LeftDockWidgetArea|
									Qt::RightDockWidgetArea);
	templateDocker->setObjectName("TemplateDocker");
	templateDocker->setWindowTitle("Templates");
	addDockWidget(Qt::LeftDockWidgetArea,templateDocker);
	
	QListView *view = new QListView();
	templateDocker->setWidget(view);
	
	TemplateHandler *mTemplate = new TemplateHandler(view, textEdit, this);
	
	templateDocker->toggleViewAction()->setShortcut(tr("CTRL+M"));
	templateDocker->toggleViewAction()->setStatusTip(tr("Show/Hide Template Docker"));
	templateDocker->toggleViewAction()->setText(tr("&Template Docker"));
	toolBarMenu->addAction(templateDocker->toggleViewAction());
	
	// Recuoera la configuración del editor
	readsettings();
}
Ejemplo n.º 30
0
// reset()
// Description: prepare variables for new game
void Game::reset(){
    updateStats();
    m_grid.clear();
    m_gameOver = FALSE;
    resetGrabBag();
    setNextTile();
        
    for(int i = 0;i < INITIAL_TILE_NUM;i++)
        genInitTile();
}