-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP adding in timers for student orchestrator.
- Loading branch information
Showing
2 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
api/src/main/java/ca/bc/gov/educ/penreg/api/util/Stopwatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package ca.bc.gov.educ.penreg.api.util; | ||
|
||
import java.util.UUID; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
public class Stopwatch { | ||
private long startTime; | ||
private final String functionName; | ||
private final UUID sagaId; | ||
|
||
public Stopwatch(String functionName, UUID sagaId) { | ||
this.functionName = functionName; | ||
this.sagaId = sagaId; | ||
} | ||
|
||
public void start() { | ||
startTime = System.nanoTime(); | ||
} | ||
|
||
public void stop() { | ||
long endTime = System.nanoTime(); | ||
log.info("function :: {} took {} milliseconds for sagaId {}", this.functionName, (endTime - this.startTime) / 10000000, this.sagaId); | ||
} | ||
} |