Examples of ProfileConsumer


Examples of com.sun.sgs.profile.ProfileConsumer

     *              object
     */
    TaskAggregateStats(ProfileCollector collector, String name) {
        super(notificationInfo);
        this.collector = collector;
        ProfileConsumer consumer = collector.getConsumer(name);
       
        // We could determine that some of these statistics need to be
        // on all the time (level MIN) so we can use them for load balancing
        // or because they are extremely useful.
        //
        // Note that if the counters are all on the time, we could just
        // as easily use AtomicLongs rather than AggregateProfileCounters.
        ProfileLevel level = ProfileLevel.MEDIUM;
       
        // These statistics are reported to the profile reports
        // directly, with the ProfileCollector.
        // They should not be reported as TASK_AND_AGGREGATE because,
        // for nested tasks, we don't want to merge their values into
        // the parent's value.
        ProfileDataType type = ProfileDataType.AGGREGATE;
       
        numTasks = (AggregateProfileCounter)
                consumer.createCounter("numTasks", type, level);
        numTransactionalTasks = (AggregateProfileCounter)
                consumer.createCounter("numTransactionalTasks", type, level);
        numFailedTasks = (AggregateProfileCounter)
                consumer.createCounter("numFailedTasks", type, level);
        readyCount = (AggregateProfileSample)
                consumer.createSample("readyCount", type, level);
        runtime = (AggregateProfileSample)
                consumer.createSample("runtime", type, level);
        lagtime = (AggregateProfileSample)
                consumer.createSample("lagTime", type, level);
        latency = (AggregateProfileSample)
                consumer.createSample("latency", type, level);
        setSmoothing(smoothingFactor);
    }
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

  
   @Test
   public void testAggregateProfileOperation() throws Exception {
        final String name = "operation";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileOperation op =
                (AggregateProfileOperation)
                    cons1.createOperation(name, testType, ProfileLevel.MIN);
       
        op.report();
        assertEquals(1, op.getCount());
       
        op.report();
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

   }
  
   @Test(expected=IllegalArgumentException.class)
   public void testAggregateProfileNegSmoothing() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp =
                (AggregateProfileSample)
                    cons1.createSample("foo", testType, ProfileLevel.MIN);
        samp.setSmoothingFactor(-1.1);
   }
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

   }
  
   @Test(expected=IllegalArgumentException.class)
   public void testAggregateProfileBadSmoothing() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp =
                (AggregateProfileSample)
                    cons1.createSample("foo", testType, ProfileLevel.MIN);
        samp.setSmoothingFactor(5.0);
   }
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

   }
  
   @Test
   public void testSetSmoothingFactor() throws Exception {
       ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp =
                (AggregateProfileSample)
                    cons1.createSample("bar", testType, ProfileLevel.MIN);
        double smooth = 0.5;
        samp.setSmoothingFactor(smooth);
        assertTrue(smooth == samp.getSmoothingFactor());
       
        smooth = 0.9;
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

  
   @Test
   public void testAggregateProfileSample() throws Exception {
        final String name = "sample";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp =
                (AggregateProfileSample)
                    cons1.createSample(name, testType, ProfileLevel.MIN);
       
        assertEquals(0, samp.getNumSamples());
        for (Long sample : samp.getSamples()) {
            assertNull(sample);
        }
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

   }
  
   @Test
   public void testAggregateProfileSampleCapacity() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        final AggregateProfileSample samp1 =
                (AggregateProfileSample)
                    cons1.createSample("s1", testType, ProfileLevel.MIN);
        // default capacity is zero
        assertEquals(0, samp1.getCapacity());
       
        final AggregateProfileSample samp2 =
                (AggregateProfileSample)
                    cons1.createSample("s2", testType, ProfileLevel.MIN);
        samp2.setCapacity(5);
        assertEquals(5, samp2.getCapacity());
       
        // Add 5 samples, then make sure 6th causes the first to go away
        final long[] testData = {1, 2, 3, 4, 5};
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

    }
   
    @Test
    public void testDataStoreStatsMXBean() throws Exception {
        // Turn on profiling for the store
        ProfileConsumer cons =
            getCollector(serverNode).getConsumer(
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX + "DataStore");
        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name = new ObjectName(DataStoreStatsMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
        DataStoreStatsMXBean bean = (DataStoreStatsMXBean)
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

   
   
    @Test
    public void testDataServiceMXBean() throws Exception {
        // Turn on profiling for the service
        ProfileConsumer cons =
            getCollector(serverNode).getConsumer(
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX + "DataService");
        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name = new ObjectName(DataServiceMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
        DataServiceMXBean bean = (DataServiceMXBean)
View Full Code Here

Examples of com.sun.sgs.profile.ProfileConsumer

    }
   
    @Test
    public void testWatchdogServiceMXBean() throws Exception {
        // Turn on profiling for the service
        ProfileConsumer cons =
            getCollector(serverNode).getConsumer(
                ProfileCollectorImpl.CORE_CONSUMER_PREFIX + "WatchdogService");
        cons.setProfileLevel(ProfileLevel.MAX);
       
        ObjectName name = new ObjectName(WatchdogServiceMXBean.MXBEAN_NAME);
       
        // Ensure the object was registered at startup
        WatchdogServiceMXBean bean = (WatchdogServiceMXBean)
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.