com.android.volley.VolleyLog.MarkerLog Java Examples

The following examples show how to use com.android.volley.VolleyLog.MarkerLog. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Request.java    From product-emm with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example #2
Source File: Request.java    From CrossBow with Apache License 2.0 6 votes vote down vote up
public void logMarkers() {
    if (MarkerLog.ENABLED) {;
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }
        mEventLog.finish(this.toString());
    }
}
 
Example #3
Source File: Request.java    From volley_demo with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example #4
Source File: Request.java    From product-emm with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example #5
Source File: Request.java    From TitanjumNote with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
        onFinish();
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example #6
Source File: Request.java    From volley with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(
                    new Runnable() {
                        @Override
                        public void run() {
                            mEventLog.add(tag, threadId);
                            mEventLog.finish(Request.this.toString());
                        }
                    });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example #7
Source File: Request.java    From device-database with Apache License 2.0 6 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example #8
Source File: Request.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #9
Source File: Request.java    From WayHoo with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #10
Source File: Request.java    From WayHoo with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #11
Source File: Request.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully
 * or with error).
 * <p>
 * Also dumps all events from this request's event log; for debugging.
 * </p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime()
                        - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #12
Source File: Request.java    From barterli_android with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #13
Source File: Request.java    From android_tv_metro with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #14
Source File: Request.java    From android_tv_metro with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #15
Source File: Request.java    From FeedListViewDemo with MIT License 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #16
Source File: Request.java    From FeedListViewDemo with MIT License 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #17
Source File: Request.java    From okulus with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #18
Source File: Request.java    From okulus with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #19
Source File: Request.java    From jus with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}
 
Example #20
Source File: Request.java    From volley with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #21
Source File: Request.java    From volley with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #22
Source File: Request.java    From android-project-wo2b with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #23
Source File: Request.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #24
Source File: Request.java    From SimplifyReader with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #25
Source File: Request.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 * <p/>
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #26
Source File: Request.java    From android-discourse with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #27
Source File: Request.java    From SaveVolley with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
/*
 * 给 MarkerLog 添加一个 Marker ( Log )
 * 到时候调用 MarkerLog.finish(...) 会一起打印出来
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    }
}
 
Example #28
Source File: Request.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
/**
 * Adds an event to this request's event log; for debugging.
 */
public void addMarker(String tag) {
    if (MarkerLog.ENABLED) {
        mEventLog.add(tag, Thread.currentThread().getId());
    } else if (mRequestBirthTime == 0) {
        mRequestBirthTime = SystemClock.elapsedRealtime();
    }
}
 
Example #29
Source File: Request.java    From android-common-utils with Apache License 2.0 5 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */
void finish(final String tag) {
    if (mRequestQueue != null) {
        mRequestQueue.finish(this);
    }
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.
            Handler mainThread = new Handler(Looper.getMainLooper());
            mainThread.post(new Runnable() {
                @Override
                public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            return;
        }

        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    } else {
        long requestTime = SystemClock.elapsedRealtime() - mRequestBirthTime;
        if (requestTime >= SLOW_REQUEST_THRESHOLD_MS) {
            VolleyLog.d("%d ms: %s", requestTime, this.toString());
        }
    }
}
 
Example #30
Source File: Request.java    From SaveVolley with Apache License 2.0 4 votes vote down vote up
/**
 * Notifies the request queue that this request has finished (successfully or with error).
 *
 * <p>Also dumps all events from this request's event log; for debugging.</p>
 */

/*
 * 通知 这个请求 Request 所在的请求队列( RequestQueue )请求已经结束了
 */
void finish(final String tag) {
    // 判断 请求队列 ( RequestQueue ) 是否 为 null
    if (mRequestQueue != null) {
        // 调用 RequestQueue.finish(Request<T> request)
        mRequestQueue.finish(this);
    }
    // 判断 MarkerLog ( VolleyLog ) 的 开关 是否打开
    if (MarkerLog.ENABLED) {
        final long threadId = Thread.currentThread().getId();
        // 如果不在 主( UI ) 线程 中
        if (Looper.myLooper() != Looper.getMainLooper()) {
            // If we finish marking off of the main thread, we need to
            // actually do it on the main thread to ensure correct ordering.

            // 实例化一个 主( UI ) 线程的 Handler
            Handler mainThread = new Handler(Looper.getMainLooper());

            /*
             * 调用刚才实例化的 主( UI ) 线程的 Handler
             * 在 主( UI ) 线程 中打 log
             */
            mainThread.post(new Runnable() {
                @Override public void run() {
                    mEventLog.add(tag, threadId);
                    mEventLog.finish(this.toString());
                }
            });
            // 然后 返回
            return;
        }

        /*
         * 如果上面没有返回,直接到这了,证明是 主( UI ) 线程 中
         * 直接 打 log
         */
        mEventLog.add(tag, threadId);
        mEventLog.finish(this.toString());
    }
}