Understanding The Results

Profiling information is collected for the following resources:

dbqueries

The number of database queries performed.

dbupdates

The number of database updates performed.

memory

The amount of memory allocated, in bytes. Note that this is an approximation since the Java virtual machine (JVM) does not provide a reliable standard method of retrieving this information.

time

Elapsed time, in milliseconds. Note that on some Windows systems, clock ticks have a length of approximately 16ms, so that all recorded times will be multiples of around 16 milliseconds.

The profiling information for all of these resources is calculated as follows:

  1. Measure the resource on entry to the template.

  2. Measure the resource on exit from the template.

  3. Subtract one value from the other to give the template's gross consumption of that resource.

  4. Subtract from this value the gross consumption of all the template's called templates in order to produce its net consumption.

This method is good enough for most purposes but has some weaknesses that you should be aware of:

  • Since only elapsed time is counted, no account is taken of time-consuming "external" processes, such as garbage collection, memory contention, other threads and so on. This may occasionally cause a template to appear to use a large amount of time, when in fact the time has been used by an external process.

  • Similarly, if garbage collection is carried out while a template is running, it may result in a template apparently using a negative amount of memory. You will never see this in the final results, since such values are set to 0. Nevertheless, it means that the memory usage information is not entirely accurate.

In general, this means that profiling is of little use on a machine that is heavily overloaded.

The statistics are presented in tables with the following columns:

uri

The URI of the monitored template.

total resource

The total amount of resource consumed by the template during the profiling period. The table is sorted by this column, so that the template with the highest consumption is listed first. It is usually this template that you will be most interested in.

invoked

The number of times the template was invoked. Some templates may be called several times per page-view; others may not be called at all.

best

The lowest consumption value recorded for the template. This column is particularly significant because gives an indication of the template's best possible performance, given optimal conditions.

avg

The template's average consumption per invocation: total divided by invoked.

worst

The highest consumption value recorded for the template. This figure should be treated with caution because it can easily be distorted by external processes such as garbage collection, memory contention or JSP compilation.