private long startTime;
/**
- * Stop time value in milliseconds. It's initialized at application stop
+ * Stop time value in microseconds. It's initialized at application stop
*/
private volatile long tracingTime;
// If CliInternals.startTracing returns Success the StartTraceManager thread still may fail
if (!DAState.isRunning() && result==ErrorCode.SUCCESS)
result = ErrorCode.ERR_EXCEPTION_OCCURRED;
- startTime = System.currentTimeMillis();
+ startTime = System.nanoTime() / 1000;
return result;
}
* This method should not block caller thread during performing tracing stop.
*/
public synchronized void stopTrace() {
- tracingTime = System.currentTimeMillis() - startTime;
+ tracingTime = System.nanoTime() / 1000 - startTime;
Global.getProject().setTotalStopTime(tracingTime);
socketConnection.sendMessage(MessageType.INFO_TRACING_TIME,
Long.toString(tracingTime));
private static final long serialVersionUID = 8522187457892222028L;
/**
- * Duration of this time period in milliseconds.
+ * Time period in milliseconds.
*/
- long duration_ms;
+ long time_ms;
/**
* Count of milliseconds in a second.
* @param finish time when period was ended
*/
public HumanReadableTimeFormat(Date start, Date finish) {
- duration_ms = Math.abs(finish.getTime() - start.getTime());
+ time_ms = Math.abs(finish.getTime() - start.getTime());
}
- public HumanReadableTimeFormat(long tracingTime) {
- duration_ms = tracingTime;
+ /**
+ * Public constructor. It gets time in microseconds.
+ *
+ * @param time_microsec time in microseconds.
+ */
+ public HumanReadableTimeFormat(long time_microsec) {
+ time_ms = time_microsec / 1000;
}
/**
*/
@Override
public String toString() {
- long diff_ms = this.duration_ms;
+ long diff_ms = this.time_ms;
long days = diff_ms / MS_IN_DAY;
diff_ms %= MS_IN_DAY;