Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android System Trace [trace markers]

I'm trying to make RecyclerView scroll smoothly. Starting with analyzing traces from Android Device Monitor > DDMS > Android Systrace I thought that adding custom sections could be helpful. Here, you can find example I use to accomplish this. Could someone please point me where can find section logs I added? Thanks.

@Override
public CalendarMatchViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    //        calendar_match_item  calendar_match_item
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        Trace.beginSection("onCreateViewHolder");
    }
    View view = mInflater.inflate(R.layout.calendar_match_item, parent, false);
    CalendarMatchViewHolder vh = new CalendarMatchViewHolder(view);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        Trace.endSection();
    }
    return vh;
}

@Override
public void onBindViewHolder(CalendarMatchViewHolder holder, int position) {
    Match match = mMatches.get(position);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        Trace.beginSection("onBindViewHolder");
    }
    setOtherMatchesBasicData(match, holder);
    setOfferLayout(match, holder);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        Trace.endSection();
    }
}
like image 629
Rade Avatar asked Jul 27 '17 16:07

Rade


1 Answers

You can do this by selecting package name in Systrace window from drop down menu "Enter Application Traces From".

You can find more about Systrace and how to use it on this link: https://developer.android.com/studio/profile/systrace.html

Systrace window

like image 171
Ivan Panic Avatar answered Oct 18 '22 03:10

Ivan Panic