Examples of Span


Examples of com.twitter.zipkin.gen.Span

        assertNull(serverSpanImpl.getSpan());
    }

    @Test
    public void testGetSpan() {
        final Span span = serverSpan.getSpan();
        assertNotNull(span);
        assertEquals(TRACE_ID, span.getTrace_id());
        assertEquals(SPAN_ID, span.getId());
        assertEquals(PARENT_SPAN_ID.longValue(), span.getParent_id());
        assertEquals(NAME, span.getName());
        assertNull(span.getAnnotations());
        assertNull(span.getBinary_annotations());

    }
View Full Code Here

Examples of com.twitter.zipkin.gen.Span

        final Response response = target.request().get();
        assertEquals(200, response.getStatus());

        final List<Span> collectedSpans = SpanCollectorForTesting.getInstance().getCollectedSpans();
        assertEquals(2, collectedSpans.size());
        final Span clientSpan = collectedSpans.get(0);
        final Span serverSpan = collectedSpans.get(1);

        assertEquals("Expected trace id's to be equal", clientSpan.getTrace_id(), serverSpan.getTrace_id());
        assertEquals("Expected span id's to be equal", clientSpan.getId(), serverSpan.getId());
        assertEquals("Expected parent span id's to be equal", clientSpan.getParent_id(), serverSpan.getParent_id());
        assertEquals("Span names of client and server should be equal.", clientSpan.getName(), serverSpan.getName());
        assertEquals("Expect 2 annotations.", 2, clientSpan.getAnnotations().size());
        assertEquals("Expect 2 annotations.", 2, serverSpan.getAnnotations().size());
        assertEquals("service name of end points for both client and server annotations should be equal.", clientSpan
                .getAnnotations().get(0).getHost().getService_name(), serverSpan.getAnnotations().get(0).getHost()
                .getService_name());
    }
View Full Code Here

Examples of de.sciss.io.Span

//    HelpGlassPane.setHelp( this, "TimelineAxis" );
  }
 
  private void recalcSpace()
  {
    final Span      visibleSpan;
    final double    d1;
    final VectorSpace  space;
 
//    if( !doc.bird.attemptShared( Session.DOOR_TIME, 250 )) return;
//    try {
      visibleSpan = doc.timeline.getVisibleSpan();
      if( (getFlags() & TIMEFORMAT) == 0 ) {
        space  = VectorSpace.createLinSpace( visibleSpan.getStart(),
                            visibleSpan.getStop(),
                            0.0, 1.0, null, null, null, null );
      } else {
        d1    = 1.0 / doc.timeline.getRate();
        space  = VectorSpace.createLinSpace( visibleSpan.getStart() * d1,
                            visibleSpan.getStop() * d1,
                            0.0, 1.0, null, null, null, null );
      }
      setSpace( space );
//    }
//    finally {
View Full Code Here

Examples of de.sciss.io.Span

  // Sync: attempts doc.timeline
  private void dragTimelinePosition( MouseEvent e )
  {
    int        x   = e.getX();
    Span      span, span2;
    long      position;
    UndoableEdit  edit;

    // translate into a valid time offset
        span        = doc.timeline.getVisibleSpan();
        position    = span.getStart() + (long) ((double) x / (double) getWidth() *
                                                span.getLength());
        position    = Math.max( 0, Math.min( doc.timeline.getLength(), position ));
       
        if( shiftDrag ) {
      span2  = doc.timeline.getSelectionSpan();
      if( altDrag || span2.isEmpty() ) {
        selectionStart = doc.timeline.getPosition();
        altDrag = false;
      } else if( selectionStart == -1 ) {
        selectionStart = Math.abs( span2.getStart() - position ) >
                 Math.abs( span2.getStop() - position ) ?
                 span2.getStart() : span2.getStop();
      }
      span  = new Span( Math.min( position, selectionStart ),
                Math.max( position, selectionStart ));
      edit  = TimelineVisualEdit.select( this, doc, span ).perform();
        } else {
      if( altDrag ) {
        edit  = new CompoundEdit();
        edit.addEdit( TimelineVisualEdit.select( this, doc, new Span() ).perform() );
        edit.addEdit( TimelineVisualEdit.position( this, doc, position ).perform() );
        ((CompoundEdit) edit).end();
        altDrag = false;
      } else {
        edit  = TimelineVisualEdit.position( this, doc, position ).perform();
View Full Code Here

Examples of de.sciss.io.Span

    float[]          sPeakP;
    float          offX, scaleX, scaleY, f1;
    long          start      = info.span.start;
    long          totalLength    = info.getTotalLength();
    Span          chunkSpan;
    long          fullLen, fullStop;
    int            chunkLen, decimLen;
    Rectangle        r;

    try {
      drawBusyList.clear(); // "must be called in the event thread"
     
      if( logAmp ) {
        maxY  = view.getAmpLogMax();
        minY  = view.getAmpLogMin();
        minInpY = (float) Math.exp( minY / TWENTYBYLOG10 );
      } else {
        maxY  = view.getAmpLinMax();
        minY  = view.getAmpLinMin();
        minInpY  = 0// not used
      }
      deltaY  = maxY - minY;
      deltaYN = -4 / deltaY;
      offY  = maxY / deltaY;

//System.out.println( "deltaY " + deltaY + "; deltaYN " + deltaYN + "; offY " + offY );
     
      synchronized( bufSync ) {
        createBuffers();

        while( totalLength > 0 ) {
          fullLen    = Math.min( maxLen, totalLength );
          chunkLen  = (int) (fromPCM ? fullLen : decimHelps[ info.idx ].fullrateToSubsample( fullLen ));
          decimLen  = chunkLen / info.inlineDecim;
          chunkLen  = decimLen * info.inlineDecim;
          fullLen    = (long) chunkLen << info.shift;
//          chunkSpan  = new Span( start, start + fullLen );

          if( fromPCM ) {
            fullStop = fullScale.getSpan().stop;
            chunkSpan = new Span( start, Math.min( fullStop, start + fullLen ));
            fullScale.readFrames( tmpBuf, 0, chunkSpan );
            final long chunkStop = chunkSpan.getLength();
            if( (chunkStop < fullLen) && (chunkStop > 0) ) {
              // duplicate last frames
              for( int i = (int) chunkStop, j = i - 1; i < (int) fullLen; i++ ) {
                for( int ch = 0; ch < fullChannels; ch++ ) {
                  sPeakP    = tmpBuf[ ch ];
                  sPeakP[ i = sPeakP[ j ];
                }
              }
            }
            if( !toPCM ) decimator.decimatePCM( tmpBuf, tmpBuf2, 0, decimLen, info.inlineDecim );
          } else {
            chunkSpan = new Span( start, start + fullLen );
            readFrames( info.idx, tmpBuf2, 0, drawBusyList, chunkSpan, null);
            if( info.inlineDecim > 1 ) decimator.decimate( tmpBuf2, tmpBuf2, 0, decimLen, info.inlineDecim );
          }
          if( toPCM ) {
            if( logAmp ) {
              for( int ch = 0; ch < fullChannels; ch++ ) {
                sPeakP = tmpBuf[ ch ];
                for( int i = 0; i < decimLen; i++ ) {
                  f1 = Math.abs( sPeakP[ i ]);
                  if( f1 > minInpY ) {
                    sPeakP[ i ] = (float) (Math.log( f1 ) * TWENTYBYLOG10);
                  } else {
                    sPeakP[ i ] = minY;
                  }
                }
              }
            }
            for( int ch = 0; ch < fullChannels; ch++ ) {
              sPeakP        = tmpBuf[ ch ];
              r          = view.rectForChannel( ch );
              scaleX        = 4 * r.width / (float) (info.sublength - 1);
              scaleY        = r.height * deltaYN;
              offX        = scaleX * off[ ch ];
              sampleAndHold[ch= scaleX > 16;
              off[ch]        = drawPCM( sPeakP, decimLen, peakPolyX[ ch ],
                                        peakPolyY[ ch ], off[ ch ], offX, scaleX, scaleY, sampleAndHold[ ch ]);
            }
          } else {
            if( logAmp ) {
              for( int ch = 0; ch < fullChannels; ch++ ) {
                off[ ch ] = decimator.drawLog( info, ch, peakPolyX, peakPolyY, rmsPolyX, rmsPolyY, decimLen, view.rectForChannel( ch ), deltaYN, off[ ch ], minY, minInpY );
              }
            } else {
              for( int ch = 0; ch < fullChannels; ch++ ) {
                off[ ch ] = decimator.draw( info, ch, peakPolyX, peakPolyY, rmsPolyX, rmsPolyY, decimLen, view.rectForChannel( ch ), deltaYN, off[ ch ]);
              }
            }
          }
          start += fullLen;
          totalLength -= fullLen;
        }
      } // synchronized( bufSync )

      // System.err.println( "busyList.size() = "+busyList.size() );

      if( toPCM ) {
        final Stroke strkOrig = g2.getStroke();
        g2.setStroke( strkLine );
        g2.setPaint( pntLine );
        for( int ch = 0; ch < fullChannels; ch++ ) {
          r = view.rectForChannel( ch );
          g2.clipRect( r.x, r.y, r.width, r.height );
          g2.translate( r.x, r.y + r.height * offY );
          g2.scale( 0.25f, 0.25f );
          g2.drawPolyline( peakPolyX[ ch ], peakPolyY[ ch ], off[ ch ]);
          g2.setTransform( atOrig );
          g2.setClip( clipOrig );
        }
        g2.setStroke( strkOrig );
      } else {
        // g2.setPaint( pntArea );
        for( int ch = 0; ch < fullChannels; ch++ ) {
          r = view.rectForChannel( ch );
          g2.clipRect( r.x, r.y, r.width, r.height );
          if( !drawBusyList.isEmpty() ) {
            // g2.setColor( Color.red );
            g2.setPaint( pntBusy );
            for( int i = 0; i < drawBusyList.size(); i++ ) {
              chunkSpan = (Span) drawBusyList.get( i );
              scaleX = r.width / (float) info.getTotalLength(); // (info.sublength - 1);
              g2.fillRect( (int) ((chunkSpan.start - info.span.start) * scaleX) + r.x, r.y,
                     (int) (chunkSpan.getLength() * scaleX), r.height );
            }
          }
          g2.translate( r.x, r.y + r.height * offY );
          g2.scale( 0.25f, 0.25f );
          g2.setColor( Color.gray );
View Full Code Here

Examples of de.sciss.io.Span

    final List      coll    = editGetCollByStart( ce );
    final MutableInt  readyLen  = new MutableInt( 0 );
    final MutableInt  busyLen    = new MutableInt( 0 );
    DecimatedStake  stake;
    int          chunkLen, discrepancy;
    Span        subSpan;
    int          readOffset, nextOffset = dataOffset;
    int          len      = (int) (readSpan.getLength() >> decimHelps[ sub ].shift);

    while( (len > 0) && (idx < coll.size()) ) {
      stake    = (DecimatedStake) coll.get( idx );
      subSpan    = new Span( Math.max( stake.getSpan().start, readSpan.start ),
                  Math.min( stake.getSpan().stop, readSpan.stop ));
      stake.readFrames( sub, data, nextOffset, subSpan, readyLen, busyLen );
      chunkLen  = readyLen.value() + busyLen.value();
      readOffset  = nextOffset + readyLen.value(); // chunkLen;
      nextOffset  = (int) ((subSpan.stop + startR) >> decimHelps[ sub ].shift) + dataOffset;
      discrepancy  = nextOffset - readOffset;
      len      -= readyLen.value() + discrepancy;
      if( busyLen.value() == 0 ) {
        if( discrepancy > 0 ) {
          if( readOffset > 0 ) {
            for( int i = readOffset, k = readOffset - 1; i < nextOffset; i++ ) {
              for( int j = 0; j < data.length; j++ ) {
                data[ j ][ i ] = data[ j ][ k ];
              }
            }
          }
        }
      } else {
        busyList.add( new Span( subSpan.stop - (subSpan.getLength() * busyLen.value() / chunkLen),
                    subSpan.stop ));
        for( int i = Math.max( 0, readOffset ); i < nextOffset; i++ ) {
          for( int j = 0; j < data.length; j++ ) {
            data[ j ][ i ] = 0f;
          }
View Full Code Here

Examples of de.sciss.io.Span

    final List          stakes    = fullScale.getAll(true);
    if( stakes.isEmpty() ) return;

    final DecimatedStake    das;
    final Span          union    = fullScale.getSpan();
    final Span          extSpan;
    final long          fullrateStop, fullrateLen; // , insertLen;
    final int          numFullBuf;
    // final CacheManager cm = CacheManager.getInstance();
    final AbstractCompoundEdit  ce      = null; // XXX
    final Object        source    = null; // XXX
    final AudioStake      cacheReadAS;
    final AudioStake      cacheWriteAS;

    synchronized( fileSync ) {
      das      = allocAsync( union );
    }
    extSpan      = das.getSpan();
    // insertLen  = extSpan.getLength();
    fullrateStop  = Math.min( extSpan.getStop(), fullScale.editGetSpan( ce ).stop );
    fullrateLen    = fullrateStop - extSpan.getStart();

    cacheReadAS    = openCacheForRead( model );
    if( cacheReadAS == null ) {
      // cacheWriteAS = fullScale.openCacheForWrite( model,
      // decimHelps[ 0 ].fullrateToSubsample( union.getLength() ));
      cacheWriteAS = openCacheForWrite( model, (fullrateLen + MAXCEILADD) & MAXMASK );
      numFullBuf  = (int) (fullrateLen >> MAXSHIFT);
    } else {
      // cached files always have integer fullBufs!
      numFullBuf  = (int) ((fullrateLen + MAXCEILADD) >> MAXSHIFT);
      cacheWriteAS = null;
    }

    synchronized( bufSync ) {
      createBuffers();
    }

    editClear( source, das.getSpan(), ce );
    editAdd( source, das, ce );

    threadAsync = new Thread( new Runnable() {
      public void run()
      {
final int pri = Thread.currentThread().getPriority();
//System.out.println( "pri was " + pri );
Thread.currentThread().setPriority( pri - 2 );
        final int      minCoarse;
        final CacheManager  cm          = PrefCacheManager.getInstance();
        long        pos;
        // long framesWritten = 0;
        long        framesWrittenCache  = 0;
        boolean        cacheWriteComplete  = false;
        Span        tag2;
        float        f1;
        int          len;
        long        time;
        long        nextTime      = System.currentTimeMillis() + UPDATE_PERIOD;

        if( cacheReadAS != null ) {
          pos = decimHelps[ 0 ].fullrateToSubsample( extSpan.getStart() );
        } else {
          pos = extSpan.getStart();
        }
        minCoarse = MAXCOARSE >> decimHelps[ 0 ].shift;

        try {
          for( int i = 0; (i < numFullBuf) && keepAsyncRunning; i++ ) {
            synchronized( bufSync ) {
              if( cacheReadAS != null ) {
                // System.out.println( "tmpBuf2.length = "+tmpBuf2.length+"; fullChannels = "+fullChannels + "; decimChannels = "+decimChannels );
                tag2 = new Span( pos, pos + minCoarse );
                cacheReadAS.readFrames( tmpBuf2, 0, tag2 );
                das.continueWrite( 0, tmpBuf2, 0, minCoarse );
                subsampleWrite2( tmpBuf2, das, minCoarse );
                pos += minCoarse;
              } else {
                tag2 = new Span(pos, pos + MAXCOARSE);
                // fullScale.readFrames( tmpBuf, 0, tag2, ce );
                fullScale.readFrames(tmpBuf, 0, tag2, null);
                // for( int k = 0; k < tmpBuf.length; k++ ) {
                // for( int j = 0; j < MAXCOARSE; j++ ) {
                // tmpBuf[ k ][ j ] = 0.125f; }}
                subsampleWrite( tmpBuf, tmpBuf2, das, MAXCOARSE,
                                cacheWriteAS, framesWrittenCache );
                pos += MAXCOARSE;
                framesWrittenCache += minCoarse;
              }
              // framesWritten += MAXCOARSE;
            }
            time = System.currentTimeMillis();
            if( time >= nextTime ) {
              nextTime = time + UPDATE_PERIOD;
              if( asyncManager != null ) {
                asyncManager.dispatchEvent( new AsyncEvent(
                    DecimatedWaveTrail.this, AsyncEvent.UPDATE, time, DecimatedWaveTrail.this ));
              }
            }
          }

           // cached files always have integer fullBufs!
          if( (cacheReadAS == null) && keepAsyncRunning ) {
            len = (int) (fullrateStop - pos);
            if( len > 0 ) {
              synchronized( bufSync ) {
                tag2 = new Span( pos, pos + len );
                // fullScale.readFrames( tmpBuf, 0, tag2, ce );
                fullScale.readFrames( tmpBuf, 0, tag2, null );
                for( int ch = 0; ch < fullChannels; ch++ ) {
                  f1 = tmpBuf[ch][len - 1];
                  for( int i = len; i < MAXCOARSE; i++ ) {
View Full Code Here

Examples of de.sciss.io.Span

  throws IOException
  {
    if( DEBUG ) System.err.println( "addAllDep " + union.toString() );

    final DecimatedStake das;
    final Span extSpan;
    final long fullrateStop, fullrateLen; // , insertLen;
    final int numFullBuf;
    final double progWeight;
    long pos;
    long framesWritten = 0;
    Span tag2;
    float f1;
    int len;

    synchronized( fileSync ) {
      das = alloc( union );
    }
    extSpan = das.getSpan();
    pos = extSpan.start;
    // insertLen = extSpan.getLength();
    fullrateStop = Math.min( extSpan.stop, fullScale.editGetSpan( ce ).stop );
    fullrateLen = fullrateStop - extSpan.start;
    progWeight = 1.0 / fullrateLen;
    numFullBuf = (int) (fullrateLen >> MAXSHIFT);

    synchronized( bufSync ) {
      flushProgression();
      createBuffers();

      for( int i = 0; i < numFullBuf; i++ ) {
        tag2 = new Span( pos, pos + MAXCOARSE );
        fullScale.readFrames( tmpBuf, 0, tag2, ce );
        subsampleWrite( tmpBuf, tmpBuf2, das, MAXCOARSE, null, 0 );
        pos += MAXCOARSE;
        framesWritten += MAXCOARSE;

        setProgression( framesWritten, progWeight );
      }

      len = (int) (fullrateStop - pos);
      if( len > 0 ) {
        tag2 = new Span( pos, pos + len );
        fullScale.readFrames( tmpBuf, 0, tag2, ce );
        for( int ch = 0; ch < fullChannels; ch++ ) {
          f1 = tmpBuf[ ch ][ len - 1 ];
          for( int i = len; i < MAXCOARSE; i++ ) {
            tmpBuf[ ch ][ i ] = f1;
View Full Code Here

Examples of de.sciss.io.Span

            return null;
          }
        } else {
          return null;
        }
        fileSpans[ i ] = new Span( 0, cacheAFs[ i ].getFrameNum() );
      }
      // XXX WE NEED A WAY TO CLOSE THE FILES UPON STAKE DISPOSAL XXX
      if( channelMaps.length == 1 ) {
        result = new InterleavedAudioStake( fileSpans[ 0 ], cacheAFs[ 0 ], fileSpans[ 0 ]);
      } else {
View Full Code Here

Examples of de.sciss.io.Span

        // System.out.println( "channels = " + afd.channels );
        afd.file    = f[ i ];
        info      = new AudioFileCacheInfo( audioFiles[ i ], decimModel, audioFiles[ i ].getFrameNum() );
        afd.setProperty( AudioFileDescr.KEY_APPCODE, info.encode() );
        cacheAFs[ i = AudioFile.openAsWrite( afd );
        fileSpans[ i = new Span( 0, decimFrameNum );
      }
      // XXX WE NEED A WAY TO CLOSE THE FILES UPON STAKE DISPOSAL XXX
      if( channelMaps.length == 1 ) {
        result = new InterleavedAudioStake( fileSpans[ 0 ], cacheAFs[ 0 ], fileSpans[ 0 ]);
      } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.