Package com.sun.sgs.profile

Examples of com.sun.sgs.profile.ProfileConsumer


      throw new NullPointerException("null graph");
  }
        this.graph = graph;
        this.snapCount = snapCount;
        this.snapPeriod = snapPeriod;
        ProfileConsumer consumer = collector.getConsumer(CONS_NAME);
        ProfileLevel level = ProfileLevel.MEDIUM;
        ProfileDataType type = ProfileDataType.AGGREGATE;

        processingTime = (AggregateProfileCounter)
                consumer.createCounter("processingTime", type, level);
        updateCount = (AggregateProfileCounter)
                consumer.createCounter("updateCount", type, level);
        pruneCount = (AggregateProfileCounter)
                consumer.createCounter("pruneCount", type, level);
    }
View Full Code Here


    {
        super(AffinityGroupFinderMXBean.class, true);
        stopIteration = stopIter;
        this.finder = finder;

        ProfileConsumer consumer = collector.getConsumer(CONS_NAME);
        ProfileLevel level = ProfileLevel.MEDIUM;
        ProfileDataType type = ProfileDataType.AGGREGATE;

        iterations = (AggregateProfileSample)
                consumer.createSample("iterations", type, level);
        runtime = (AggregateProfileSample)
                consumer.createSample("runtime", type, level);
        runs = (AggregateProfileCounter)
                consumer.createCounter("runs", type, level);
        failed = (AggregateProfileCounter)
                consumer.createCounter("failed", type, level);
        stopped = (AggregateProfileCounter)
                consumer.createCounter("stopped", type, level);
    }
View Full Code Here

       
        Map<String, ProfileConsumer> consumerMap =
                profileCollector.getConsumers();
        int count = consumerMap.size();
       
        ProfileConsumer pc1 = collector.getConsumer("Cons1");
        ProfileConsumer pc2 = collector.getConsumer("Cons2");
       
        consumerMap = profileCollector.getConsumers();
        assertSame(count+2, consumerMap.size());
        assertEquals(pc1, consumerMap.get("Cons1"));
        assertEquals(pc2, consumerMap.get("Cons2"));
View Full Code Here

        collector.getConsumer("Cons2");
       
        Map<String, ProfileConsumer> consumerMap =
                profileCollector.getConsumers();
        int count = consumerMap.size();
        ProfileConsumer pc1 = consumerMap.get("Cons2");
       
        // Test that the map isn't modified if we try adding the same
        // named consumer a second time
        ProfileConsumer pc2 = collector.getConsumer("Cons2");
        assertSame(count, consumerMap.size());
        assertSame(pc2, pc1);
    }
View Full Code Here

     * Create a data store statistics object.
     * @param collector the profile collector used to create profiling
     *     objects and register the MBean with JMX
     */
    DataStoreStats(ProfileCollector collector) {
        ProfileConsumer consumer =
            collector.getConsumer(ProfileCollectorImpl.CORE_CONSUMER_PREFIX
                                  + "DataStore");
        ProfileLevel level = ProfileLevel.MAX;
        ProfileDataType type = ProfileDataType.TASK_AND_AGGREGATE;
       
  createObjectOp =
            consumer.createOperation("createObject", type, level);
  markForUpdateOp =
            consumer.createOperation("markForUpdate", type, level);
  getObjectOp = consumer.createOperation("getObject", type, level);
  getObjectForUpdateOp =
      consumer.createOperation("getObjectForUpdate", type, level);
  setObjectOp = consumer.createOperation("setObject", type, level);
  setObjectsOp = consumer.createOperation("setObjects", type, level);
  removeObjectOp =
            consumer.createOperation("removeObject", type, level);
  getBindingOp = consumer.createOperation("getBinding", type, level);
  setBindingOp = consumer.createOperation("setBinding", type, level);
  removeBindingOp =
            consumer.createOperation("removeBinding", type, level);
  nextBoundNameOp =
            consumer.createOperation("nextBoundName", type, level);
  getClassIdOp = consumer.createOperation("getClassId", type, level);
  getClassInfoOp =
            consumer.createOperation("getClassInfo", type, level);
  nextObjectIdOp =
            consumer.createOperation("nextObjectIdOp", type, level);
       
        // Counters
  readBytesCounter = consumer.createCounter("readBytes", type, level);
  readObjectsCounter =
      consumer.createCounter("readObjects", type, level);
  writtenBytesCounter =
      consumer.createCounter("writtenBytes", type, level);
  writtenObjectsCounter =
      consumer.createCounter("writtenObjects", type, level);
       
        // Samples
  readBytesSample =
            consumer.createSample("readBytes", type, level);
  writtenBytesSample =
            consumer.createSample("writtenBytes", type, level);
    }
View Full Code Here

    /* -- Consumer tests -- */
    @Test
    public void testConsumerName() throws Exception {
        final String name = "consumer1";
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons = collector.getConsumer(name);
        assertEquals(name, cons.getName());
    }
View Full Code Here

    }
   
    @Test
    public void testConsumerSetLevel() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        assertEquals(profileCollector.getDefaultProfileLevel(),
                     cons1.getProfileLevel());
       
        cons1.setProfileLevel(ProfileLevel.MIN);
        assertEquals(ProfileLevel.MIN, cons1.getProfileLevel());
        cons1.setProfileLevel(ProfileLevel.MEDIUM);
        assertEquals(ProfileLevel.MEDIUM, cons1.getProfileLevel());
        cons1.setProfileLevel(ProfileLevel.MAX);
        assertEquals(ProfileLevel.MAX, cons1.getProfileLevel());
    }
View Full Code Here

    }
   
    @Test
    public void testConsumerSetCollectorLevel() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileLevel cons1Level = cons1.getProfileLevel();
        assertEquals(profileCollector.getDefaultProfileLevel(), cons1Level);

        // Change default level from what the kernel set, make sure it
        // affects later consumers.
        profileCollector.setDefaultProfileLevel(ProfileLevel.MIN);
        ProfileConsumer cons2 = collector.getConsumer("c2");
        assertEquals(profileCollector.getDefaultProfileLevel(),
                     cons2.getProfileLevel());
        // and make sure other consumers aren't affected
        assertEquals(cons1Level, cons1.getProfileLevel());
    }
View Full Code Here

   
    /* -- Counter tests -- */
    @Test(expected=NullPointerException.class)
    public void testCounterTaskBadName() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileCounter c1 =
            cons1.createCounter(null, ProfileDataType.TASK, ProfileLevel.MIN);
    }
View Full Code Here

            cons1.createCounter(null, ProfileDataType.TASK, ProfileLevel.MIN);
    }
    @Test(expected=NullPointerException.class)
    public void testCounterAggregateBadName() throws Exception {
        ProfileCollector collector = getCollector(serverNode);
        ProfileConsumer cons1 = collector.getConsumer("c1");
        ProfileCounter c1 =
            cons1.createCounter(null,
                                ProfileDataType.AGGREGATE, ProfileLevel.MIN);
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.profile.ProfileConsumer

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.