Esempio n. 1
0
Duration::Duration(const QLoggingCategory& category,
                   const QString& name,
                   uint32_t argbColor,
                   uint64_t payload,
                   const QVariantMap& baseArgs) :
    DurationBase(category, name) {
    if (tracingEnabled() && category.isDebugEnabled()) {
        QVariantMap args = baseArgs;
        args["nv_payload"] = QVariant::fromValue(payload);
        tracing::traceEvent(_category, _name, tracing::DurationBegin, "", args);

#if defined(NSIGHT_TRACING)
        nvtxEventAttributes_t eventAttrib{ 0 };
        eventAttrib.version = NVTX_VERSION;
        eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
        eventAttrib.colorType = NVTX_COLOR_ARGB;
        eventAttrib.color = argbColor;
        eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
        eventAttrib.message.ascii = name.toUtf8().data();
        eventAttrib.payload.llValue = payload;
        eventAttrib.payloadType = NVTX_PAYLOAD_TYPE_UNSIGNED_INT64;

        nvtxRangePushEx(&eventAttrib);
#endif
    }
}
Esempio n. 2
0
// FIXME
void Duration::endRange(const QLoggingCategory& category, uint64_t rangeId) {
#ifdef NSIGHT_TRACING
    if (tracingEnabled() && category.isDebugEnabled()) {
        nvtxRangeEnd(rangeId);
    }
#endif
}
Esempio n. 3
0
void IEC::updateIecLines()
{
	bool signals_changed;
	bool atn_edge;
			
	// Update port lines
	signals_changed = _updateIecLines(&atn_edge);	

	// Check if ATN edge occurred
	if (atn_edge) {
		drive->simulateAtnInterrupt();
	}

	if (signals_changed) {
		if (busActivity == 0) {
			// Bus activity detected
			drive->c64->putMessage(MSG_VC1541_DATA, 1);
			drive->c64->setWarp(drive->c64->getAlwaysWarp() || drive->c64->getWarpLoad());
		}
		busActivity = 30;
	}

	if (signals_changed && tracingEnabled()) {
		dumpTrace();
	}
}
Esempio n. 4
0
Duration::~Duration() {
    if (tracingEnabled() && _category.isDebugEnabled()) {
        tracing::traceEvent(_category, _name, tracing::DurationEnd);
#ifdef NSIGHT_TRACING
        nvtxRangePop();
#endif
    }
}
Esempio n. 5
0
ConditionalDuration::~ConditionalDuration() {
    if (tracingEnabled() && _category.isDebugEnabled()) {
        auto endTime = tracing::Tracer::now();
        auto duration = endTime - _startTime;
        if (duration >= _minTime) {
            tracing::traceEvent(_category, _startTime, _name, tracing::DurationBegin);
            tracing::traceEvent(_category, endTime, _name, tracing::DurationEnd);
        }
    }
}
Esempio n. 6
0
// FIXME
uint64_t Duration::beginRange(const QLoggingCategory& category, const char* name, uint32_t argbColor) {
#ifdef NSIGHT_TRACING
    if (tracingEnabled() && category.isDebugEnabled()) {
        nvtxEventAttributes_t eventAttrib = { 0 };
        eventAttrib.version = NVTX_VERSION;
        eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
        eventAttrib.colorType = NVTX_COLOR_ARGB;
        eventAttrib.color = argbColor;
        eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
        eventAttrib.message.ascii = name;
        return nvtxRangeStartEx(&eventAttrib);
    }
#endif
    return 0;
}
Esempio n. 7
0
void QgsMapToolCapture::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
  QgsMapToolAdvancedDigitizing::cadCanvasMoveEvent( e );
  QgsPointXY point = e->mapPoint();

  mSnapIndicator->setMatch( e->mapPointMatch() );

  if ( !mTempRubberBand && mCaptureCurve.numPoints() > 0 )
  {
    mTempRubberBand = createRubberBand( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry, true );
    QgsPoint pt = mCaptureCurve.endPoint();
    mTempRubberBand->addPoint( QgsPointXY( pt.x(), pt.y() ) );
    mTempRubberBand->addPoint( point );
  }


  if ( mCaptureMode != CapturePoint && mTempRubberBand && mCapturing )
  {
    bool hasTrace = false;
    if ( tracingEnabled() && mCaptureCurve.numPoints() != 0 )
    {
      hasTrace = tracingMouseMove( e );
    }

    if ( !hasTrace )
    {
      if ( mCaptureCurve.numPoints() > 0 )
      {
        // fix temporary rubber band after tracing which may have added multiple points
        mTempRubberBand->reset( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry );
        if ( mCaptureMode == CapturePolygon )
          mTempRubberBand->addPoint( *mRubberBand->getPoint( 0, 0 ), false );
        QgsPoint pt = mCaptureCurve.endPoint();
        QgsPointXY mapPt = toMapCoordinates( qobject_cast<QgsVectorLayer *>( mCanvas->currentLayer() ), QgsPointXY( pt.x(), pt.y() ) );
        mTempRubberBand->addPoint( mapPt );
        mTempRubberBand->addPoint( point );

        // fix existing rubber band after tracing - the last point may have been moved if using offset
        if ( mRubberBand->numberOfVertices() )
          mRubberBand->movePoint( mapPt );
      }
      else
        mTempRubberBand->movePoint( point );
    }
  }
} // mouseMoveEvent
Esempio n. 8
0
int QgsMapToolCapture::addVertex( const QgsPointXY &point, const QgsPointLocator::Match &match )
{
  if ( mode() == CaptureNone )
  {
    QgsDebugMsg( QStringLiteral( "invalid capture mode" ) );
    return 2;
  }

  int res;
  QgsPoint layerPoint;
  res = fetchLayerPoint( match, layerPoint );
  if ( res != 0 )
  {
    res = nextPoint( QgsPoint( point ), layerPoint );
    if ( res != 0 )
    {
      return res;
    }
  }

  if ( !mRubberBand )
  {
    mRubberBand = createRubberBand( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry );
  }

  if ( !mTempRubberBand )
  {
    mTempRubberBand = createRubberBand( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry, true );
  }
  else
  {
    mTempRubberBand->reset( mCaptureMode == CapturePolygon ? QgsWkbTypes::PolygonGeometry : QgsWkbTypes::LineGeometry );
  }

  bool traceCreated = false;
  if ( tracingEnabled() )
  {
    traceCreated = tracingAddVertex( point );
  }

  // keep new tracing start point if we created a trace. This is useful when tracing with
  // offset so that the user stays "snapped"
  mTracingStartPoint = traceCreated ? point : QgsPointXY();

  if ( !traceCreated )
  {
    // ordinary digitizing
    mRubberBand->addPoint( point );
    mCaptureCurve.addVertex( layerPoint );
    mSnappingMatches.append( match );
  }

  if ( mCaptureMode == CaptureLine )
  {
    mTempRubberBand->addPoint( point );
  }
  else if ( mCaptureMode == CapturePolygon )
  {
    const QgsPointXY *firstPoint = mRubberBand->getPoint( 0, 0 );
    mTempRubberBand->addPoint( *firstPoint );
    mTempRubberBand->movePoint( point );
    mTempRubberBand->addPoint( point );
  }

  validateGeometry();

  return 0;
}