int Sampler::sampleSpaceCheck(bool callback_ok) { if(!samples) return 0; uint32 sampleSize = sizeof(Sample); uint32 callStackDepth = core->callStack ? core->callStack->depth() : 0; sampleSize += callStackDepth * sizeof(StackTrace::Element); sampleSize += sizeof(uint64) * 2; if( callback && callback_ok && !runningCallback && currentSample+sampleSize+samples_size/3 > (samples + samples_size) && !core->GetGC()->Collecting() && !core->GetGC()->Reaping() ) { runningCallback = true; pauseSampling(); Atom args[1] = { nullObjectAtom }; Atom ret = callback->call(0, args); if( ret == falseAtom) stopSampling(); else startSampling(); runningCallback = false; } if(currentSample + sampleSize > samples+samples_size) { /* #ifdef AVMPLUS_VERBOSE core->console << "****** Exhausted Sample Buffer *******\n"; #endif */ // exhausted buffer stopSampling(); return 0; } return 1; }
/// \brief The oscilloscope stopped sampling. void OpenHantekMainWindow::stopped() { this->startStopAction->setText(tr("&Start")); this->startStopAction->setIcon(QIcon(":actions/start.png")); this->startStopAction->setStatusTip(tr("Start the oscilloscope")); disconnect(this->startStopAction, SIGNAL(triggered()), this->dsoControl, SLOT(stopSampling())); connect(this->startStopAction, SIGNAL(triggered()), this->dsoControl, SLOT(startSampling())); }
void OMPLsolver::preSolve() { // clear previously computed solutions ompl_simple_setup_->getProblemDefinition()->clearSolutionPaths(); const ob::PlannerPtr planner = ompl_simple_setup_->getPlanner(); if (planner) planner->clear(); startSampling(); ompl_simple_setup_->getSpaceInformation()->getMotionValidator()->resetMotionCounter(); ompl_simple_setup_->getPlanner()->setProblemDefinition( ompl_simple_setup_->getProblemDefinition()); }
ompl_interface::ConstrainedGoalSampler::ConstrainedGoalSampler(const ModelBasedPlanningContext *pc, const kinematic_constraints::KinematicConstraintSetPtr &ks, const constraint_samplers::ConstraintSamplerPtr &cs) : ob::GoalLazySamples(pc->getOMPLSimpleSetup().getSpaceInformation(), boost::bind(&ConstrainedGoalSampler::sampleUsingConstraintSampler, this, _1, _2), false), planning_context_(pc), kinematic_constraint_set_(ks), constraint_sampler_(cs), work_state_(pc->getCompleteInitialRobotState()), work_joint_group_state_(work_state_.getJointStateGroup(planning_context_->getJointModelGroupName())), verbose_display_(0) { if (!constraint_sampler_) default_sampler_ = si_->allocStateSampler(); logDebug("Constructed a ConstrainedGoalSampler instance at address %p", this); startSampling(); }
ompl::base::GoalLazySamples::GoalLazySamples(const SpaceInformationPtr &si, GoalSamplingFn samplerFunc, bool autoStart, double minDist) : GoalStates(si) , samplerFunc_(std::move(samplerFunc)) , terminateSamplingThread_(false) , samplingThread_(nullptr) , samplingAttempts_(0) , minDist_(minDist) { type_ = GOAL_LAZY_SAMPLES; if (autoStart) startSampling(); }
void V8HeapProfilerAgentImpl::restore() { if (m_state->booleanProperty(HeapProfilerAgentState::heapProfilerEnabled, false)) m_frontend.resetProfiles(); if (m_state->booleanProperty(HeapProfilerAgentState::heapObjectsTrackingEnabled, false)) startTrackingHeapObjectsInternal(m_state->booleanProperty(HeapProfilerAgentState::allocationTrackingEnabled, false)); #if V8_MAJOR_VERSION >= 5 if (m_state->booleanProperty(HeapProfilerAgentState::samplingHeapProfilerEnabled, false)) { ErrorString error; double samplingInterval = m_state->doubleProperty(HeapProfilerAgentState::samplingHeapProfilerInterval, -1); DCHECK_GE(samplingInterval, 0); startSampling(&error, Maybe<double>(samplingInterval)); } #endif }
int main(){ sampleBufferStruct sampleBuffer; initUART(); printf("Start up\n\r"); initSampling(&sampleBuffer); DDRA = 0x01; PORTA = 0x01; startSampling(); while(1){ printf("%d;\n\r",popSample(&sampleBuffer)); } return 0; }
ompl_interface::ConstrainedGoalSampler::ConstrainedGoalSampler(const ModelBasedPlanningContext* pc, kinematic_constraints::KinematicConstraintSetPtr ks, constraint_samplers::ConstraintSamplerPtr cs) : ob::GoalLazySamples(pc->getOMPLSimpleSetup()->getSpaceInformation(), std::bind(&ConstrainedGoalSampler::sampleUsingConstraintSampler, this, std::placeholders::_1, std::placeholders::_2), false) , planning_context_(pc) , kinematic_constraint_set_(std::move(ks)) , constraint_sampler_(std::move(cs)) , work_state_(pc->getCompleteInitialRobotState()) , invalid_sampled_constraints_(0) , warned_invalid_samples_(false) , verbose_display_(0) { if (!constraint_sampler_) default_sampler_ = si_->allocStateSampler(); ROS_DEBUG_NAMED("constrained_goal_sampler", "Constructed a ConstrainedGoalSampler instance at address %p", this); startSampling(); }
void MainWindow::changeAdapter() { ui->plot->detachItems(QwtPlotItem::Rtti_PlotCurve); QList<QLabel *> labels = ui->currentReadings->findChildren<QLabel*>("reading"); while( labels.count() > 0) delete labels.takeFirst(); disconnect(this,SLOT(refreshData())); disconnect(this,SLOT(sampleSeriesAdded(int))); disconnect(this,SLOT(sampleSeriesReset())); if (adapter) { disconnect(adapter,SLOT(startSampling())); disconnect(adapter,SLOT(stopSampling())); delete adapter; adapter = NULL; } if (ui->deviceSelector->currentIndex() > -1) { try { adapter = MultimeterAdapter::createAdapter(ui->deviceSelector->itemData(ui->deviceSelector->currentIndex()).toString()); } catch (...) { ; } } if (not adapter) return; /* for(int i = 0; i < adapter->getChannelCount(); i++) { QLabel *label = new QLabel(); label->setObjectName("reading"); ui->currentReadings->layout()->addWidget(label); QPalette palette; palette.setColor(QPalette::WindowText, getChannelColor(i)); label->setPalette(palette); QwtPlotCurve *curve = new QwtPlotCurve(); curve->setData(new QwtPointSeriesData(adapter->getSamplesList(i))); if (i == 0) curve->setYAxis(QwtPlot::yLeft); else curve->setYAxis(QwtPlot::yRight); curve->setPen(QPen(getChannelColor(i))); ui->plot->enableAxis(curve->yAxis()); curve->attach(ui->plot); } */ refreshData(); connect(adapter,SIGNAL(sampleSeriesAdded(int)), this, SLOT(sampleSeriesAdded(int))); connect(adapter,SIGNAL(sampleSeriesReset()), this, SLOT(sampleSeriesReset())); connect(adapter,SIGNAL(dataChanged()), this, SLOT(refreshData())); connect(ui->startButton, SIGNAL(clicked()), adapter,SLOT(startSampling())); connect(ui->stopButton, SIGNAL(clicked()), adapter, SLOT(stopSampling())); }