29.10.2009

JxInsight – Where in my code is executed most of the time

In JxInsight just looking at Percentage Total Inherent column you can watch where in your code is executed in most of the time. Just to show, i developed a sample Hibernate application which opens and closes  a connection in hundred times.

for(int i = 0; i < 100; ++i)
{
Session session = HibernateUtil.getSession();
Criteria criteria = session.createCriteria(Customers.class);
criteria.setProjection(Projections.projectionList().
add(Projections.count("customerid")).
add(Projections.groupProperty("customerid"))
);


criteria.add(Expression.eq("customerid", "ALFKI"));
criteria.setComment("Sample Comment");

List<Object> list = criteria.list();





For that code, JxInsight shows me that most of the connection is the most significant time consuming code as you can see from the picture below.



image



From the snapshot, it can be easily understood that what it have to be done is managing the connection. 

Hiç yorum yok: