Initial pass at storage benchmarks.
After adopting a disk, run benchmarks to compare its performance against internal storage. Bug: 21172095 Change-Id: I7c9a5a89e37f7156677fc76bd1ba193eead6665e
This commit is contained in:
@@ -55,12 +55,23 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
|
|||||||
new PartitionTask().execute();
|
new PartitionTask().execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public class PartitionTask extends AsyncTask<Void, Void, Exception> {
|
public class PartitionTask extends AsyncTask<Void, Integer, Exception> {
|
||||||
@Override
|
@Override
|
||||||
protected Exception doInBackground(Void... params) {
|
protected Exception doInBackground(Void... params) {
|
||||||
try {
|
try {
|
||||||
if (mFormatPrivate) {
|
if (mFormatPrivate) {
|
||||||
mStorage.partitionPrivate(mDisk.getId());
|
mStorage.partitionPrivate(mDisk.getId());
|
||||||
|
publishProgress(40);
|
||||||
|
|
||||||
|
final long internalBench = mStorage.benchmark(null);
|
||||||
|
publishProgress(60);
|
||||||
|
|
||||||
|
final VolumeInfo privateVol = findFirstVolume(VolumeInfo.TYPE_PRIVATE);
|
||||||
|
final long privateBench = mStorage.benchmark(privateVol.id);
|
||||||
|
|
||||||
|
// TODO: plumb through to user when below threshold
|
||||||
|
final float pct = (float) internalBench / (float) privateBench;
|
||||||
|
Log.d(TAG, "New volume is " + pct + "x the speed of internal");
|
||||||
} else {
|
} else {
|
||||||
mStorage.partitionPublic(mDisk.getId());
|
mStorage.partitionPublic(mDisk.getId());
|
||||||
}
|
}
|
||||||
@@ -70,6 +81,11 @@ public class StorageWizardFormatProgress extends StorageWizardBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onProgressUpdate(Integer... progress) {
|
||||||
|
setCurrentProgress(progress[0]);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Exception e) {
|
protected void onPostExecute(Exception e) {
|
||||||
final Context context = StorageWizardFormatProgress.this;
|
final Context context = StorageWizardFormatProgress.this;
|
||||||
|
Reference in New Issue
Block a user