FileDocCategorySizeDatePackage
ParcelBenchmark.javaAPI DocAndroid 5.1 API1974Thu Mar 12 22:22:12 GMT 2015android.os

ParcelBenchmark

public class ParcelBenchmark extends com.google.caliper.SimpleBenchmark

Fields Summary
private Parcel
mParcel
Constructors Summary
Methods Summary
protected voidsetUp()

        mParcel = Parcel.obtain();
    
protected voidtearDown()

        mParcel.recycle();
        mParcel = null;
    
public voidtimeReadByte(int reps)

        mParcel.setDataCapacity(reps);
        for (int i = 0; i < reps; i++) {
            mParcel.readByte();
        }
    
public voidtimeReadInt(int reps)

        mParcel.setDataCapacity(reps << 2);
        for (int i = 0; i < reps; i++) {
            mParcel.readInt();
        }
    
public voidtimeReadLong(int reps)

        mParcel.setDataCapacity(reps << 3);
        for (int i = 0; i < reps; i++) {
            mParcel.readLong();
        }
    
public voidtimeWriteByte(int reps)

        final byte val = 0xF;
        for (int i = 0; i < reps; i++) {
            mParcel.writeByte(val);
        }
    
public voidtimeWriteInt(int reps)

        final int val = 0xF;
        for (int i = 0; i < reps; i++) {
            mParcel.writeInt(val);
        }
    
public voidtimeWriteLong(int reps)

        final long val = 0xF;
        for (int i = 0; i < reps; i++) {
            mParcel.writeLong(val);
        }