Package org.jboss.profiler.jvmti

Examples of org.jboss.profiler.jvmti.InventoryDataPoint


      Map inventory2 = jvmti.produceInventory();
     
      log.info("inventory1.size=" + inventory1.size());
      log.info("inventory2.size=" + inventory2.size());
     
      assertTrue("Test produced unexpected objects",jvmti.compareInventories(System.out, inventory1,inventory2,null, null, new InventoryDataPoint[] {new InventoryDataPoint(Object.class,10)}));
           
      conn.close();
     
      conn = null;
     
View Full Code Here


      Map inventory2 = jvmti.produceInventory();
     
      log.info("inventory1.size=" + inventory1.size());
      log.info("inventory2.size=" + inventory2.size());
     
      assertTrue("Test produced unexpected objects",jvmti.compareInventories(System.out, inventory1,inventory2,null, null, new InventoryDataPoint[] {new InventoryDataPoint(Object.class,10)}));
     
      conn.close();
     
      conn = null;
     
View Full Code Here

         jvmti.forceReleaseOnSoftReferences();
         jvmti.forceGC();

         Map inventory2 = jvmti.produceInventory();

         InventoryDataPoint dataPoint = (InventoryDataPoint) inventory2.get(ProducerState.class);
         if (dataPoint.getInstances() > 1)
         {
            // We should only have this producerState... we will look for where are the
            // other references
            ProducerState originalState = (ProducerState )
                ((DelegateSupport)p1.getDelegate()).getState();
            Object obj[] = jvmti.getAllObjects(ProducerState.class);

            for (int i = 0; i < obj.length; i++)
            {
               if (obj[i] != originalState)
               {
                  log.info("Exploring references on " + obj[i]);
                  Object[] holders = jvmti.getReferenceHolders(new Object[]{obj[i]});

                  for (int j = 0; j < holders.length; j++)
                  {
                     log.info("Holder[" + j + "] = " + holders[j]);
                  }

               }
            }

         }

         assertTrue("Test produced unexpected objects", jvmti.compareInventories(System.out,
            inventory1, inventory2, null, null,
            new InventoryDataPoint[]{new InventoryDataPoint(Object.class, 10)}));

      }
      finally
      {
         if (conn != null)
View Full Code Here

      validateInstances(jvmti, FailoverValve2.class, inventory2, 1);
      validateInstances(jvmti, ClientConsumer.class, inventory2, 1);

      assertTrue("Test produced unexpected objects", jvmti.compareInventories(System.out,
          inventory1, inventory2, null, null,
          new InventoryDataPoint[]{new InventoryDataPoint(java.lang.ref.SoftReference.class, 10),
                                   new InventoryDataPoint(jvmti.getClassByName("java.io.ObjectStreamClass$WeakClassKey"), 100),
             new InventoryDataPoint(jvmti.getClassByName("java.util.concurrent.ConcurrentHashMap$HashEntry"), 100),
             new InventoryDataPoint(jvmti.getClassByName("java.util.WeakHashMap$Entry"), 500)

                                   }));

   }
View Full Code Here

   /** Look on the HEAP information if a given class produced more objects than expected.
    *  If it happened, a report will be generated on the System.out */
   protected void validateInstances(JVMTIInterface jvmti, Class clazz, Map inventory, int maxExpectedResult)
   {
      InventoryDataPoint dataPoint = (InventoryDataPoint) inventory.get(clazz);
      if (dataPoint != null && dataPoint.getInstances() > 1)
      {
         log.info(clazz.getName() + " report -> " + jvmti.exploreObjectReferences(clazz.getName(),5,true));
         fail("Produced unexpected objects (" + dataPoint.getInstances() + " objects, while it was expecting " + maxExpectedResult + ") on " + clazz.getName());
      }
   }
View Full Code Here

      tests[i] = new TestClass(); // allocating 1000 objects
    }
    
    Map secondMap = jvmti.produceInventory(); // the second inventory
   
    InventoryDataPoint point1 = (InventoryDataPoint)secondMap.get(TestClass.class);
    InventoryDataPoint point2 = (InventoryDataPoint)firstMap.get(TestClass.class);
   
    assertEquals(1000,point1.getInstances()-point2.getInstances()); // you can manually compare it
   
    assertTrue(jvmti.compareInventories(System.out,firstMap,secondMap,new Class[]{WeakHashMap.class},new String[]{"[Ljava.util.WeakHashMap$Entry;","java.lang.ref"}, new InventoryDataPoint[]{new InventoryDataPoint(TestClass.class,2000)}));
    assertFalse(jvmti.compareInventories(System.out,firstMap,secondMap,new Class[]{WeakHashMap.class},new String[]{"[Ljava.util.WeakHashMap$Entry;","java.lang.ref"}, new InventoryDataPoint[]{new InventoryDataPoint(TestClass.class,100)}));

  }
View Full Code Here

      Map inventory2 = jvmti.produceInventory();
     
      log.info("inventory1.size=" + inventory1.size());
      log.info("inventory2.size=" + inventory2.size());
     
      assertTrue("Test produced unexpected objects",jvmti.compareInventories(System.out, inventory1,inventory2,null, null, new InventoryDataPoint[] {new InventoryDataPoint(Object.class,10)}));
           
      conn.close();
     
      conn = null;
     
View Full Code Here

      Map inventory2 = jvmti.produceInventory();
     
      log.info("inventory1.size=" + inventory1.size());
      log.info("inventory2.size=" + inventory2.size());
     
      assertTrue("Test produced unexpected objects",jvmti.compareInventories(System.out, inventory1,inventory2,null, null, new InventoryDataPoint[] {new InventoryDataPoint(Object.class,10)}));
     
      conn.close();
     
      conn = null;
     
View Full Code Here

TOP

Related Classes of org.jboss.profiler.jvmti.InventoryDataPoint

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.