Java Code Examples for android.os.Debug#stopMethodTracing()

The following examples show how to use android.os.Debug#stopMethodTracing() . 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: MainActivity.java    From androidtestdebug with MIT License 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setContentView(R.layout.activity_main);
	
	Debug.startMethodTracing("tracedemo");
	long startTime = System.nanoTime();
	ReadCsv();
	long readCsvEndTime = System.nanoTime();

	StockPriceItem[] stockPrices = SortPriceFromHighestToLowest("High");
	long sortEndTime = System.nanoTime();

	Debug.stopMethodTracing();
	
	final ListView listview = (ListView) findViewById(R.id.listview);
	ArrayAdapter<StockPriceItem> adapter = new ArrayAdapter<StockPriceItem>(this,
			android.R.layout.simple_list_item_1, stockPrices);
	listview.setAdapter(adapter);
	long endTime = System.nanoTime();

	Log.i("V3.1", "ReadCsv函数的使用时间: " + (readCsvEndTime - startTime));
	Log.i("V3.1", "Sort函数的使用时间: " + (sortEndTime - readCsvEndTime));
	Log.i("V3.1", "onCreate函数整体使用时间: " + (endTime - startTime));
}
 
Example 2
Source File: DdmHandleProfiling.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private Chunk handleMPRE(Chunk request) {
    byte result;

    try {
        Debug.stopMethodTracing();
        result = 0;
    } catch (RuntimeException re) {
        Log.w("ddm-heap", "Method profiling end failed: "
            + re.getMessage());
        result = 1;
    }

    /* create a non-empty reply so the handler fires on completion */
    byte[] reply = { result };
    return new Chunk(CHUNK_MPRE, reply, 0, reply.length);
}
 
Example 3
Source File: DdmHandleProfiling.java    From android_9.0.0_r45 with Apache License 2.0 6 votes vote down vote up
private Chunk handleMPSEOrSPSE(Chunk request, String type) {
    if (DEBUG) {
        Log.v("ddm-heap", type + " prof stream end");
    }

    try {
        Debug.stopMethodTracing();
    } catch (RuntimeException re) {
        Log.w("ddm-heap", type + " prof stream end failed: "
            + re.getMessage());
        return createFailChunk(1, re.getMessage());
    }

    /* VM sent the (perhaps very large) response directly */
    return null;
}
 
Example 4
Source File: LockPatternView.java    From trust with Apache License 2.0 5 votes vote down vote up
private void handleActionUp(MotionEvent event) {
    // report pattern detected
    if (!mPattern.isEmpty()) {
        mPatternInProgress = false;
        notifyPatternDetected();
        invalidate();
    }
    if (PROFILE_DRAWING) {
        if (mDrawingProfilingStarted) {
            Debug.stopMethodTracing();
            mDrawingProfilingStarted = false;
        }
    }
}
 
Example 5
Source File: LatinIME.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@Override
public void hideWindow() {
    mKeyboardSwitcher.onHideWindow();

    if (TRACE) Debug.stopMethodTracing();
    if (isShowingOptionDialog()) {
        mOptionsDialog.dismiss();
        mOptionsDialog = null;
    }
    super.hideWindow();
}
 
Example 6
Source File: LatinIME.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
@Override
public void hideWindow() {
    mKeyboardSwitcher.onHideWindow();

    if (TRACE) Debug.stopMethodTracing();
    if (isShowingOptionDialog()) {
        mOptionsDialog.dismiss();
        mOptionsDialog = null;
    }
    super.hideWindow();
}
 
Example 7
Source File: LockPatternView.java    From xmpp with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (!mInputEnabled || !isEnabled()) {
        return false;
    }

    switch(event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            handleActionDown(event);
            return true;
        case MotionEvent.ACTION_UP:
            handleActionUp(event);
            return true;
        case MotionEvent.ACTION_MOVE:
            handleActionMove(event);
            return true;
        case MotionEvent.ACTION_CANCEL:
            if (mPatternInProgress) {
                mPatternInProgress = false;
                resetPattern();
                notifyPatternCleared();
            }
            if (PROFILE_DRAWING) {
                if (mDrawingProfilingStarted) {
                    Debug.stopMethodTracing();
                    mDrawingProfilingStarted = false;
                }
            }
            return true;
    }
    return false;
}
 
Example 8
Source File: MaterialLockView.java    From MaterialPatternllockView with Apache License 2.0 5 votes vote down vote up
private void handleActionUp(MotionEvent event) {
    // report pattern detected
    if (!mPattern.isEmpty()) {
        mPatternInProgress = false;
        cancelLineAnimations();
        notifyPatternDetected();
        invalidate();
    }
    if (PROFILE_DRAWING) {
        if (mDrawingProfilingStarted) {
            Debug.stopMethodTracing();
            mDrawingProfilingStarted = false;
        }
    }
}
 
Example 9
Source File: LockPatternView.java    From xmpp with Apache License 2.0 5 votes vote down vote up
private void handleActionUp(MotionEvent event) {
    // report pattern detected
    if (!mPattern.isEmpty()) {
        mPatternInProgress = false;
        notifyPatternDetected();
        invalidate();
    }
    if (PROFILE_DRAWING) {
        if (mDrawingProfilingStarted) {
            Debug.stopMethodTracing();
            mDrawingProfilingStarted = false;
        }
    }
}
 
Example 10
Source File: PatternView.java    From android-patternview with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onTouchEvent(final MotionEvent event) {
    if (!inputEnabled || !isEnabled()) {
        return false;
    }

    switch (event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            handleActionDown(event);
            return true;
        case MotionEvent.ACTION_UP:
            handleActionUp();
            return true;
        case MotionEvent.ACTION_MOVE:
            handleActionMove(event);
            return true;
        case MotionEvent.ACTION_CANCEL:
        /*
         * Original source check for patternInProgress == true first before
* calling next three lines. But if we do that, there will be
* nothing happened when the user taps at empty area and releases
* the finger. We want the pattern to be reset and the message will
* be updated after the user did that.
*/
            patternInProgress = false;
            resetPattern();
            notifyPatternCleared();

            if (PROFILE_DRAWING) {
                if (drawingProfilingStarted) {
                    Debug.stopMethodTracing();
                    drawingProfilingStarted = false;
                }
            }
            return true;
    }
    return false;
}
 
Example 11
Source File: LockPatternView.java    From Pi-Locker with GNU General Public License v2.0 5 votes vote down vote up
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (!mInputEnabled || !isEnabled()) {
        return false;
    }

    switch (event.getAction()) {
    case MotionEvent.ACTION_DOWN:
        handleActionDown(event);
        return true;
    case MotionEvent.ACTION_UP:
        handleActionUp(event);
        return true;
    case MotionEvent.ACTION_MOVE:
        handleActionMove(event);
        return true;
    case MotionEvent.ACTION_CANCEL:
        /*
         * Original source check for mPatternInProgress == true first before
         * calling next three lines. But if we do that, there will be
         * nothing happened when the user taps at empty area and releases
         * the finger. We want the pattern to be reset and the message will
         * be updated after the user did that.
         */
        mPatternInProgress = false;
        resetPattern();
        notifyPatternCleared();

        if (PROFILE_DRAWING) {
            if (mDrawingProfilingStarted) {
                Debug.stopMethodTracing();
                mDrawingProfilingStarted = false;
            }
        }
        return true;
    }
    return false;
}
 
Example 12
Source File: CommonLiveUI.java    From likequanmintv with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    if (playerHolder!=null){
        playerHolder.release();
        playerHolder=null;
    }
    verticalControll.onDestroy();
    horizontalControll.onDestroy();
    super.onDestroy();

    Debug.stopMethodTracing();


}
 
Example 13
Source File: LockPatternView.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (!mInputEnabled || !isEnabled()) {
        return false;
    }

    switch(event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            handleActionDown(event);
            return true;
        case MotionEvent.ACTION_UP:
            handleActionUp(event);
            return true;
        case MotionEvent.ACTION_MOVE:
            handleActionMove(event);
            return true;
        case MotionEvent.ACTION_CANCEL:
            resetPattern();
            mPatternInProgress = false;
            notifyPatternCleared();
            if (PROFILE_DRAWING) {
                if (mDrawingProfilingStarted) {
                    Debug.stopMethodTracing();
                    mDrawingProfilingStarted = false;
                }
            }
            return true;
    }
    return false;
}
 
Example 14
Source File: LockPatternView.java    From EhViewer with Apache License 2.0 5 votes vote down vote up
private void handleActionUp(MotionEvent event) {
    // report pattern detected
    if (!mPattern.isEmpty()) {
        mPatternInProgress = false;
        cancelLineAnimations();
        notifyPatternDetected();
        invalidate();
    }
    if (PROFILE_DRAWING) {
        if (mDrawingProfilingStarted) {
            Debug.stopMethodTracing();
            mDrawingProfilingStarted = false;
        }
    }
}
 
Example 15
Source File: LockPatternView.java    From GestureLock with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onTouchEvent(MotionEvent event) {
    if (!mInputEnabled || !isEnabled()) {
        return false;
    }

    switch(event.getAction()) {
        case MotionEvent.ACTION_DOWN:
            handleActionDown(event);
            return true;
        case MotionEvent.ACTION_UP:
            handleActionUp(event);
            return true;
        case MotionEvent.ACTION_MOVE:
            handleActionMove(event);
            return true;
        case MotionEvent.ACTION_CANCEL:
            if (mPatternInProgress) {
                mPatternInProgress = false;
                resetPattern();
                notifyPatternCleared();
            }
            if (PROFILE_DRAWING) {
                if (mDrawingProfilingStarted) {
                    Debug.stopMethodTracing();
                    mDrawingProfilingStarted = false;
                }
            }
            return true;
    }
    return false;
}
 
Example 16
Source File: LockPatternView.java    From android-lockpattern with Apache License 2.0 5 votes vote down vote up
private void handleActionUp(MotionEvent event) {
    // report pattern detected
    if (!mPattern.isEmpty()) {
        mPatternInProgress = false;
        cancelLineAnimations();
        notifyPatternDetected();
        invalidate();
    }
    if (PROFILE_DRAWING) {
        if (mDrawingProfilingStarted) {
            Debug.stopMethodTracing();
            mDrawingProfilingStarted = false;
        }
    }
}
 
Example 17
Source File: ActivityThread.java    From AndroidComponentPlugin with Apache License 2.0 5 votes vote down vote up
public void stopProfiling() {
    if (profiling) {
        profiling = false;
        Debug.stopMethodTracing();
        if (profileFd != null) {
            try {
                profileFd.close();
            } catch (IOException e) {
            }
        }
        profileFd = null;
        profileFile = null;
    }
}
 
Example 18
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
/**
 * Stops profiling if isProfiling() returns true.
 */
public void stopProfiling() {
    if (mThread.isProfiling()) {
        Debug.stopMethodTracing();
    }
}
 
Example 19
Source File: Instrumentation.java    From AndroidComponentPlugin with Apache License 2.0 4 votes vote down vote up
/**
 * Stops profiling if isProfiling() returns true.
 */
public void stopProfiling() {
    if (mThread.isProfiling()) {
        Debug.stopMethodTracing();
    }
}
 
Example 20
Source File: Instrumentation.java    From droidel with Apache License 2.0 4 votes vote down vote up
/**
 * Stops profiling if isProfiling() returns true.
 */
public void stopProfiling() {
    if (mThread.isProfiling()) {
        Debug.stopMethodTracing();
    }
}