Skip to content

Commit

Permalink
Edited README to include SimpleTimer example.
Browse files Browse the repository at this point in the history
  • Loading branch information
chuckle-dog authored Mar 16, 2020
1 parent 004d694 commit 00bc49a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,37 @@ public void longLasting() {
}
```

### SimpleTimer

A `SimpleTimer` measures the total amount of time a method or block of code has spent executing. Here is an example of a method simple timer:

```java
@SimplyTimed(name = "simply_timed_method")
public void simplyTimedMethod() {
...
}
```

In the following example, only a part of the method is timed:

```java
@Inject
@Metric(name = "simply_timed_method")
private SimpleTimer simpleTimer;

public void simplyTimedMethod() {
...
final SimpleTimer.Context context = simpleTimer.time();
try {
// complex computations
return;
} finally {
context.stop();
}
...
}
```

## Metric names & metadata

Each metric name is prepended with the fully qualified class name, so they can be easily differentiated between classes
Expand Down

0 comments on commit 00bc49a

Please sign in to comment.