Duration renamed into HumanReadableTimeFormat.
Duration and TracingTime stored in HumanReadableTimeFormat.
HumanReadableTimeFormat implements Serializable.
Change-Id: I2fc0d789007ee75bef991d807353ec9985906b00
import org.tizen.dynamicanalyzer.cli.manager.ProcessManagerMBean;
import org.tizen.dynamicanalyzer.cli.manager.TracingProcessContext;
import org.tizen.dynamicanalyzer.cli.tracing.TracingArguments;
+import org.tizen.dynamicanalyzer.cli.utils.HumanReadableTimeFormat;
import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
import org.tizen.dynamicanalyzer.common.DAResult;
import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
* if it not finished yet
*
* @param device string definition of device
- * @return Tracing time in ms. Not in human readable form by now.
+ * @return Tracing time in human readable form.
* @throws ConnectException if not able to connect with ProcessManager
*/
- public static long getTracingTime(String device) throws ConnectException {
+ public static HumanReadableTimeFormat getTracingTime(String device)
+ throws ConnectException {
ProcessManagerMBean pmProxy = getPMProxyInstance();
return pmProxy.getTracingTime(device);
}
import org.tizen.dynamicanalyzer.cli.CliInternals;
import org.tizen.dynamicanalyzer.cli.manager.TracingProcessContext;
-import org.tizen.dynamicanalyzer.cli.utils.Duration;
+import org.tizen.dynamicanalyzer.cli.utils.HumanReadableTimeFormat;
import org.tizen.dynamicanalyzer.common.DAResult;
import org.tizen.dynamicanalyzer.common.path.PathManager;
import org.tizen.dynamicanalyzer.handlers.CommandAction;
}
}
- Duration duration = new Duration(ctx.getStartTime(), ctx.getFinishTime());
- long tracingTime;
+ HumanReadableTimeFormat duration = new HumanReadableTimeFormat(ctx.getStartTime(), ctx.getFinishTime());
+ HumanReadableTimeFormat tracingTime = null;
try{
tracingTime = CliInternals.getTracingTime(
ctx.getArgs().getDevice());
import org.tizen.dynamicanalyzer.cli.CliInternals;
import org.tizen.dynamicanalyzer.cli.tracing.TracingArguments;
+import org.tizen.dynamicanalyzer.cli.utils.HumanReadableTimeFormat;
import org.tizen.dynamicanalyzer.common.DAResult;
import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
import org.tizen.dynamicanalyzer.util.Logger;
}
@Override
- public synchronized long getTracingTime(String device) {
- return mTracingMap.get(device).getTracingTime();
+ public synchronized HumanReadableTimeFormat getTracingTime(String device) {
+ return new HumanReadableTimeFormat(mTracingMap.get(device)
+ .getTracingTime());
}
@Override
package org.tizen.dynamicanalyzer.cli.manager;
import org.tizen.dynamicanalyzer.cli.tracing.TracingArguments;
+import org.tizen.dynamicanalyzer.cli.utils.HumanReadableTimeFormat;
import org.tizen.dynamicanalyzer.common.DAResult;
import org.tizen.dynamicanalyzer.common.DAResult.ErrorCode;
* still running
*
* @param device String definition of device serial or ip:port
- * @return time in milliseconds or zero
+ * @return time in human readable form.
*/
- long getTracingTime(String device);
+ HumanReadableTimeFormat getTracingTime(String device);
/**
* Stop all tracing processes.
package org.tizen.dynamicanalyzer.cli.utils;
+import java.io.Serializable;
import java.util.Date;
/**
* Class represents duration of some period of time.
*/
-public class Duration {
+public class HumanReadableTimeFormat implements Serializable {
+ /**
+ * Automatically generated class identifier
+ */
+ private static final long serialVersionUID = 8522187457892222028L;
+
/**
* Duration of this time period in milliseconds.
*/
* @param start time when period was started
* @param finish time when period was ended
*/
- public Duration(Date start, Date finish) {
+ public HumanReadableTimeFormat(Date start, Date finish) {
duration_ms = Math.abs(finish.getTime() - start.getTime());
}
+ public HumanReadableTimeFormat(long tracingTime) {
+ duration_ms = tracingTime;
+ }
+
/**
* Get human readable representation of duration.
* E.g.: