I need to get the cpu usage of the current process using jsp.
My scenario is like when user navigate from one page to other I need to check the cpu utilization, memory usage of the process.
I need to get the cpu usage of the current process using jsp.
My scenario is like when user navigate from one page to other I need to check the cpu utilization, memory usage of the process.
If you want to do this on every request, also in production (although I highly question the need for this, it would only make it more CPU-expensive), then grab JMX. If you want to do this for testing/profiling purposes (which would make more sense), then grab a Java profiler.
As to the JSP-targeted question, JSP is just a Java based view technology. Raw Java code belongs in a real Java class. If you want to go for JMX, then you rather want to do this in a Filter
which is mapped on the url-pattern
of interest, e.g. *.jsp
.