2010-04-14 - Jakarta Taglibs has been retired.

For more information, please explore the Attic.

Jakarta Project: Benchmark Tag library

Version: 1.0

Table of Contents

Overview

A tag library that facilitates performance testing of other tag libraries or JSP constructs.

Note: You can go here for more lively documentation.

Requirements

This custom tag library requires no software other than a servlet container that supports the JavaServer Pages Specification, version 1.1 or higher.

Configuration

Follow these steps to configure your web application with this tag library:

To use the tags from this library in your JSP pages, add the following directive at the top of each page:

<%@ taglib uri="http://jakarta.apache.org/taglibs/benchmark-1.0" prefix="benchmark" %>

where "benchmark" is the tag name prefix you wish to use for tags from this library. You can change this value to any prefix you like.

Tag Summary

Benchmark Tags
durationTimes its body
excludeExcludes its body from timer
 

Tag Reference

duration Availability: 1.0

Calculates and prints the number of milliseconds taken (in elapsed, "clock" time) to calculate its body. The number is printed after the body. As a hack, this tag can be enclosed by <datetime:format> with an appropriate formatting string (i.e., just referring to hours, minutes, and seconds) to print out a reasonably readable duration.

Tag Bodyjsp    
Restrictions

None

AttributesNameRequired Runtime Expression Evaluation Availability
 repeat  No   No  1.0
 

number of repetitions (default: 1)

 output  No   No  1.0
 

if "true," the tag's body is output (default: false)

VariablesNone
Examples Typically returns between 1000 - 1010 on the author's system.  
 


            
	    <benchmark:duration>
	        <% Thread.sleep(1000); %>
	    </benchmark:duration>
		 
          

exclude Availability: 1.0

Excludes its body from the overall benchmarking test. Some small amount of time is necessary to process these tags themselves, so they are not completely transparent. Nonetheless, they may be useful for integrated timing of a subset of a compound computation.

Tag Bodyjsp    
Restrictions

None

AttributesNone
VariablesNone
Examples Typically returns about 1010 on the author's system.  
 


            
	    <benchmark:duration>
	        <% Thread.sleep(1000); %>
	        <benchmark:exclude>
	            <% Thread.sleep(1000); %>
	        </benchmark:exclude>
	    </benchmark:duration>
		 
          

Examples

See the example application benchmark-examples.war for examples of the usage of the tags from this custom tag library.

Java Docs

Java programmers can view the java class documentation for this tag library as javadocs.

Revision History

Review the complete revision history of this tag library.