FileDocCategorySizeDatePackage
ParcelArrayBenchmark.javaAPI DocAndroid 5.1 API3417Thu Mar 12 22:22:12 GMT 2015android.os

ParcelArrayBenchmark

public class ParcelArrayBenchmark extends com.google.caliper.SimpleBenchmark

Fields Summary
private int
mSize
private Parcel
mWriteParcel
private byte[]
mByteArray
private int[]
mIntArray
private long[]
mLongArray
private Parcel
mByteParcel
private Parcel
mIntParcel
private Parcel
mLongParcel
Constructors Summary
Methods Summary
protected voidsetUp()

        mWriteParcel = Parcel.obtain();

        mByteArray = new byte[mSize];
        mIntArray = new int[mSize];
        mLongArray = new long[mSize];

        mByteParcel = Parcel.obtain();
        mByteParcel.writeByteArray(mByteArray);
        mIntParcel = Parcel.obtain();
        mIntParcel.writeIntArray(mIntArray);
        mLongParcel = Parcel.obtain();
        mLongParcel.writeLongArray(mLongArray);
    
protected voidtearDown()

        mWriteParcel.recycle();
        mWriteParcel = null;
    
public voidtimeCreateByteArray(int reps)

        for (int i = 0; i < reps; i++) {
            mByteParcel.setDataPosition(0);
            mByteParcel.createByteArray();
        }
    
public voidtimeCreateIntArray(int reps)

        for (int i = 0; i < reps; i++) {
            mIntParcel.setDataPosition(0);
            mIntParcel.createIntArray();
        }
    
public voidtimeCreateLongArray(int reps)

        for (int i = 0; i < reps; i++) {
            mLongParcel.setDataPosition(0);
            mLongParcel.createLongArray();
        }
    
public voidtimeReadByteArray(int reps)

        for (int i = 0; i < reps; i++) {
            mByteParcel.setDataPosition(0);
            mByteParcel.readByteArray(mByteArray);
        }
    
public voidtimeReadIntArray(int reps)

        for (int i = 0; i < reps; i++) {
            mIntParcel.setDataPosition(0);
            mIntParcel.readIntArray(mIntArray);
        }
    
public voidtimeReadLongArray(int reps)

        for (int i = 0; i < reps; i++) {
            mLongParcel.setDataPosition(0);
            mLongParcel.readLongArray(mLongArray);
        }
    
public voidtimeWriteByteArray(int reps)

        for (int i = 0; i < reps; i++) {
            mWriteParcel.setDataPosition(0);
            mWriteParcel.writeByteArray(mByteArray);
        }
    
public voidtimeWriteIntArray(int reps)

        for (int i = 0; i < reps; i++) {
            mWriteParcel.setDataPosition(0);
            mWriteParcel.writeIntArray(mIntArray);
        }
    
public voidtimeWriteLongArray(int reps)

        for (int i = 0; i < reps; i++) {
            mWriteParcel.setDataPosition(0);
            mWriteParcel.writeLongArray(mLongArray);
        }