FileDocCategorySizeDatePackage
WindowContentFrameStats.javaAPI DocAndroid 5.1 API6055Thu Mar 12 22:22:10 GMT 2015android.view

WindowContentFrameStats

public final class WindowContentFrameStats extends FrameStats implements android.os.Parcelable
This class contains window content frame statistics. For example, a window content is rendred in frames when a view is scrolled. The frame statistics are a snapshot for the time interval from {@link #getStartTimeNano()} to {@link #getEndTimeNano()}.

The key idea is that in order to provide a smooth user experience an application has to draw a frame at a specific time interval obtained by calling {@link #getRefreshPeriodNano()}. If the application does not render a frame every refresh period the user will see irregular UI transitions.

An application posts a frame for presentation by synchronously rendering its contents in a buffer which is then posted or posting a buffer to which the application is asychronously rendering the content via GL. After the frame is posted and rendered (potentially asynchronosly) it is presented to the user. The time a frame was posted can be obtained via {@link #getFramePostedTimeNano(int)}, the time a frame content was rendered and ready for dsiplay (GL case) via {@link #getFrameReadyTimeNano(int)}, and the time a frame was presented on the screen via {@link #getFramePresentedTimeNano(int)}.

Fields Summary
private long[]
mFramesPostedTimeNano
private long[]
mFramesReadyTimeNano
public static final Parcelable.Creator
CREATOR
Constructors Summary
public WindowContentFrameStats()

hide

        /* do nothing */
    
private WindowContentFrameStats(android.os.Parcel parcel)

        mRefreshPeriodNano = parcel.readLong();
        mFramesPostedTimeNano = parcel.createLongArray();
        mFramesPresentedTimeNano = parcel.createLongArray();
        mFramesReadyTimeNano = parcel.createLongArray();
    
Methods Summary
public intdescribeContents()

        return 0;
    
public longgetFramePostedTimeNano(int index)
Get the time a frame at a given index was posted by the producer (e.g. the application). It is either explicitly set or defaulted to the time when the render buffer was posted.

Note: A frame can be posted and still it contents being rendered asynchronously in GL. To get the time the frame content was completely rendered and ready to display call {@link #getFrameReadyTimeNano(int)}.

param
index The frame index.
return
The posted time in nanoseconds.

        if (mFramesPostedTimeNano == null) {
            throw new IndexOutOfBoundsException();
        }
        return mFramesPostedTimeNano[index];
    
public longgetFrameReadyTimeNano(int index)
Get the time a frame at a given index was ready for presentation.

Note: A frame can be posted and still it contents being rendered asynchronously in GL. In such a case this is the time when the frame contents were completely rendered.

param
index The frame index.
return
The ready time in nanoseconds or {@link #UNDEFINED_TIME_NANO} if the frame is not ready yet.

        if (mFramesReadyTimeNano == null) {
            throw new IndexOutOfBoundsException();
        }
        return mFramesReadyTimeNano[index];
    
public voidinit(long refreshPeriodNano, long[] framesPostedTimeNano, long[] framesPresentedTimeNano, long[] framesReadyTimeNano)
Initializes this isntance.

param
refreshPeriodNano The display refresh period.
param
framesPostedTimeNano The times in milliseconds for when the frame contents were posted.
param
framesPresentedTimeNano The times in milliseconds for when the frame contents were presented.
param
framesReadyTimeNano The times in milliseconds for when the frame contents were ready to be presented.
hide

        mRefreshPeriodNano = refreshPeriodNano;
        mFramesPostedTimeNano = framesPostedTimeNano;
        mFramesPresentedTimeNano = framesPresentedTimeNano;
        mFramesReadyTimeNano = framesReadyTimeNano;
    
public java.lang.StringtoString()

        StringBuilder builder = new StringBuilder();
        builder.append("WindowContentFrameStats[");
        builder.append("frameCount:" + getFrameCount());
        builder.append(", fromTimeNano:" + getStartTimeNano());
        builder.append(", toTimeNano:" + getEndTimeNano());
        builder.append(']");
        return builder.toString();
    
public voidwriteToParcel(android.os.Parcel parcel, int flags)

        parcel.writeLong(mRefreshPeriodNano);
        parcel.writeLongArray(mFramesPostedTimeNano);
        parcel.writeLongArray(mFramesPresentedTimeNano);
        parcel.writeLongArray(mFramesReadyTimeNano);