I need to figure out how long some code is taki开发者_开发百科ng in Velocity (VTL). Something like this:
#set(start = getTickCount())
... do some stuff that takes a while ...
#set(end = getTickCount())
#set(time = end - start)
It took $time milliseconds!
Does Velocity have a getTickCount() function or some equivalent? Or is there some other recommended way to do profiling?
One of my stock VelocityTools is a logging profiler, but if you want to do it more manually as you indicate, you could just stick a tool in there that gives you the currentTimeMillis
, or add the System
class directly as per the static classes docs.
精彩评论