SRADA-988 Tracing time now in microseconds in both GUI and CLI tracing.
authorp.privalov <p.privalov@partner.samsung.com>
Fri, 5 Aug 2016 09:18:42 +0000 (12:18 +0300)
committergihun chang <gihun.chang@samsung.com>
Tue, 9 Aug 2016 00:58:34 +0000 (09:58 +0900)
Changes:
 * TracingProcess now count tracing time in microseconds.
 * On open trace action in GUI Toolbar set time of TimerClock in milliseconds.
 * HumanReadableTimeFormat constructor(long) updated to count time correctly
   from microseconds.

Change-Id: I83e64514b73f8f65d0a4c5ba79db3f528505a397
(cherry picked from commit ad6bf771b0290a8e2de04b2ba92780f86239357c)

org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/tracing/TracingProcess.java
org.tizen.dynamicanalyzer.cli/src/org/tizen/dynamicanalyzer/cli/utils/HumanReadableTimeFormat.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java

index b90b28d..218e177 100644 (file)
@@ -59,7 +59,7 @@ public class TracingProcess {
        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;
 
@@ -99,7 +99,7 @@ public class TracingProcess {
                // 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;
        }
 
@@ -108,7 +108,7 @@ public class TracingProcess {
         * 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));
index b5b6480..e9ed359 100644 (file)
@@ -13,9 +13,9 @@ public class HumanReadableTimeFormat implements Serializable {
        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.
@@ -43,11 +43,16 @@ public class HumanReadableTimeFormat implements Serializable {
         * @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;
        }
 
        /**
@@ -60,7 +65,7 @@ public class HumanReadableTimeFormat implements Serializable {
         */
        @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;
index bfb857d..4ef405c 100644 (file)
@@ -1393,7 +1393,7 @@ public enum Toolbar {
                Display.getDefault().syncExec(new Runnable() {
                        @Override
                        public void run() {
-                               timerClock.setTime(time);
+                               timerClock.setTime(time / 1000);
                        }
                });
        }