Java Doc for StopWatch.java in  » J2EE » spring-framework-2.5 » org » springframework » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.util.StopWatch

StopWatch
public class StopWatch (Code)
Simple stop watch, allowing for timing of a number of tasks, exposing total running time and running time for each named task.

Conceals use of System.currentTimeMillis(), improving the readability of application code and reducing the likelihood of calculation errors.

Note that this object is not designed to be thread-safe and does not use synchronization.

This class is normally used to verify performance during proof-of-concepts and in development, rather than as part of production applications.
author:
   Rod Johnson
author:
   Juergen Hoeller
since:
   May 2, 2001


Inner Class :public static class TaskInfo


Constructor Summary
public  StopWatch()
     Construct a new stop watch.
public  StopWatch(String id)
     Construct a new stop watch with the given id.

Method Summary
public  longgetLastTaskTimeMillis()
     Return the time taken by the last task.
public  intgetTaskCount()
     Return the number of tasks timed.
public  TaskInfo[]getTaskInfo()
     Return an array of the data for tasks performed.
public  longgetTotalTimeMillis()
     Return the total time in milliseconds for all tasks.
public  doublegetTotalTimeSeconds()
     Return the total time in seconds for all tasks.
public  booleanisRunning()
     Return whether the stop watch is currently running.
public  StringprettyPrint()
     Return a string with a table describing all tasks performed.
public  voidsetKeepTaskList(boolean keepTaskList)
     Determine whether the TaskInfo array is built over time.
public  StringshortSummary()
     Return a short description of the total running time.
public  voidstart()
     Start an unnamed task.
public  voidstart(String taskName)
     Start a named task.
public  voidstop()
     Stop the current task.
public  StringtoString()
     Return an informative string describing all tasks performed For custom reporting, call getTaskInfo() and use the task info directly.


Constructor Detail
StopWatch
public StopWatch()(Code)
Construct a new stop watch. Does not start any task.



StopWatch
public StopWatch(String id)(Code)
Construct a new stop watch with the given id. Does not start any task.
Parameters:
  id - identifier for this stop watch.Handy when we have output from multiple stop watchesand need to distinguish between them.




Method Detail
getLastTaskTimeMillis
public long getLastTaskTimeMillis() throws IllegalStateException(Code)
Return the time taken by the last task.



getTaskCount
public int getTaskCount()(Code)
Return the number of tasks timed.



getTaskInfo
public TaskInfo[] getTaskInfo()(Code)
Return an array of the data for tasks performed.



getTotalTimeMillis
public long getTotalTimeMillis()(Code)
Return the total time in milliseconds for all tasks.



getTotalTimeSeconds
public double getTotalTimeSeconds()(Code)
Return the total time in seconds for all tasks.



isRunning
public boolean isRunning()(Code)
Return whether the stop watch is currently running.



prettyPrint
public String prettyPrint()(Code)
Return a string with a table describing all tasks performed. For custom reporting, call getTaskInfo() and use the task info directly.



setKeepTaskList
public void setKeepTaskList(boolean keepTaskList)(Code)
Determine whether the TaskInfo array is built over time. Set this to "false" when using a StopWatch for millions of intervals, or the task info structure will consume excessive memory. Default is "true".



shortSummary
public String shortSummary()(Code)
Return a short description of the total running time.



start
public void start() throws IllegalStateException(Code)
Start an unnamed task. The results are undefined if StopWatch.stop() or timing methods are called without invoking this method.
See Also:   StopWatch.stop()



start
public void start(String taskName) throws IllegalStateException(Code)
Start a named task. The results are undefined if StopWatch.stop() or timing methods are called without invoking this method.
Parameters:
  taskName - the name of the task to start
See Also:   StopWatch.stop()



stop
public void stop() throws IllegalStateException(Code)
Stop the current task. The results are undefined if timing methods are called without invoking at least one pair StopWatch.start() / StopWatch.stop() methods.
See Also:   StopWatch.start()



toString
public String toString()(Code)
Return an informative string describing all tasks performed For custom reporting, call getTaskInfo() and use the task info directly.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.