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;
	}
	Sampler::~Sampler()
	{
		stopSampling();
 		Sampler* tls = tls_sampler;
 		if (tls == this)
 			tls_sampler = NULL;
	}
Beispiel #3
0
/// \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()));
}
Beispiel #4
0
X_IST::~X_IST()
{
   stopSampling();      // Stop the glove

   if ( NULL != mGlove )
   {
      delete mGlove;    // Delete the glove
      mGlove = NULL;
   }
}
Beispiel #5
0
P5GloveWrapper::~P5GloveWrapper()
{
    stopSampling();      // Stop the glove

    if ( NULL != mGlove )
    {
        delete mGlove;       // Delete the glove
        mGlove = NULL;
    }
}
Beispiel #6
0
static void beginSampling( const char* location, const char* backend )
{
   if( gSamplerRunning )
      stopSampling();

   if( dStricmp( backend, "CSV" ) == 0 )
      gSamplerBackend = new CSVSamplerBackend;
   else
   {
      Con::errorf( "beginSampling -- No backend called '%s'", backend );
      return;
   }

   if( !gSamplerBackend->init( location ) )
   {
      SAFE_DELETE( gSamplerBackend );
   }
   else
   {
      gSamplerRunning = true;
      gCurrentFrameDelta = 0;
   }
}
Beispiel #7
0
 Sampler::~Sampler()
 {
     stopSampling();
     AttachSampler(NULL);
 }
Beispiel #8
0
ompl::base::GoalLazySamples::~GoalLazySamples()
{
    stopSampling();
}
Beispiel #9
0
Vrpn::~Vrpn()
{
   stopSampling();
}
Beispiel #10
0
DataGlove::~DataGlove()
{
   stopSampling();      // Stop the glove
   delete mGlove;       // Delete the glove
}
DataGloveUltraWireless::~DataGloveUltraWireless()
{
   stopSampling();      // Stop the glove
}
Beispiel #12
0
SdlJoystick::~SdlJoystick()
{
   stopSampling();
}
Beispiel #13
0
DirectXJoystick::~DirectXJoystick()
{
   stopSampling();
}
// Destructor.  Sampling is stopped, and the data pool is deallocated.
MotionStar::~MotionStar()
{
   stopSampling();
}
Beispiel #15
0
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()));
}