Changeset 539 for Tests


Ignore:
Timestamp:
04/10/12 09:07:04 (10 years ago)
Author:
BegemoT
Message:
 
Location:
Tests/JAVA/test/src/main/java/test/threads/queue/unstressed
Files:
1 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Tests/JAVA/test/src/main/java/test/threads/queue/unstressed/DisruptorTask.java

    r535 r539  
    7070    } 
    7171 
     72    private long sumBeforeGaps = 0; 
     73    private long sumAfterGaps = 0; 
     74    private int gapsMeasured = 0; 
     75 
     76    @Override 
     77    protected BenchmarkResult[] executeImpl( final long millisToBogus, 
     78                                             final long millisToMeasure, 
     79                                             final int measurements ) throws Exception { 
     80        sumBeforeGaps = sumAfterGaps = gapsMeasured = 0; 
     81        return super.executeImpl( millisToBogus, millisToMeasure, measurements ); 
     82    } 
     83 
    7284    @Override 
    7385    protected long dequeueBatchEvents( final int eventsInBatch ) throws Exception { 
    7486        final long seq = lastSequence.get(); 
    7587        final long maxSequence = seq + eventsInBatch; 
     88 
     89        sumBeforeGaps += ringBuffer.getCursor() - seq; 
    7690 
    7791        long sum = 0; 
     
    103117        } 
    104118 
     119        sumAfterGaps += ringBuffer.getCursor() - lastSequence.get(); 
     120        gapsMeasured++; 
    105121        return sum; 
    106122    } 
     
    115131    public void terminate() { 
    116132        super.terminate(); 
     133 
     134        System.out.printf( 
     135                "|b-gap|=%.2f, |a-gap|=%.2f, gaps=%d\n", 
     136                ( sumBeforeGaps * 1.0 / gapsMeasured ), 
     137                ( sumAfterGaps * 1.0 / gapsMeasured ), 
     138                gapsMeasured 
     139        ); 
    117140    } 
    118141 
  • Tests/JAVA/test/src/main/java/test/threads/queue/unstressed/impl/FakeQueue.java

    r526 r539  
    1212 * @since 22.09.11,  13:09 
    1313 */ 
    14 public class DummyQueue<T> implements IQueue<T> { 
     14public class FakeQueue<T> implements IQueue<T> { 
    1515 
    1616    private final LongValueMessage message = new LongValueMessage( 42 ); 
    1717 
    18     public DummyQueue( final int size ) { 
     18    public FakeQueue( final int size ) { 
    1919    } 
    2020 
     
    3434 
    3535    @SuppressWarnings( "unchecked" ) 
    36     public static <T> IBoundedQueueFactory<T, DummyQueue<T>> factory() { 
     36    public static <T> IBoundedQueueFactory<T, FakeQueue<T>> factory() { 
    3737        return FACTORY; 
    3838    } 
    3939 
    40     public static final IBoundedQueueFactory FACTORY = new IBoundedQueueFactory<Object, DummyQueue<Object>>() { 
     40    public static final IBoundedQueueFactory FACTORY = new IBoundedQueueFactory<Object, FakeQueue<Object>>() { 
    4141        @Override 
    42         public DummyQueue<Object> create( final int size ) { 
    43             return new DummyQueue<Object>( size ); 
     42        public FakeQueue<Object> create( final int size ) { 
     43            return new FakeQueue<Object>( size ); 
    4444        } 
    4545 
Note: See TracChangeset for help on using the changeset viewer.