Profile taglib ver. 1.4

    Custom JSP taglib. Lets you measure execution time for your JSP code and use calculated data in your algorithms. For example:
 


<%@ taglib uri="taglib.tld" prefix="calc" %>

<calc:recordTime label="A" log="logfile.txt">

  <!-- some JSP code -->

</calc:recordTime>

in this case tag records execution time for wrapped code fragment. You may examine later recorded time (for example to change on the fly your algorithm, do some redirection, include cache etc.):
 


Min time <cacl:getMinTime label="A" scope="session"/>
Max time <calc:getMaxTime label="A" scope="session"/>
Avg time (global) <calc:getAvgTime label="A"/>

So you may request minimal, maximal and average time for the labeled code fragment (it could be the whole page of course). And any value could be examined in two forms: local view for current session or global view for all users.

Log file lets you proceed data with some statistical package. It is a text file with tab separated fields. Record format is:
 


- daytime
- label
- session ID
- recorded time value (milliseconds)

Tags are:

recordTime

Body tag. Executes own body and calculates execution time. Parameters are:

1) label unique label (ID) for code fragment
2) log Optional parameter. Describes a name for the file where profile will be saved.
3) cond Optional parameter. Describes a boolean value tag's behavior depends on. Default value is true (record time).

getMinTime

Returns minimal time for the given fragment. Parameters are:

1) label fragment's label
2) scope Optional parameter. Describes a scope for your measurement. Possible values are session or application. Default value is application.
3) id Optional parameter. Describes a name for page scope variable (type is java.lang.Long) for data. Without this parameter tag just prints data.

getMaxTime

Returns maximal time for the given fragment. Parameters are:

1) label fragment's label
2) scope Optional parameter. Describes a scope for your measurement. Possible values are session or application. Default value is application.
3) id Optional parameter. Describes a name for page scope variable (type is java.lang.Long) for data. Without this parameter tag just prints data.

getAvgTime

Returns average time for the given fragment. Parameters are:

1) label fragment's label
2) scope Optional parameter. Describes a scope for your measurement. Possible values are session or application. Default value is application.
3) id Optional parameter. Describes a name for page scope variable (type is java.lang.Long) for data. Without this parameter tag just prints data.

for downloading:

Library: proftag.jar    Description: taglib.tld

© Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.

Also in Coldtags: