开发者

Apache Velocity (VTL) Performance Profiling

开发者 https://www.devze.com 2023-04-12 09:25 出处:网络
I need to figure out how long some code is taki开发者_开发百科ng in Velocity (VTL). Something like this:

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消