asyncTraceEnd ( )源码实例Demo

android.os.Trace#asyncTraceEnd ( )源码实例Demo

下面列出了android.os.Trace#asyncTraceEnd ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AndroidComponentPlugin   文件: BroadcastQueue.java
private final void addBroadcastToHistoryLocked(BroadcastRecord original) {
    if (original.callingUid < 0) {
        // This was from a registerReceiver() call; ignore it.
        return;
    }
    original.finishTime = SystemClock.uptimeMillis();

    if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) {
        Trace.asyncTraceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER,
            createBroadcastTraceTitle(original, BroadcastRecord.DELIVERY_DELIVERED),
            System.identityHashCode(original));
    }

    // Note sometimes (only for sticky broadcasts?) we reuse BroadcastRecords,
    // So don't change the incoming record directly.
    final BroadcastRecord historyRecord = original.maybeStripForHistory();

    mBroadcastHistory[mHistoryNext] = historyRecord;
    mHistoryNext = ringAdvance(mHistoryNext, 1, MAX_BROADCAST_HISTORY);

    mBroadcastSummaryHistory[mSummaryHistoryNext] = historyRecord.intent;
    mSummaryHistoryEnqueueTime[mSummaryHistoryNext] = historyRecord.enqueueClockTime;
    mSummaryHistoryDispatchTime[mSummaryHistoryNext] = historyRecord.dispatchClockTime;
    mSummaryHistoryFinishTime[mSummaryHistoryNext] = System.currentTimeMillis();
    mSummaryHistoryNext = ringAdvance(mSummaryHistoryNext, 1, MAX_BROADCAST_SUMMARY_HISTORY);
}
 
源代码2 项目: android_9.0.0_r45   文件: VibratorService.java
@GuardedBy("mLock")
private void doCancelVibrateLocked() {
    Trace.asyncTraceEnd(Trace.TRACE_TAG_VIBRATOR, "vibration", 0);
    Trace.traceBegin(Trace.TRACE_TAG_VIBRATOR, "doCancelVibrateLocked");
    try {
        mH.removeCallbacks(mVibrationEndRunnable);
        if (mThread != null) {
            mThread.cancel();
            mThread = null;
        }
        doVibratorOff();
        reportFinishVibrationLocked();
    } finally {
        Trace.traceEnd(Trace.TRACE_TAG_VIBRATOR);
    }
}
 
源代码3 项目: android_9.0.0_r45   文件: PowerManagerService.java
private void logScreenOn() {
    Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, TRACE_SCREEN_ON, 0);

    final int latencyMs = (int) (SystemClock.uptimeMillis() - mLastWakeTime);

    LogMaker log = new LogMaker(MetricsEvent.SCREEN);
    log.setType(MetricsEvent.TYPE_OPEN);
    log.setSubtype(0); // not user initiated
    log.setLatency(latencyMs); // How long it took.
    MetricsLogger.action(log);
    EventLogTags.writePowerScreenState(1, 0, 0, 0, latencyMs);

    if (latencyMs >= SCREEN_ON_LATENCY_WARNING_MS) {
        Slog.w(TAG, "Screen on took " + latencyMs+ " ms");
    }
}
 
源代码4 项目: android_9.0.0_r45   文件: PowerManagerService.java
@Override
public void release() {
    synchronized (this) {
        mReferenceCount -= 1;
        if (mReferenceCount == 0) {
            if (DEBUG_SPEW) {
                Slog.d(TAG, "Releasing suspend blocker \"" + mName + "\".");
            }
            nativeReleaseSuspendBlocker(mName);
            Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, mTraceName, 0);
        } else if (mReferenceCount < 0) {
            Slog.wtf(TAG, "Suspend blocker \"" + mName
                    + "\" was released without being acquired!", new Throwable());
            mReferenceCount = 0;
        }
    }
}
 
源代码5 项目: android_9.0.0_r45   文件: BroadcastQueue.java
private final void addBroadcastToHistoryLocked(BroadcastRecord original) {
    if (original.callingUid < 0) {
        // This was from a registerReceiver() call; ignore it.
        return;
    }
    original.finishTime = SystemClock.uptimeMillis();

    if (Trace.isTagEnabled(Trace.TRACE_TAG_ACTIVITY_MANAGER)) {
        Trace.asyncTraceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER,
            createBroadcastTraceTitle(original, BroadcastRecord.DELIVERY_DELIVERED),
            System.identityHashCode(original));
    }

    // Note sometimes (only for sticky broadcasts?) we reuse BroadcastRecords,
    // So don't change the incoming record directly.
    final BroadcastRecord historyRecord = original.maybeStripForHistory();

    mBroadcastHistory[mHistoryNext] = historyRecord;
    mHistoryNext = ringAdvance(mHistoryNext, 1, MAX_BROADCAST_HISTORY);

    mBroadcastSummaryHistory[mSummaryHistoryNext] = historyRecord.intent;
    mSummaryHistoryEnqueueTime[mSummaryHistoryNext] = historyRecord.enqueueClockTime;
    mSummaryHistoryDispatchTime[mSummaryHistoryNext] = historyRecord.dispatchClockTime;
    mSummaryHistoryFinishTime[mSummaryHistoryNext] = System.currentTimeMillis();
    mSummaryHistoryNext = ringAdvance(mSummaryHistoryNext, 1, MAX_BROADCAST_SUMMARY_HISTORY);
}
 
源代码6 项目: android_9.0.0_r45   文件: UserState.java
public void setState(int newState) {
    if (newState == state) {
        return;
    }
    final int userId = mHandle.getIdentifier();
    if (state != STATE_BOOTING) {
        Trace.asyncTraceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER,
                stateToString(state) + " " + userId, userId);
    }
    if (newState != STATE_SHUTDOWN) {
        Trace.asyncTraceBegin(Trace.TRACE_TAG_ACTIVITY_MANAGER,
                stateToString(newState) + " " + userId, userId);
    }
    Slog.i(TAG, "User " + userId + " state changed from "
            + stateToString(state) + " to " + stateToString(newState));
    EventLogTags.writeAmUserStateChanged(userId, newState);
    lastState = state;
    state = newState;
}
 
源代码7 项目: android_9.0.0_r45   文件: SQLiteConnection.java
private boolean endOperationDeferLogLocked(int cookie) {
    final Operation operation = getOperationLocked(cookie);
    if (operation != null) {
        if (Trace.isTagEnabled(Trace.TRACE_TAG_DATABASE)) {
            Trace.asyncTraceEnd(Trace.TRACE_TAG_DATABASE, operation.getTraceMethodName(),
                    operation.mCookie);
        }
        operation.mEndTime = SystemClock.uptimeMillis();
        operation.mFinished = true;
        final long execTime = operation.mEndTime - operation.mStartTime;
        mPool.onStatementExecuted(execTime);
        return SQLiteDebug.DEBUG_LOG_SLOW_QUERIES && SQLiteDebug.shouldLogSlowQuery(
                execTime);
    }
    return false;
}
 
private void unblockScreenOn() {
    if (mPendingScreenOnUnblocker != null) {
        mPendingScreenOnUnblocker = null;
        long delay = SystemClock.elapsedRealtime() - mScreenOnBlockStartRealTime;
        Slog.i(TAG, "Unblocked screen on after " + delay + " ms");
        Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, SCREEN_ON_BLOCKED_TRACE_NAME, 0);
    }
}
 
private void unblockScreenOff() {
    if (mPendingScreenOffUnblocker != null) {
        mPendingScreenOffUnblocker = null;
        long delay = SystemClock.elapsedRealtime() - mScreenOffBlockStartRealTime;
        Slog.i(TAG, "Unblocked screen off after " + delay + " ms");
        Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, SCREEN_OFF_BLOCKED_TRACE_NAME, 0);
    }
}
 
源代码10 项目: android_9.0.0_r45   文件: PowerManagerService.java
@Override
protected void finalize() throws Throwable {
    try {
        if (mReferenceCount != 0) {
            Slog.wtf(TAG, "Suspend blocker \"" + mName
                    + "\" was finalized without being released!");
            mReferenceCount = 0;
            nativeReleaseSuspendBlocker(mName);
            Trace.asyncTraceEnd(Trace.TRACE_TAG_POWER, mTraceName, 0);
        }
    } finally {
        super.finalize();
    }
}
 
源代码11 项目: android_9.0.0_r45   文件: ActivityMetricsLogger.java
private void stopLaunchTrace(WindowingModeTransitionInfo info) {
    if (info == null) {
        return;
    }
    if (info.launchTraceActive) {
        Trace.asyncTraceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER, "launching: "
                + info.launchedActivity.packageName, 0);
        info.launchTraceActive = false;
    }
}
 
源代码12 项目: android_9.0.0_r45   文件: ValueAnimator.java
/**
 * Called internally to end an animation by removing it from the animations list. Must be
 * called on the UI thread.
 */
private void endAnimation() {
    if (mAnimationEndRequested) {
        return;
    }
    removeAnimationCallback();

    mAnimationEndRequested = true;
    mPaused = false;
    boolean notify = (mStarted || mRunning) && mListeners != null;
    if (notify && !mRunning) {
        // If it's not yet running, then start listeners weren't called. Call them now.
        notifyStartListeners();
    }
    mRunning = false;
    mStarted = false;
    mStartListenersCalled = false;
    mLastFrameTime = -1;
    mFirstFrameTime = -1;
    mStartTime = -1;
    if (notify && mListeners != null) {
        ArrayList<AnimatorListener> tmpListeners =
                (ArrayList<AnimatorListener>) mListeners.clone();
        int numListeners = tmpListeners.size();
        for (int i = 0; i < numListeners; ++i) {
            tmpListeners.get(i).onAnimationEnd(this, mReversing);
        }
    }
    // mReversing needs to be reset *after* notifying the listeners for the end callbacks.
    mReversing = false;
    if (Trace.isTagEnabled(Trace.TRACE_TAG_VIEW)) {
        Trace.asyncTraceEnd(Trace.TRACE_TAG_VIEW, getNameForTrace(),
                System.identityHashCode(this));
    }
}
 
源代码13 项目: android_9.0.0_r45   文件: ActivityMetricsLogger.java
void stopFullyDrawnTraceIfNeeded() {
    if (mDrawingTraceActive) {
        Trace.asyncTraceEnd(Trace.TRACE_TAG_ACTIVITY_MANAGER, "drawing", 0);
        mDrawingTraceActive = false;
    }
}
 
如果文章对您有帮助,请点击页面广告。以鼓励作者做出的努力。
 方法所在类