Skip to content

Commit

Permalink
TimedPhase only supports Nanoseconds.
Browse files Browse the repository at this point in the history
--The start time is encoded in nanoseconds, and doing unit conversions
sounds like more work than I want to do, or is likely to be needed. So
while `TimedPhase` can be queried for its unit (so that `RequestLog`
doesn't have to worry about it), the unit has to be nanoseconds
  • Loading branch information
archolewa committed Jan 23, 2017
1 parent 45c9b68 commit dec9756
Showing 1 changed file with 3 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,29 +16,17 @@ public class TimedPhase implements AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(TimedPhase.class);

private final String name;
private final TimeUnit unit;
private long start;
private long duration;

/**
* Constructor.
*
* @param name Name of the phase
* @param unit The timer's units
*/
public TimedPhase(String name, TimeUnit unit) {
this.name = name;
this.unit = unit;
}

/**
* Constructor.
* Times in nanoseconds.
* Times are in nanoseconds.
*
* @param name Name of the phase
*/
public TimedPhase(String name) {
this(name, TimeUnit.NANOSECONDS);
this.name = name;
}

/**
Expand Down Expand Up @@ -74,7 +62,7 @@ public String getName() {
}

public TimeUnit getUnit() {
return unit;
return TimeUnit.NANOSECONDS;
}

public boolean isStarted() {
Expand Down

0 comments on commit dec9756

Please sign in to comment.