Repository: incubator-weex Updated Branches: refs/heads/0.16-dev 57802c0ae -> 207415679
+ [android] tracing Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/6ae8f8d1 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/6ae8f8d1 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/6ae8f8d1 Branch: refs/heads/0.16-dev Commit: 6ae8f8d1541c706e5be5be4f08710d1225229702 Parents: d3a1e1d Author: moxun.ljf <furm...@foxmail.com> Authored: Wed Jun 7 11:23:08 2017 +0800 Committer: moxun.ljf <furm...@foxmail.com> Committed: Wed Jun 7 11:23:08 2017 +0800 ---------------------------------------------------------------------- .../java/com/taobao/weex/common/WXTracing.java | 43 ++++++++++++++++++++ 1 file changed, 43 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/6ae8f8d1/android/sdk/src/main/java/com/taobao/weex/common/WXTracing.java ---------------------------------------------------------------------- diff --git a/android/sdk/src/main/java/com/taobao/weex/common/WXTracing.java b/android/sdk/src/main/java/com/taobao/weex/common/WXTracing.java new file mode 100644 index 0000000..49fbe4b --- /dev/null +++ b/android/sdk/src/main/java/com/taobao/weex/common/WXTracing.java @@ -0,0 +1,43 @@ +package com.taobao.weex.common; + +import com.taobao.weex.utils.WXLogUtils; + +import java.util.concurrent.atomic.AtomicInteger; + +/** + * Created by moxun on 2017/6/6. + */ + +public class WXTracing { + private static final AtomicInteger sIdGenerator = new AtomicInteger(0); + + public static int nextId() { + return sIdGenerator.getAndIncrement(); + } + + public static void submit(TraceEvent event) { + WXLogUtils.d("WXTracing", event.toString()); + } + + public static class TraceEvent { + public String name; + public String phase; + public String threadName; + public long timestamp; + public long nanoTime; + public long duration; + + @Override + public String toString() { + final StringBuffer sb = new StringBuffer("TraceEvent{"); + sb.append("name='").append(name).append('\''); + sb.append(", threadName='").append(threadName).append('\''); + sb.append(", phase='").append(phase).append('\''); + sb.append(", timestamp=").append(timestamp); + sb.append(", nanoTime=").append(nanoTime); + sb.append(", duration=").append(duration); + sb.append('}'); + return sb.toString(); + } + } +}