Package com.bluesoft.util.metrics.core.domain

Examples of com.bluesoft.util.metrics.core.domain.BasicTimingEvent


  @Test
  public void testAddEvent() {
    TimingMetric mock = createMock( TimingMetric.class );
    UnitRoundingTimingMetric rounder = new UnitRoundingTimingMetric( TimeUnit.MINUTES, TimeUnit.MILLISECONDS, mock );
    final BasicTimingEvent event = new BasicTimingEvent( 0L, 15L );
    mock.addEvent( same( event ) );
    expectLastCall().once();
    replay( mock );
    rounder.addEvent( event );
    verify( mock );
View Full Code Here


    MeteringMetric m = new BasicMeteringMetric( "testMeter" );
    DistributingMetric dm = new DistributingMetric<>( "testDist",
                                                      map( pairOf( Conditions.all(), "testTimer" ), pairOf( Conditions.exception(), "testMeter" ) ),
                                                      t, m );

    dm.addEvent( new BasicTimingEvent( 0, 1000L ) );
    dm.addEvent( new BasicTimingEvent( 0, 2000L, null, null, new RuntimeException( "test ex" ) ) );

    assertEquals( t.getCount(), BigInteger.valueOf( 2 ) );
    assertEquals( m.getCount(), BigInteger.valueOf( 1 ) );
  }
View Full Code Here

  @Test
  public void testTiming() {
    TimingMetric<TimingMetric, TimingEvent> tm = new BasicTimingMetric<>( "foo", 0 );
    long now = System.currentTimeMillis();
    tm.addEvent( new BasicTimingEvent( now - 5, now ) );
    tm.addEvent( new BasicTimingEvent( now - 10, now ) );
    tm.addEvent( new BasicTimingEvent( now - 3, now ) );
    tm.addEvent( new BasicTimingEvent( now - 4, now ) );
    tm.addEvent( new BasicTimingEvent( now - 5, now ) );
    tm.addEvent( new BasicTimingEvent( now - 2, now ) );

    Timing mean = tm.getMean();
    Timing median = tm.getCentile( new BigDecimal( 50L ) );
    BigDecimal stddev = tm.getStandardDeviation().getValue();
    Timing total = tm.getTotal();
View Full Code Here

    } );

    TimingMetric baseTimingMetric = new BasicTimingMetric( "testTimingMetric" );
    TimingMetric asyncTimingMetric = testManager.createQueuedTimingMetric( baseTimingMetric );
    long now = System.currentTimeMillis();
    asyncTimingMetric.addEvent( new BasicTimingEvent( now - 5, now ) );
    assertEquals( baseTimingMetric.getCount(), BigInteger.ONE );
    assertEquals( asyncTimingMetric.getCount(), BigInteger.ONE );
    assertEquals( eventCount, 1 );
  }
View Full Code Here

    } catch ( Exception ex ) {
      exception = ex;
      throw ex;
    } finally {
      final long end = System.nanoTime();
      metric.addEvent( new BasicTimingEvent( start, end, null, result, exception ) );
    }
  }
View Full Code Here

TOP

Related Classes of com.bluesoft.util.metrics.core.domain.BasicTimingEvent

Copyright © 2018 www.massapicom. 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.