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

The following examples show how to use android.os.Debug#startMethodTracing() . 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: PLA_AbsListView.java    From EverMemo with MIT License 6 votes vote down vote up
void start(int initialVelocity) {
	initialVelocity = modifyFlingInitialVelocity(initialVelocity);

	int initialY = initialVelocity < 0 ? Integer.MAX_VALUE : 0;
	mLastFlingY = initialY;
	mScroller.fling(0, initialY, 0, initialVelocity,
			0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);

	if(DEBUG)
		Log.d(TAG, String.format("String Fling: [%d, %d] to [%d]", initialY, initialVelocity, mScroller.getFinalY()));

	mTouchMode = TOUCH_MODE_FLING;
	post(this);

	if (PROFILE_FLINGING) {
		if (!mFlingProfilingStarted) {
			Debug.startMethodTracing("AbsListViewFling");
			mFlingProfilingStarted = true;
		}
	}
}
 
Example 2
Source File: ActivityThread.java    From AndroidComponentPlugin with Apache License 2.0 6 votes vote down vote up
public void startProfiling() {
    if (profileFd == null || profiling) {
        return;
    }
    try {
        Debug.startMethodTracing(profileFile, profileFd.getFileDescriptor(),
                8 * 1024 * 1024, 0);
        profiling = true;
    } catch (RuntimeException e) {
        Slog.w(TAG, "Profiling failed on path " + profileFile);
        try {
            profileFd.close();
            profileFd = null;
        } catch (IOException e2) {
            Slog.w(TAG, "Failure closing profile fd", e2);
        }
    }
}
 
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 handleMPRS(Chunk request) {
    ByteBuffer in = wrapChunk(request);

    int bufferSize = in.getInt();
    int flags = in.getInt();
    int len = in.getInt();
    String fileName = getString(in, len);
    if (DEBUG)
        Log.v("ddm-heap", "Method profiling start: filename='" + fileName
            + "', size=" + bufferSize + ", flags=" + flags);

    try {
        Debug.startMethodTracing(fileName, bufferSize, flags);
        return null;        // empty response
    } catch (RuntimeException re) {
        return createFailChunk(1, re.getMessage());
    }
}
 
Example 4
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();

	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("V1", "ReadCsv函数的使用时间: " + (readCsvEndTime - startTime));
	Log.i("V1", "Sort函数的使用时间: " + (sortEndTime - readCsvEndTime));
	Log.i("V1", "onCreate函数整体使用时间: " + (endTime - startTime));
}
 
Example 5
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();

	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("V2", "ReadCsv函数的使用时间: " + (readCsvEndTime - startTime));
	Log.i("V2", "Sort函数的使用时间: " + (sortEndTime - readCsvEndTime));
	Log.i("V2", "onCreate函数整体使用时间: " + (endTime - startTime));
}
 
Example 6
Source File: PLAAbsListView.java    From SimplifyReader with Apache License 2.0 6 votes vote down vote up
void start(int initialVelocity) {
    initialVelocity = modifyFlingInitialVelocity(initialVelocity);

    int initialY = initialVelocity < 0 ? Integer.MAX_VALUE : 0;
    mLastFlingY = initialY;
    mScroller.fling(0, initialY, 0, initialVelocity,
            0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);

    mTouchMode = TOUCH_MODE_FLING;
    post(this);

    if (PROFILE_FLINGING) {
        if (!mFlingProfilingStarted) {
            Debug.startMethodTracing("AbsListViewFling");
            mFlingProfilingStarted = true;
        }
    }
}
 
Example 7
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();

	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", "ReadCsv函数的使用时间: " + (readCsvEndTime - startTime));
	Log.i("V3", "Sort函数的使用时间: " + (sortEndTime - readCsvEndTime));
	Log.i("V3", "onCreate函数整体使用时间: " + (endTime - startTime));
}
 
Example 8
Source File: L.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
public static void startTracing(String name) {
    if (!debug)
        return;
    if (!TextUtils.isEmpty(name))
        Debug.startMethodTracing(name);
    tracingName = name;
    tracingStartTime = System.currentTimeMillis();
}
 
Example 9
Source File: L.java    From 920-text-editor-v2 with Apache License 2.0 5 votes vote down vote up
public static void startTracing(String name) {
    if (!debug)
        return;
    if (!TextUtils.isEmpty(name))
        Debug.startMethodTracing(name);
    tracingName = name;
    tracingStartTime = System.currentTimeMillis();
}
 
Example 10
Source File: LockPatternView.java    From xmpp with Apache License 2.0 5 votes vote down vote up
private void handleActionDown(MotionEvent event) {
    resetPattern();
    final float x = event.getX();
    final float y = event.getY();
    final Cell hitCell = detectAndAddHit(x, y);
    if (hitCell != null) {
        mPatternInProgress = true;
        mPatternDisplayMode = DisplayMode.Correct;
        notifyPatternStarted();
    } else if (mPatternInProgress) {
        mPatternInProgress = false;
        notifyPatternCleared();
    }
    if (hitCell != null) {
        final float startX = getCenterXForColumn(hitCell.column);
        final float startY = getCenterYForRow(hitCell.row);

        final float widthOffset = mSquareWidth / 2f;
        final float heightOffset = mSquareHeight / 2f;

        invalidate((int) (startX - widthOffset), (int) (startY - heightOffset),
                (int) (startX + widthOffset), (int) (startY + heightOffset));
    }
    mInProgressX = x;
    mInProgressY = y;
    if (PROFILE_DRAWING) {
        if (!mDrawingProfilingStarted) {
            Debug.startMethodTracing("LockPatternDrawing");
            mDrawingProfilingStarted = true;
        }
    }
}
 
Example 11
Source File: LockPatternView.java    From android-lockpattern with Apache License 2.0 5 votes vote down vote up
private void handleActionDown(MotionEvent event) {
    resetPattern();
    final float x = event.getX();
    final float y = event.getY();
    final Cell hitCell = detectAndAddHit(x, y);
    if (hitCell != null) {
        mPatternInProgress = true;
        mPatternDisplayMode = DisplayMode.Correct;
        notifyPatternStarted();
    } else {
        /*
         * Original source check for mPatternInProgress == true first before
         * calling this block. 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;
        notifyPatternCleared();
    }
    if (hitCell != null) {
        final float startX = getCenterXForColumn(hitCell.column);
        final float startY = getCenterYForRow(hitCell.row);

        final float widthOffset = mSquareWidth / 2f;
        final float heightOffset = mSquareHeight / 2f;

        invalidate((int) (startX - widthOffset),
                (int) (startY - heightOffset),
                (int) (startX + widthOffset), (int) (startY + heightOffset));
    }
    mInProgressX = x;
    mInProgressY = y;
    if (PROFILE_DRAWING) {
        if (!mDrawingProfilingStarted) {
            Debug.startMethodTracing("LockPatternDrawing");
            mDrawingProfilingStarted = true;
        }
    }
}
 
Example 12
Source File: LockPatternView.java    From Huochexing12306 with Apache License 2.0 5 votes vote down vote up
private void handleActionDown(MotionEvent event) {
    resetPattern();
    final float x = event.getX();
    final float y = event.getY();
    final Cell hitCell = detectAndAddHit(x, y);
    if (hitCell != null) {
        mPatternInProgress = true;
        mPatternDisplayMode = DisplayMode.Correct;
        notifyPatternStarted();
    } else {
        mPatternInProgress = false;
        notifyPatternCleared();
    }
    if (hitCell != null) {
        final float startX = getCenterXForColumn(hitCell.column);
        final float startY = getCenterYForRow(hitCell.row);

        final float widthOffset = mSquareWidth / 2f;
        final float heightOffset = mSquareHeight / 2f;

        invalidate((int) (startX - widthOffset), (int) (startY - heightOffset),
                (int) (startX + widthOffset), (int) (startY + heightOffset));
    }
    mInProgressX = x;
    mInProgressY = y;
    if (PROFILE_DRAWING) {
        if (!mDrawingProfilingStarted) {
            Debug.startMethodTracing("LockPatternDrawing");
            mDrawingProfilingStarted = true;
        }
    }
}
 
Example 13
Source File: PatternLockView.java    From PatternLockView with Apache License 2.0 5 votes vote down vote up
private void handleActionDown(MotionEvent event) {
    resetPattern();
    float x = event.getX();
    float y = event.getY();
    Dot hitDot = detectAndAddHit(x, y);
    if (hitDot != null) {
        mPatternInProgress = true;
        mPatternViewMode = CORRECT;
        notifyPatternStarted();
    } else {
        mPatternInProgress = false;
        notifyPatternCleared();
    }
    if (hitDot != null) {
        float startX = getCenterXForColumn(hitDot.mColumn);
        float startY = getCenterYForRow(hitDot.mRow);

        float widthOffset = mViewWidth / 2f;
        float heightOffset = mViewHeight / 2f;

        invalidate((int) (startX - widthOffset),
                (int) (startY - heightOffset),
                (int) (startX + widthOffset), (int) (startY + heightOffset));
    }
    mInProgressX = x;
    mInProgressY = y;
    if (PROFILE_DRAWING) {
        if (!mDrawingProfilingStarted) {
            Debug.startMethodTracing("PatternLockDrawing");
            mDrawingProfilingStarted = true;
        }
    }
}
 
Example 14
Source File: LockPatternViewEx.java    From android-lockpattern with Apache License 2.0 5 votes vote down vote up
private void handleActionDown(MotionEvent event) {
    resetPattern();
    final float x = event.getX();
    final float y = event.getY();
    final Cell hitCell = detectAndAddHit(x, y);
    if (hitCell != null) {
        mPatternInProgress = true;
        mPatternDisplayMode = DisplayMode.Correct;
        notifyPatternStarted();
    } else if (mPatternInProgress) {
        mPatternInProgress = false;
        notifyPatternCleared();
    }
    if (hitCell != null) {
        final float startX = getCenterXForColumn(hitCell.column);
        final float startY = getCenterYForRow(hitCell.row);

        final float widthOffset = mSquareWidth / 2f;
        final float heightOffset = mSquareHeight / 2f;

        invalidate((int) (startX - widthOffset),
                (int) (startY - heightOffset),
                (int) (startX + widthOffset), (int) (startY + heightOffset));
    }
    mInProgressX = x;
    mInProgressY = y;
    if (PROFILE_DRAWING) {
        if (!mDrawingProfilingStarted) {
            Debug.startMethodTracing("LockPatternDrawing");
            mDrawingProfilingStarted = true;
        }
    }
}
 
Example 15
Source File: LockPatternView.java    From GestureLock with Apache License 2.0 5 votes vote down vote up
private void handleActionDown(MotionEvent event) {
    resetPattern();
    final float x = event.getX();
    final float y = event.getY();
    final Cell hitCell = detectAndAddHit(x, y);
    if (hitCell != null) {
        mPatternInProgress = true;
        mPatternDisplayMode = DisplayMode.Correct;
        notifyPatternStarted();
    } else if (mPatternInProgress) {
        mPatternInProgress = false;
        notifyPatternCleared();
    }
    if (hitCell != null) {
        final float startX = getCenterXForColumn(hitCell.column);
        final float startY = getCenterYForRow(hitCell.row);

        final float widthOffset = mSquareWidth / 2f;
        final float heightOffset = mSquareHeight / 2f;

        invalidate((int) (startX - widthOffset), (int) (startY - heightOffset),
                (int) (startX + widthOffset), (int) (startY + heightOffset));
    }
    mInProgressX = x;
    mInProgressY = y;
    if (PROFILE_DRAWING) {
        if (!mDrawingProfilingStarted) {
            Debug.startMethodTracing("LockPatternDrawing");
            mDrawingProfilingStarted = true;
        }
    }
}
 
Example 16
Source File: TwoWayAbsListView.java    From recent-images with MIT License 5 votes vote down vote up
@Override
void start(int initialVelocity) {
	int initialX = initialVelocity < 0 ? Integer.MAX_VALUE : 0;
	mLastFlingX = initialX;
	mScroller.fling(initialX, 0, initialVelocity, 0,
			0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);
	mTouchMode = TOUCH_MODE_FLING;
	post(this);

	if (PROFILE_FLINGING && !mFlingProfilingStarted) {
		Debug.startMethodTracing("AbsListViewFling");
		mFlingProfilingStarted = true;
	}
}
 
Example 17
Source File: TwoWayAbsListView.java    From recent-images with MIT License 5 votes vote down vote up
@Override
void start(int initialVelocity) {
	int initialY = initialVelocity < 0 ? Integer.MAX_VALUE : 0;
	mLastFlingY = initialY;
	mScroller.fling(0, initialY, 0, initialVelocity,
			0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE);
	mTouchMode = TOUCH_MODE_FLING;
	post(this);

	if (PROFILE_FLINGING && !mFlingProfilingStarted) {
		Debug.startMethodTracing("AbsListViewFling");
		mFlingProfilingStarted = true;
	}
}
 
Example 18
Source File: LogUtils.java    From FilePicker with MIT License 4 votes vote down vote up
/**
 * 在某个方法中调用生成.trace文件。然后拿到电脑上用DDMS工具打开分析
 *
 * @see #stopMethodTracing()
 */
public static void startMethodTracing() {
    if (isDebug) {
        Debug.startMethodTracing(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + debugTag + ".trace");
    }
}
 
Example 19
Source File: LogUtils.java    From AndroidPicker with MIT License 4 votes vote down vote up
/**
 * 在某个方法中调用生成.trace文件。然后拿到电脑上用DDMS工具打开分析
 *
 * @see #stopMethodTracing()
 */
public static void startMethodTracing() {
    if (isDebug) {
        Debug.startMethodTracing(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + debugTag + ".trace");
    }
}
 
Example 20
Source File: CommonLiveUI.java    From likequanmintv with Apache License 2.0 4 votes vote down vote up
public CommonLiveUI(){
    Debug.startMethodTracing("CommonLiveUI");
}