• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Fragment Timing/Profiling Taglib?

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everyone,
Does anyone know of a Taglib that allows to measure the time needed to "execute" the body content? Something like:
<time:time var="timevalue">
...fragment to be measured...
</time:time>
time needed: ${timevalue} milliseconds.
Regards,
Andreas
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That shouldn't be too hard to code up. Perhaps this would be a great opportunity to learn how to write simple custom actions.
 
Author
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Andreas Schildbach:
Hello everyone,
Does anyone know of a Taglib that allows to measure the time needed to "execute" the body content? Something like:
<time:time var="timevalue">
...fragment to be measured...
</time:time>
time needed: ${timevalue} milliseconds.
Regards,
Andreas


There may be a tag library available for this that I'm not aware of, but this is a case where a tag library may be overkill and a couple of simple scriptlets may be a better choice (assuming it's just used during development; if you need this in production it's a different matter):
<% long start = System.currentTimeMillis(); %>
...fragment to be measured...
time needed: <%= System.currentTimeMillis() - start; %> milliseconds.
[ March 11, 2004: Message edited by: Hans Bergsten ]
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sometimes, for keeping the code clean, we will try to use complicated ways to handle simple functions, and this is one of the cases.
I think the rule of thumb is, keep the code as clean as possible, however, only if we dont need to write complicated or complex codes. Since we now only need 2 "single-line" scriptlets, it may not worth to write a simple tag.
However, if this *scriptlet* is executed for every page, say 50 pages, then, of course, converting it into Simple Tag is better.
Nick
 
Wink, wink, nudge, nudge, say no more, it's a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic