Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2089)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java

Issue 2933173003: Photo Picker dialog: Add UMA for file enumeration. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
index ae8b5e32f1d120829919c39b3b0c39ef6cad0ece..4c2bce8264e5326d57f339ce62bb88c6b2ba7d6a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/photo_picker/PickerCategoryView.java
@@ -9,6 +9,7 @@ import android.content.DialogInterface;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.graphics.Rect;
+import android.os.SystemClock;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.LruCache;
@@ -29,6 +30,7 @@ import org.chromium.ui.PhotoPickerListener;
import java.util.ArrayList;
import java.util.List;
+import java.util.concurrent.TimeUnit;
/**
* A class for keeping track of common data associated with showing photos in
@@ -111,6 +113,9 @@ public class PickerCategoryView extends RelativeLayout
// A worker task for asynchronously enumerating files off the main thread.
private FileEnumWorkerTask mWorkerTask;
+ // The timestap for the start of the enumeration of files on disk.
+ private long mEnumStartTime;
+
// Whether the connection to the service has been established.
private boolean mServiceReady;
@@ -214,6 +219,15 @@ public class PickerCategoryView extends RelativeLayout
@Override
public void filesEnumeratedCallback(List<PickerBitmap> files) {
+ // Calculate the rate of files enumerated per tenth of a second.
+ long elapsedTimeMs = SystemClock.elapsedRealtime() - mEnumStartTime;
+ int rate = (int) (100 * files.size() / elapsedTimeMs);
Theresa 2017/06/13 15:11:36 nit: Add a comment here that enumerated rate is pe
Finnur 2017/06/13 15:53:04 Should I move the comment on line 222 down one lin
Theresa 2017/06/13 16:06:03 Oh.. No. The comment you have is fine. Sorry.
+ RecordHistogram.recordTimesHistogram(
+ "Android.PhotoPicker.EnumerationTime", elapsedTimeMs, TimeUnit.MILLISECONDS);
+ RecordHistogram.recordCustomCountHistogram(
+ "Android.PhotoPicker.EnumeratedFiles", files.size(), 1, 10000, 50);
+ RecordHistogram.recordCount1000Histogram("Android.PhotoPicker.EnumeratedRate", rate);
+
mPickerBitmaps = files;
processBitmaps();
}
@@ -349,6 +363,7 @@ public class PickerCategoryView extends RelativeLayout
mWorkerTask.cancel(true);
}
+ mEnumStartTime = SystemClock.elapsedRealtime();
mWorkerTask = new FileEnumWorkerTask(this, new MimeTypeFileFilter(mMimeTypes));
mWorkerTask.execute();
}
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698