std::unique_ptr<QgsMeshCalculator> QgsMeshCalculatorDialog::calculator() const { std::unique_ptr<QgsMeshCalculator> calc; if ( useExtentCb->isChecked() ) { calc.reset( new QgsMeshCalculator( formulaString(), outputFile(), outputExtent(), startTime(), endTime(), meshLayer() ) ); } else { calc.reset( new QgsMeshCalculator( formulaString(), outputFile(), maskGeometry(), startTime(), endTime(), meshLayer() ) ); } return calc; }
bool TextTrackCueGeneric::isOrderedBefore(const TextTrackCue* that) const { if (that->cueType() == Generic && startTime() == that->startTime() && endTime() == that->endTime()) { // Further order generic cues by their calculated line value. std::pair<double, double> thisPosition = getPositionCoordinates(); std::pair<double, double> thatPosition = toVTTCue(that)->getPositionCoordinates(); return thisPosition.second > thatPosition.second || (thisPosition.second == thatPosition.second && thisPosition.first < thatPosition.first); } if (that->cueType() == Generic) return startTime() > that->startTime(); return VTTCue::isOrderedBefore(that); }
GanttChart* Chromosome::ganttChart() { if(m_chart == nullptr) { int cMax = completionTime(); m_chart = new GanttChart(cMax); QList<GanttMachine*> machines; GanttMachine* m; int machinesCount = Jobshop::instance()->machinesCount(); for(int i=0; i<machinesCount; ++i) { m = new GanttMachine(QString("m%1").arg(i+1), m_chart); machines.append(m); m->setPos(0, i * GanttChart::machineHeight); m->setCMax(cMax); } for(const QString& opId : m_genes) { const Operation& op = Jobshop::instance()->operation(opId); GanttOperation* gop = op.ganttGraphic(); gop->setParentItem(machines[op.machine()]); QPointF pos = GanttChart::operationPosition(startTime(opId)); gop->setPos(pos + GanttChart::machineOffset()); } } return m_chart; }
void BoardDispatch::recvLeaveScoreMode(void) { if(!boardwindow) return; startTime(); //protocol specific or not? boardwindow->qgoboard->leaveScoreMode(); }
void MediumModeWindow::setNewNumber(const unsigned short int newNumber) { this->setWindowTitle(tr("Table de ")+QString::number(newNumber)); _corriger->setText("Corriger"); for(int i = 0; i < 10; ++i) { _label[i]->setText("<span style=\"color: #9FC54D\">"+QString::number(newNumber)+"</span> x "+QString::number(_array[i])); _labelCorrection[i]->setVisible(false); _reponses[i]->clear(); _reponses[i]->setVisible(true); _trueFalseLabel[0][i]->setPixmap(QPixmap(":/image/OpacRight.png")); _trueFalseLabel[1][i]->setPixmap(QPixmap(":/image/OpacWrong.png")); } if(_chronometre != NULL) { _chronometre->stop(); delete _chronometre; } _secondes = 0; _minute->setText("00"); _seconde->setText("00"); startTime(); _reponses[0]->setFocus(); }
void ContinuousServiceUpdateAction::_setFromParametersMap(const ParametersMap& map) { try { _service = ContinuousServiceTableSync::GetEditable(map.get<RegistryKeyType>(PARAMETER_SERVICE_ID), *_env); } catch(ObjectNotFoundException<ContinuousService>&) { throw ActionException("No such service"); } _duration = minutes(map.get<int>(PARAMETER_WAITING_DURATION)); time_duration endTime(not_a_date_time); if(!map.getDefault<string>(PARAMETER_END_TIME).empty()) { try { endTime = duration_from_string(map.get<string>(PARAMETER_END_TIME)); } catch(bad_lexical_cast) { throw ActionException("Bad end time"); } } time_duration startTime(_service->getDepartureSchedule(false, 0)); _range = endTime - startTime; }
bool VTTCue::isEqual(const VTTCue& cue, CueMatchRules match) const { if (cueType() != cue.cueType()) return false; if (match != IgnoreDuration && endTime() != cue.endTime()) return false; if (startTime() != cue.startTime()) return false; if (text() != cue.text()) return false; if (cueSettings() != cue.cueSettings()) return false; if (id() != cue.id()) return false; if (position() != cue.position()) return false; if (line() != cue.line()) return false; if (size() != cue.size()) return false; if (align() != cue.align()) return false; return true; }
void QmlProfilerRangeModel::computeNestingContracted() { int i; int eventCount = count(); int nestingLevels = QmlDebug::Constants::QML_MIN_LEVEL; int collapsedRowCount = nestingLevels + 1; QVector<qint64> nestingEndTimes; nestingEndTimes.fill(0, nestingLevels + 1); for (i = 0; i < eventCount; i++) { qint64 st = startTime(i); // per type if (nestingEndTimes[nestingLevels] > st) { if (++nestingLevels == nestingEndTimes.size()) nestingEndTimes << 0; if (nestingLevels == collapsedRowCount) ++collapsedRowCount; } else { while (nestingLevels > QmlDebug::Constants::QML_MIN_LEVEL && nestingEndTimes[nestingLevels-1] <= st) nestingLevels--; } nestingEndTimes[nestingLevels] = st + duration(i); m_data[i].displayRowCollapsed = nestingLevels; } setCollapsedRowCount(collapsedRowCount); }
void QmlProfilerRangeModel::findBindingLoops() { typedef QPair<int, int> CallStackEntry; QStack<CallStackEntry> callStack; for (int i = 0; i < count(); ++i) { int potentialParent = callStack.isEmpty() ? -1 : callStack.top().second; while (potentialParent != -1 && !(endTime(potentialParent) > startTime(i))) { callStack.pop(); potentialParent = callStack.isEmpty() ? -1 : callStack.top().second; } // check whether event is already in stack for (int ii = 0; ii < callStack.size(); ++ii) { if (callStack.at(ii).first == typeId(i)) { m_data[i].bindingLoopHead = callStack.at(ii).second; break; } } CallStackEntry newEntry(typeId(i), i); callStack.push(newEntry); } }
static void test_fma() { for(int i=0; i<1020 * 4; i++) { data_f[i] = i; } float32x4_t c0_02 = vdupq_n_f32(0.02f); float32x4_t c0_04 = vdupq_n_f32(0.04f); float32x4_t c0_05 = vdupq_n_f32(0.05f); float32x4_t c0_10 = vdupq_n_f32(0.1f); float32x4_t c0_20 = vdupq_n_f32(0.2f); float32x4_t c1_00 = vdupq_n_f32(1.0f); startTime(); // Do ~1 billion ops for (int ct=0; ct < (1000 * (1000 / 80)); ct++) { for (int i=0; i < 1000; i++) { float32x4_t t; t = vmulq_f32(vld1q_f32((float32_t *)&data_f[i]), c0_02); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+4]), c0_04); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+8]), c0_05); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+12]), c0_10); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+16]), c0_20); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+20]), c0_20); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+24]), c0_10); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+28]), c0_05); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+32]), c0_04); t = vmlaq_f32(t, vld1q_f32((float32_t *)&data_f[i+36]), c0_02); t = vaddq_f32(t, c1_00); vst1q_f32((float32_t *)&data_f[i], t); } } endTime("neon fma", 1e9); }
void MemoryUsageModel::loadEvent(const QmlEvent &event, const QmlEventType &type) { if (type.message() != MemoryAllocation) { if (type.rangeType() != MaximumRangeType) { if (event.rangeStage() == RangeStart) m_rangeStack.push(RangeStackFrame(event.typeIndex(), event.timestamp())); else if (event.rangeStage() == RangeEnd) m_rangeStack.pop(); m_continuation = ContinueNothing; } return; } auto canContinue = [&](EventContinuation continuation) { QTC_ASSERT(continuation != ContinueNothing, return false); if ((m_continuation & continuation) == 0) return false; int currentIndex = (continuation == ContinueAllocation ? m_currentJSHeapIndex : m_currentUsageIndex); if (m_rangeStack.isEmpty()) { qint64 amount = event.number<qint64>(0); // outside of ranges show monotonous allocation or deallocation return (amount >= 0 && m_data[currentIndex].allocated >= 0) || (amount < 0 && m_data[currentIndex].deallocated > 0); } else { return m_data[currentIndex].typeId == m_rangeStack.top().originTypeIndex && m_rangeStack.top().startTime < startTime(currentIndex); } };
void BoardDispatch::recvRefuseDrawRequest(void) { //FIXME startTime(); //protocol specific or not if(boardwindow) boardwindow->qgoboard->recvRefuseDraw(); }
int main(void) { zmq::context_t context(1); zmq::socket_t socket(context,ZMQ_PUB); socket.bind("tcp://*:6002"); int file; char *filename = "/dev/i2c-1"; if ((file=open(filename,O_RDWR)) < 0){ std::cout << "Failed to open the bus" << std::endl; return 1; } if (ioctl(file,I2C_SLAVE,0x29) < 0) { std::cout << "Failed to talk to slave" << std::endl; return 1; } pressure pboard(file); startTime(); while(true) { std::ostringstream pss; pss << "2\t" << pboard.getPressure() << getElapsed() << std::endl; s_send(socket,pss.str()) } }
void QmlProfilerRangeModel::finalize() { if (!m_stack.isEmpty()) { qWarning() << "End times for some events are missing."; const qint64 endTime = modelManager()->traceEnd(); do { int index = m_stack.pop(); insertEnd(index, endTime - startTime(index)); } while (!m_stack.isEmpty()); } // compute range nesting computeNesting(); // compute nestingLevel - nonexpanded computeNestingContracted(); // compute nestingLevel - expanded computeExpandedLevels(); if (supportsBindingLoops()) findBindingLoops(); QmlProfilerTimelineModel::finalize(); }
int PixmapCacheModel::updateCacheCount(int lastCacheSizeEvent, qint64 pixmapStartTime, qint64 pixSize, PixmapCacheItem &newEvent, int typeId) { newEvent.pixmapEventType = PixmapCacheCountChanged; newEvent.rowNumberCollapsed = 1; newEvent.typeId = typeId; int index = lastCacheSizeEvent; if (lastCacheSizeEvent != -1) { newEvent.cacheSize = m_data[lastCacheSizeEvent].cacheSize + pixSize; qint64 duration = pixmapStartTime - startTime(lastCacheSizeEvent); if (duration > 0) { insertEnd(lastCacheSizeEvent, duration); index = insertStart(pixmapStartTime, 0); m_data.insert(index, newEvent); } else { // If the timestamps are the same, just replace it m_data[index] = newEvent; } } else { newEvent.cacheSize = pixSize; index = insertStart(pixmapStartTime, 0); m_data.insert(index, newEvent); } return index; }
void PixmapCacheModel::flattenLoads() { int collapsedRowCount = 0; // computes "compressed row" QVector <qint64> eventEndTimes; for (int i = 0; i < count(); i++) { PixmapCacheModel::PixmapCacheItem &event = m_data[i]; if (event.pixmapEventType == PixmapCacheModel::PixmapLoadingStarted) { event.rowNumberCollapsed = 0; while (eventEndTimes.count() > event.rowNumberCollapsed && eventEndTimes[event.rowNumberCollapsed] > startTime(i)) event.rowNumberCollapsed++; if (eventEndTimes.count() == event.rowNumberCollapsed) eventEndTimes << 0; // increase stack length, proper value added below eventEndTimes[event.rowNumberCollapsed] = endTime(i); // readjust to account for category empty row and bargraph event.rowNumberCollapsed += 2; } if (event.rowNumberCollapsed > collapsedRowCount) collapsedRowCount = event.rowNumberCollapsed; } // Starting from 0, count is maxIndex+1 setCollapsedRowCount(collapsedRowCount + 1); setExpandedRowCount(m_pixmaps.count() + 2); }
static void test_mad() { for(int i=0; i<1020; i++) { data_f[i] = i; } startTime(); // Do ~1 billion ops for (int ct=0; ct < (1000 * (1000 / 20)); ct++) { for (int i=0; i < 1000; i++) { data_f[i] = (data_f[i] * 0.02f + data_f[i+1] * 0.04f + data_f[i+2] * 0.05f + data_f[i+3] * 0.1f + data_f[i+4] * 0.2f + data_f[i+5] * 0.2f + data_f[i+6] * 0.1f + data_f[i+7] * 0.05f + data_f[i+8] * 0.04f + data_f[i+9] * 0.02f + 1.f); } } endTime("scalar mad", 1e9); }
Sudoku::Sudoku(int nivel, bool cargar, QWidget *parent) : QMainWindow(parent), ui(new Ui::Sudoku) { ui->setupUi(this); setWindowTitle("Sudoku"); setWindowIcon(QIcon(":/recursos/Imagenes/logo.JPG")); setFixedSize(width(),height()); if(!cargar){ bool ok; nombre=QInputDialog::getText(this,"Juego Nuevo","Ingrese el nombre del jugador:",QLineEdit::Normal,"",&ok); } Tablero* t = new Tablero(); inicializarMatriz(); iniciarTeclado(); t->generarTablero(); pasarTableroAMatriz(t->casillas); inicializarTablasUI(t->casillas); ocultarCasillas(nivel,t); if(cargar){ cargarPartida(); } pasarMatrizAUI(); inicializarCronometro(); startTime(); }
void ScaleAffector::animate(long long dt, long long age) { W_UNUSED(dt); float d = delta(age, startTime(), endTime()); Vector ds = priv->end - priv->start; Vector scale = priv->start + (ds*d); sprite->scale(scale); }
bool OEffectiveEvent::operator<( const OEffectiveEvent &e ) const{ if ( data->date < e.date() ) return TRUE; if ( data->date == e.date() ) return ( startTime() < e.startTime() ); else return FALSE; }
// --------------------------------------------------------------------------- // duration // --------------------------------------------------------------------------- //! Return time, in seconds, spanned by this Partial, or 0. if there //! are no Breakpoints. // double Partial::duration( void ) const { if ( numBreakpoints() == 0 ) { return 0.; } return endTime() - startTime(); }
void CurOp::setMaxTimeMicros(uint64_t maxTimeMicros) { if (maxTimeMicros == 0) { // 0 is "allow to run indefinitely". return; } // Note that calling startTime() will set CurOp::_start if it hasn't been set yet. _maxTimeTracker.setTimeLimit(startTime(), maxTimeMicros); }
QVariantMap DebugMessagesModel::details(int index) const { const QmlEventType &type = modelManager()->qmlModel()->eventTypes()[m_data[index].typeId]; QVariantMap result; result.insert(QLatin1String("displayName"), messageType(type.detailType())); result.insert(tr("Timestamp"), QmlProfilerDataModel::formatTime(startTime(index))); result.insert(tr("Message"), m_data[index].text); result.insert(tr("Location"), type.displayName()); return result; }
void KDGanttViewEventItem::setLeadTime( const QDateTime& leadTimeStart ) { if (!myLeadTime) myLeadTime = new QDateTime; *myLeadTime = leadTimeStart; if ( startTime() < leadTime() ) setStartTime( leadTimeStart ); else { updateCanvasItems(); } }
bool SetMicroTimer(uint64_t micro) { LogAssert(m_scheduler->IsMainThread()); TimeSpec startTime(TimeSpec::MonoNow()); if (startTime.empty()) return false; return setExpireTime(startTime, micro); }
void PixmapCacheModel::finalize() { if (m_lastCacheSizeEvent != -1) { insertEnd(m_lastCacheSizeEvent, modelManager()->traceTime()->endTime() - startTime(m_lastCacheSizeEvent)); } resizeUnfinishedLoads(); computeMaxCacheSize(); flattenLoads(); computeNesting(); }
bool CCActiveAnimation::isFinishedAt(double monotonicTime) const { if (m_runState == Finished || m_runState == Aborted) return true; if (m_needsSynchronizedStartTime) return false; return m_runState == Running && m_iterations >= 0 && m_iterations * m_curve->duration() <= monotonicTime - startTime() - m_totalPausedTime; }
int EventEditor::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QObject::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 11) qt_static_metacall(this, _c, _id, _a); _id -= 11; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< QString*>(_v) = subject(); break; case 1: *reinterpret_cast< QString*>(_v) = location(); break; case 2: *reinterpret_cast< QDateTime*>(_v) = startTime(); break; case 3: *reinterpret_cast< QDateTime*>(_v) = endTime(); break; case 4: *reinterpret_cast< int*>(_v) = folderId(); break; case 5: *reinterpret_cast< int*>(_v) = accountId(); break; case 6: *reinterpret_cast< Mode*>(_v) = mode(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSubject(*reinterpret_cast< QString*>(_v)); break; case 1: setLocation(*reinterpret_cast< QString*>(_v)); break; case 2: setStartTime(*reinterpret_cast< QDateTime*>(_v)); break; case 3: setEndTime(*reinterpret_cast< QDateTime*>(_v)); break; case 4: setFolderId(*reinterpret_cast< int*>(_v)); break; case 5: setAccountId(*reinterpret_cast< int*>(_v)); break; case 6: setMode(*reinterpret_cast< Mode*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
void PixmapCacheModel::resizeUnfinishedLoads() { // all the unfinished "load start" events continue till the end of the trace for (auto pixmap = m_pixmaps.begin(), pixmapsEnd = m_pixmaps.end(); pixmap != pixmapsEnd; ++pixmap) { for (auto size = pixmap->sizes.begin(), sizesEnd = pixmap->sizes.end(); size != sizesEnd; ++size) { if (size->loadState == Loading) { insertEnd(size->started, modelManager()->traceTime()->endTime() - startTime(size->started)); size->loadState = Error; } } } }
void CurOp::setMaxTimeMicros(uint64_t maxTimeMicros) { _maxTimeMicros = maxTimeMicros; if (_maxTimeMicros == 0) { // 0 is "allow to run indefinitely". return; } // If the operation has a start time, then enable the tracker. // // If the operation has no start time yet, then ensureStarted() will take responsibility for // enabling the tracker. if (isStarted()) { _maxTimeTracker.setTimeLimit(startTime(), _maxTimeMicros); } }