Details
-
Improvement
-
Resolution: Fixed
-
None
-
1.5.x
-
None
-
Operating System: Linux
Platform: PC
-
enhancement
-
P1
-
141
Description
I'd like to use Profiler to log the execution times of different parts of my (web)application, but I need to write out the times on a single line upon the completion of the client request.
E.g., I need to see something similar to the following in my logfile:
2009-07-14T15:06:07.364 3258/2342/234
where ##/##/## stands for the time in ms for different parts of my application.
To do that I would need to access programmatically the nested profilers created by Profiler.
Ideally, I would have a getTimeInstrumentByName(String name) method on Profiler that would return a reference to the first sub-TimeInstrument of that name. It would be up to the developer to ensure that all sub-TimeInstruments are uniquely named. A possible implementation would be:
public TimeInstrument getTimeInstrumentByName(String name) {
for (TimeInstrument ti : childTimeInstrumentList) {
if (ti instanceof StopWatch && name.equals(ti.getName())
else
{ TimeInstrument result = ((Profiler)ti).getTimeInstrumentByName(name); if (null != result) return result; } }
return null;
}