-
Notifications
You must be signed in to change notification settings - Fork 0
/
overview.html
34 lines (29 loc) · 1.67 KB
/
overview.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<body>
Java Simon API provides support for implementing an internal application performance monitoring.
Monitors (called Simons) have to be incorporated directly into the code and API provides additional
management features for these monitors.
<p/>
Java Simon is not a tool for profiling in the first place - it is rather the library that helps to
implement performance (and other metrics) monitoring directly in the application as the integral part
of it. Measured metrics can be sampled and stored persistently for later processing, trend analyzing,
problem tracking, etc. It helps to give an additional perspective (history) to the application.
<h2>Using Stopwatch</h2>
{@link org.javasimon.Stopwatch} is probably the most often used monitor. Simple use case looks like this:
<pre>
Stopwatch stopwatch = SimonManager.getStopwatch("stopwatch-name");
Split split = stopwatch.start();
//... measured code
split.stop();
</pre>
Monitors are always obtained from the {@link org.javasimon.Manager} - in this case so called
"default manager" is used via convenient utility class {@link org.javasimon.SimonManager}.
Every time the same name of the monitor is requested the same monitor is returned.
If there is no need for explicit {@code stopwatch} reference first two lines can be shortened to:
<pre>
Split split = SimonManager.getStopwatch("stopwatch-name").start();
</pre>
Instead of stopping the stopwatch directly, there is the {@link org.javasimon.Split} object
that represents the measured time-span. Client code has to keep this reference in order to
stop the measuring, but it also allows for multiple splits measured in parallel without binding
them to specific threads.
</body>