If your servlet has a reference to all the SpWatches it created, you can use getElapsedTime on started or stoped watches. If you use the MonitoringServlet to retrieve stopwatches result (i.e. "performances" Counter) from the repository for all registered monitors, you will only get stoped ones.
Don't forget the StopWatch class is not thread-safe and is supposed to be used only once (and the n garbage collected). Nico. 2008/4/28 Susanne Gschwendner <[EMAIL PROTECTED]>: > Hello Nico. My use case is the following: I placed a test servlet under > src/test/java/org.apache.commons.monitoring. The jetty config looks like > this: > > <configuration> > <scanIntervalSeconds>10</scanIntervalSeconds> > <useTestClasspath>true</useTestClasspath> > <webAppConfig> > <contextPath>/monitoring</contextPath> > <tempDirectory>${project.build.directory}/work</tempDirectory> > > > <defaultsDescriptor>src/main/webapp/WEB-INF/webdefault.xml</defaultsDescriptor> > > > <extraClasspath>${basedir}/target/test-classes/org/apache/commons/monitoring/</extraClasspath> > </webAppConfig> > </configuration> > > My test servlet does plainly offer a start button to start a stop watch > and a stop button to stop it. It counts the currently running stopWatches. > I would like to display the time elapsed per watch. > > Regards, Susanne > > -------- Original-Nachricht -------- > > Datum: Sun, 27 Apr 2008 20:46:32 +0200 > > Von: "nicolas de loof" <[EMAIL PROTECTED]> > > An: "Commons Developers List" <dev@commons.apache.org> > > Betreff: Re: [Monitoring] manually test WebUI > > > Please let me know your use case and feature requests. > > I still have to define a clean, stable reporting API, based on JSP tags > > and/or the MonitoringServlet. > > > > cheers, > > > > Nicolas. > > > > 2008/4/27 Susanne Gschwendner <[EMAIL PROTECTED]>: > > > > > Thanks for your hint, the config s ok here. The reason is something > > else, > > > but please don`t bother, I guess I`ll find out... > > > > > > -------- Original-Nachricht -------- > > > > Datum: Sun, 27 Apr 2008 18:11:51 +0200 > > > > Von: "nicolas de loof" <[EMAIL PROTECTED]> > > > > An: "Commons Developers List" <dev@commons.apache.org> > > > > Betreff: Re: [Monitoring] manually test WebUI > > > > > > > You have to configure your WEB-INF/web.xml with : > > > > > > > > <servlet> > > > > <servlet-name>monitoring</servlet-name> > > > > > > > > > > > > > > <servlet-class>org.apache.commons.monitoring.reporting.web.WebUIServlet</servlet-class> > > > > </servlet> > > > > <servlet-mapping> > > > > <servlet-name>monitoring</servlet-name> > > > > <url-pattern>/monitoring/*</url-pattern> > > > > </servlet-mapping> > > > > > > > > > > > > 2008/4/27 Susanne Gschwendner <[EMAIL PROTECTED]>: > > > > > > > > > Thanks for your answer. Requesting monitoring/monitors gave me a > > 'HTTP > > > > > ERROR: 404'. This is the reason for my question. Maybe I missed > > > > something? > > > > > > > > > > I'd like to display the time a stopWatch runs. > > > > > > > > > > Susanne > > > > > > > > > > -------- Original-Nachricht -------- > > > > > > Datum: Sun, 27 Apr 2008 16:59:17 +0200 > > > > > > Von: "nicolas de loof" <[EMAIL PROTECTED]> > > > > > > An: "Commons Developers List" <dev@commons.apache.org> > > > > > > Betreff: Re: [Monitoring] manually test WebUI > > > > > > > > > > > requesting /monitoring/monitors will display all infos about > > > > registered > > > > > > monitors > > > > > > (with MonitoringServlet or WebUIServlet mapped to /monitoring/*) > > > @see > > > > > > src/main/webapp/WEB-INF/web.xml as a sample > > > > > > > > > > > > What do you want to display ? > > > > > > > > > > > > To display some custom data, you may use JSP to select the exact > > > data > > > > > you > > > > > > need from the repository. > > > > > > > > > > > > I'm starting to code some JSP tags to support repository > > rendering, > > > > but > > > > > > this > > > > > > is still early planning. > > > > > > > > > > > > Nico. > > > > > > 2008/4/27 <[EMAIL PROTECTED]>: > > > > > > > > > > > > > Hello. This is a question about the monitoring WebUI. > > > > > > > > > > > > > > Say I have a test-servlet within the maven-jetty. It allows > for > > a > > > > user > > > > > > to > > > > > > > manually start and stop StopWatches. Just to have something to > > > > > > measure... > > > > > > > > > > > > > > Than how do I come from here to get to see the outcome of this > > > > > rendered > > > > > > by > > > > > > > the WebUIServlet? > > > > > > > > > > > > > > Thanks in advance, > > > > > > > > > > > > > > Susanne > > > > > > > -- > > > > > > > GMX startet ShortView.de. Hier findest Du Leute mit Deinen > > > > Interessen! > > > > > > > Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > GMX startet ShortView.de. Hier findest Du Leute mit Deinen > > > Interessen! > > > > > Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED] > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > -- > > > GMX startet ShortView.de. Hier findest Du Leute mit Deinen > Interessen! > > > Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED] > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen! > Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >