Java Code Examples for org.chromium.base.metrics.RecordHistogram#recordLongTimesHistogram()

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordLongTimesHistogram() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RecentTabsPage.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Updates whether the page is in the foreground based on whether the application is in the
 * foreground and whether {@link #mView} is attached to the application window. If the page is
 * no longer in the foreground, records the time that the page spent in the foreground to UMA.
 */
private void updateForegroundState() {
    boolean inForeground = mIsAttachedToWindow
            && ApplicationStatus.getStateForActivity(mActivity) == ActivityState.RESUMED;
    if (mInForeground == inForeground) {
        return;
    }

    mInForeground = inForeground;
    if (mInForeground) {
        mForegroundTimeMs = SystemClock.elapsedRealtime();
        StartupMetrics.getInstance().recordOpenedRecents();
    } else {
        RecordHistogram.recordLongTimesHistogram("NewTabPage.RecentTabsPage.TimeVisibleAndroid",
                SystemClock.elapsedRealtime() - mForegroundTimeMs, TimeUnit.MILLISECONDS);
    }
}
 
Example 2
Source File: RecentTabsPage.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Updates whether the page is in the foreground based on whether the application is in the
 * foreground and whether {@link #mView} is attached to the application window. If the page is
 * no longer in the foreground, records the time that the page spent in the foreground to UMA.
 */
private void updateForegroundState() {
    boolean inForeground = mIsAttachedToWindow
            && ApplicationStatus.getStateForActivity(mActivity) == ActivityState.RESUMED;
    if (mInForeground == inForeground) {
        return;
    }

    mInForeground = inForeground;
    if (mInForeground) {
        mForegroundTimeMs = SystemClock.elapsedRealtime();
        StartupMetrics.getInstance().recordOpenedRecents();
    } else {
        RecordHistogram.recordLongTimesHistogram("NewTabPage.RecentTabsPage.TimeVisibleAndroid",
                SystemClock.elapsedRealtime() - mForegroundTimeMs, TimeUnit.MILLISECONDS);
    }
}
 
Example 3
Source File: ChromeActivity.java    From delion with Apache License 2.0 6 votes vote down vote up
protected final void postDeferredStartupIfNeeded() {
    if (!mDeferredStartupNotified) {
        RecordHistogram.recordLongTimesHistogram(
                "UMA.Debug.EnableCrashUpload.PostDeferredStartUptime",
                SystemClock.uptimeMillis() - UmaUtils.getMainEntryPointTime(),
                TimeUnit.MILLISECONDS);

        // We want to perform deferred startup tasks a short time after the first page
        // load completes, but only when the main thread Looper has become idle.
        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                if (!mDeferredStartupNotified && !isActivityDestroyed()) {
                    mDeferredStartupNotified = true;
                    Looper.myQueue().addIdleHandler(new MessageQueue.IdleHandler() {
                        @Override
                        public boolean queueIdle() {
                            onDeferredStartup();
                            return false;  // Remove this idle handler.
                        }
                    });
                }
            }
        }, DEFERRED_STARTUP_DELAY_MS);
    }
}
 
Example 4
Source File: ChromeActivity.java    From 365browser with Apache License 2.0 6 votes vote down vote up
protected final void postDeferredStartupIfNeeded() {
    if (!mNativeInitialized) {
        // Native hasn't loaded yet.  Queue it up for later.
        mDeferredStartupQueued = true;
        return;
    }
    mDeferredStartupQueued = false;

    if (!mDeferredStartupPosted) {
        mDeferredStartupPosted = true;
        RecordHistogram.recordLongTimesHistogram(
                "UMA.Debug.EnableCrashUpload.PostDeferredStartUptime2",
                SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
                TimeUnit.MILLISECONDS);
        onDeferredStartup();
    }
}
 
Example 5
Source File: RecentTabsPage.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Updates whether the page is in the foreground based on whether the application is in the
 * foreground and whether {@link #mView} is attached to the application window. If the page is
 * no longer in the foreground, records the time that the page spent in the foreground to UMA.
 */
private void updateForegroundState() {
    boolean inForeground = mIsAttachedToWindow
            && ApplicationStatus.getStateForActivity(mActivity) == ActivityState.RESUMED;
    if (mInForeground == inForeground) {
        return;
    }

    mInForeground = inForeground;
    if (mInForeground) {
        mForegroundTimeMs = SystemClock.elapsedRealtime();
        StartupMetrics.getInstance().recordOpenedRecents();
    } else {
        RecordHistogram.recordLongTimesHistogram("NewTabPage.RecentTabsPage.TimeVisibleAndroid",
                SystemClock.elapsedRealtime() - mForegroundTimeMs, TimeUnit.MILLISECONDS);
    }
}
 
Example 6
Source File: OfflinePageUtils.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Records UMA data when the Offline Pages Background Load service awakens.
 * @param context android context
 */
public static void recordWakeupUMA(Context context, long taskScheduledTimeMillis) {
    DeviceConditions deviceConditions = getDeviceConditions(context);
    if (deviceConditions == null) return;

    // Report charging state.
    RecordHistogram.recordBooleanHistogram(
            "OfflinePages.Wakeup.ConnectedToPower", deviceConditions.isPowerConnected());

    // Report battery percentage.
    RecordHistogram.recordPercentageHistogram(
            "OfflinePages.Wakeup.BatteryPercentage", deviceConditions.getBatteryPercentage());

    // Report the default network found (or none, if we aren't connected).
    int connectionType = deviceConditions.getNetConnectionType();
    Log.d(TAG, "Found default network of type " + connectionType);
    RecordHistogram.recordEnumeratedHistogram("OfflinePages.Wakeup.NetworkAvailable",
            connectionType, ConnectionType.CONNECTION_LAST + 1);

    // Collect UMA on the time since the request started.
    long nowMillis = System.currentTimeMillis();
    long delayInMilliseconds = nowMillis - taskScheduledTimeMillis;
    if (delayInMilliseconds <= 0) {
        return;
    }
    RecordHistogram.recordLongTimesHistogram(
            "OfflinePages.Wakeup.DelayTime",
            delayInMilliseconds,
            TimeUnit.MILLISECONDS);
}
 
Example 7
Source File: DeferredStartupHandler.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void recordDeferredStartupStats() {
    RecordHistogram.recordLongTimesHistogram(
            "UMA.Debug.EnableCrashUpload.DeferredStartUpDuration", mDeferredStartupDuration,
            TimeUnit.MILLISECONDS);
    RecordHistogram.recordLongTimesHistogram(
            "UMA.Debug.EnableCrashUpload.DeferredStartUpMaxTaskDuration", mMaxTaskDuration,
            TimeUnit.MILLISECONDS);
    RecordHistogram.recordLongTimesHistogram(
            "UMA.Debug.EnableCrashUpload.DeferredStartUpCompleteTime",
            SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
            TimeUnit.MILLISECONDS);
}
 
Example 8
Source File: OfflinePageUtils.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Records UMA data when the Offline Pages Background Load service awakens.
 * @param context android context
 */
public static void recordWakeupUMA(Context context, long taskScheduledTimeMillis) {
    DeviceConditions deviceConditions = DeviceConditions.getCurrentConditions(context);
    if (deviceConditions == null) return;

    // Report charging state.
    RecordHistogram.recordBooleanHistogram(
            "OfflinePages.Wakeup.ConnectedToPower", deviceConditions.isPowerConnected());

    // Report battery percentage.
    RecordHistogram.recordPercentageHistogram(
            "OfflinePages.Wakeup.BatteryPercentage", deviceConditions.getBatteryPercentage());

    // Report the default network found (or none, if we aren't connected).
    int connectionType = deviceConditions.getNetConnectionType();
    Log.d(TAG, "Found default network of type " + connectionType);
    RecordHistogram.recordEnumeratedHistogram("OfflinePages.Wakeup.NetworkAvailable",
            connectionType, ConnectionType.CONNECTION_LAST + 1);

    // Collect UMA on the time since the request started.
    long nowMillis = System.currentTimeMillis();
    long delayInMilliseconds = nowMillis - taskScheduledTimeMillis;
    if (delayInMilliseconds <= 0) {
        return;
    }
    RecordHistogram.recordLongTimesHistogram(
            "OfflinePages.Wakeup.DelayTime",
            delayInMilliseconds,
            TimeUnit.MILLISECONDS);
}
 
Example 9
Source File: ProcessInitializationHandler.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Handle application level deferred startup tasks that can be lazily done after all
 * the necessary initialization has been completed. Should only be triggered once per browser
 * process lifetime. Any calls requiring network access should probably go here.
 *
 * Keep these tasks short and break up long tasks into multiple smaller tasks, as they run on
 * the UI thread and are blocking. Remember to follow RAIL guidelines, as much as possible, and
 * that most devices are quite slow, so leave enough buffer.
 */
public final void initializeDeferredStartupTasks() {
    ThreadUtils.checkUiThread();
    if (mInitializedDeferredStartupTasks) return;
    mInitializedDeferredStartupTasks = true;

    RecordHistogram.recordLongTimesHistogram("UMA.Debug.EnableCrashUpload.DeferredStartUptime2",
            SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
            TimeUnit.MILLISECONDS);

    handleDeferredStartupTasksInitialization();
}
 
Example 10
Source File: ChromeActivity.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
protected final void postDeferredStartupIfNeeded() {
    if (!mDeferredStartupPosted) {
        mDeferredStartupPosted = true;
        RecordHistogram.recordLongTimesHistogram(
                "UMA.Debug.EnableCrashUpload.PostDeferredStartUptime2",
                SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
                TimeUnit.MILLISECONDS);
        onDeferredStartup();
    }
}
 
Example 11
Source File: DeferredStartupHandler.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void recordDeferredStartupStats() {
    RecordHistogram.recordLongTimesHistogram(
            "UMA.Debug.EnableCrashUpload.DeferredStartUpDuration",
            mDeferredStartupDuration,
            TimeUnit.MILLISECONDS);
    RecordHistogram.recordLongTimesHistogram(
            "UMA.Debug.EnableCrashUpload.DeferredStartUpMaxTaskDuration",
            mMaxTaskDuration,
            TimeUnit.MILLISECONDS);
    RecordHistogram.recordLongTimesHistogram(
            "UMA.Debug.EnableCrashUpload.DeferredStartUpCompleteTime",
            SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
            TimeUnit.MILLISECONDS);
    LocaleManager.getInstance().recordStartupMetrics();
}
 
Example 12
Source File: OfflinePageUtils.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Records UMA data when the Offline Pages Background Load service awakens.
 * @param context android context
 */
public static void recordWakeupUMA(Context context, long taskScheduledTimeMillis) {
    DeviceConditions deviceConditions = getDeviceConditions(context);
    if (deviceConditions == null) return;

    // Report charging state.
    RecordHistogram.recordBooleanHistogram(
            "OfflinePages.Wakeup.ConnectedToPower", deviceConditions.isPowerConnected());

    // Report battery percentage.
    RecordHistogram.recordPercentageHistogram(
            "OfflinePages.Wakeup.BatteryPercentage", deviceConditions.getBatteryPercentage());

    // Report the default network found (or none, if we aren't connected).
    int connectionType = deviceConditions.getNetConnectionType();
    Log.d(TAG, "Found default network of type " + connectionType);
    RecordHistogram.recordEnumeratedHistogram("OfflinePages.Wakeup.NetworkAvailable",
            connectionType, ConnectionType.CONNECTION_LAST + 1);

    // Collect UMA on the time since the request started.
    long nowMillis = System.currentTimeMillis();
    long delayInMilliseconds = nowMillis - taskScheduledTimeMillis;
    if (delayInMilliseconds <= 0) {
        return;
    }
    RecordHistogram.recordLongTimesHistogram(
            "OfflinePages.Wakeup.DelayTime",
            delayInMilliseconds,
            TimeUnit.MILLISECONDS);
}
 
Example 13
Source File: DownloadManagerService.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to record the metrics when a download completes.
 * @param useDownloadManager Whether the download goes through Android DownloadManager.
 * @param status Download completion status.
 * @param totalDuration Total time in milliseconds to download the file.
 * @param bytesDownloaded Total bytes downloaded.
 * @param numInterruptions Number of interruptions during the download.
 */
private void recordDownloadCompletionStats(boolean useDownloadManager, int status,
        long totalDuration, long bytesDownloaded, int numInterruptions) {
    switch (status) {
        case DOWNLOAD_STATUS_COMPLETE:
            if (useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.DownloadManager.Success",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.DownloadManager.Success",
                        (int) (bytesDownloaded / 1024));
            } else {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Success",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.ChromeNetworkStack.Success",
                        (int) (bytesDownloaded / 1024));
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Success",
                        numInterruptions);
            }
            break;
        case DOWNLOAD_STATUS_FAILED:
            if (useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.DownloadManager.Failure",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.DownloadManager.Failure",
                        (int) (bytesDownloaded / 1024));
            } else {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Failure",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.ChromeNetworkStack.Failure",
                        (int) (bytesDownloaded / 1024));
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Failure",
                        numInterruptions);
            }
            break;
        case DOWNLOAD_STATUS_CANCELLED:
            if (!useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Cancel",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Cancel",
                        numInterruptions);
            }
            break;
        default:
            break;
    }
}
 
Example 14
Source File: DeferredStartupHandler.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Handle application level deferred startup tasks that can be lazily done after all
 * the necessary initialization has been completed. Any calls requiring network access should
 * probably go here.
 *
 * Keep these tasks short and break up long tasks into multiple smaller tasks, as they run on
 * the UI thread and are blocking. Remember to follow RAIL guidelines, as much as possible, and
 * that most devices are quite slow, so leave enough buffer.
 */
@UiThread
public void initDeferredStartupForApp() {
    if (mDeferredStartupInitializedForApp) return;
    mDeferredStartupInitializedForApp = true;
    ThreadUtils.assertOnUiThread();

    RecordHistogram.recordLongTimesHistogram(
            "UMA.Debug.EnableCrashUpload.DeferredStartUptime2",
            SystemClock.uptimeMillis() - UmaUtils.getForegroundStartTime(),
            TimeUnit.MILLISECONDS);

    mDeferredTasks.add(new Runnable() {
        @Override
        public void run() {
            // Punt all tasks that may block on disk off onto a background thread.
            initAsyncDiskTask();

            AfterStartupTaskUtils.setStartupComplete();

            PartnerBrowserCustomizations.setOnInitializeAsyncFinished(new Runnable() {
                @Override
                public void run() {
                    String homepageUrl = HomepageManager.getHomepageUri(mAppContext);
                    LaunchMetrics.recordHomePageLaunchMetrics(
                            HomepageManager.isHomepageEnabled(mAppContext),
                            NewTabPage.isNTPUrl(homepageUrl), homepageUrl);
                }
            });

            PartnerBookmarksShim.kickOffReading(mAppContext);

            PowerMonitor.create(mAppContext);

            ShareHelper.clearSharedImages();

            OfflinePageUtils.clearSharedOfflineFiles(mAppContext);
        }
    });

    mDeferredTasks.add(new Runnable() {
        @Override
        public void run() {
            // Clear any media notifications that existed when Chrome was last killed.
            MediaCaptureNotificationService.clearMediaNotifications(mAppContext);

            startModerateBindingManagementIfNeeded();

            recordKeyboardLocaleUma();
        }
    });

    mDeferredTasks.add(new Runnable() {
        @Override
        public void run() {
            // Start or stop Physical Web
            PhysicalWeb.onChromeStart();
        }
    });

    final ChromeApplication application = (ChromeApplication) mAppContext;

    mDeferredTasks.add(new Runnable() {
        @Override
        public void run() {
            // Starts syncing with GSA.
            application.createGsaHelper().startSync();
        }
    });

    ProcessInitializationHandler.getInstance().initializeDeferredStartupTasks();
}
 
Example 15
Source File: ReaderModeManager.java    From 365browser with Apache License 2.0 4 votes vote down vote up
@Override
public void recordTimeSpentInReader(long timeMs) {
    RecordHistogram.recordLongTimesHistogram("DomDistiller.Time.ViewingReaderModePanel",
            timeMs, TimeUnit.MILLISECONDS);
}
 
Example 16
Source File: WebApkUma.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/** Records the duration of a WebAPK session (from launch/foreground to background). */
public static void recordWebApkSessionDuration(long duration) {
    RecordHistogram.recordLongTimesHistogram(
            "WebApk.Session.TotalDuration", duration, TimeUnit.MILLISECONDS);
}
 
Example 17
Source File: NewTabPageUma.java    From delion with Apache License 2.0 4 votes vote down vote up
private void endRecording(Tab removeObserverFromTab) {
    if (removeObserverFromTab != null) removeObserverFromTab.removeObserver(this);
    RecordUserAction.record("MobileNTP.Snippets.VisitEnd");
    RecordHistogram.recordLongTimesHistogram("NewTabPage.Snippets.VisitDuration",
            SystemClock.elapsedRealtime() - mStartTimeNs, TimeUnit.MILLISECONDS);
}
 
Example 18
Source File: DownloadManagerService.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to record the metrics when a download completes.
 * @param useDownloadManager Whether the download goes through Android DownloadManager.
 * @param status Download completion status.
 * @param totalDuration Total time in milliseconds to download the file.
 * @param bytesDownloaded Total bytes downloaded.
 * @param numInterruptions Number of interruptions during the download.
 */
private void recordDownloadCompletionStats(boolean useDownloadManager, int status,
        long totalDuration, long bytesDownloaded, int numInterruptions) {
    switch (status) {
        case DOWNLOAD_STATUS_COMPLETE:
            if (useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.DownloadManager.Success",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.DownloadManager.Success",
                        (int) (bytesDownloaded / 1024));
            } else {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Success",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.ChromeNetworkStack.Success",
                        (int) (bytesDownloaded / 1024));
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Success",
                        numInterruptions);
            }
            break;
        case DOWNLOAD_STATUS_FAILED:
            if (useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.DownloadManager.Failure",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.DownloadManager.Failure",
                        (int) (bytesDownloaded / 1024));
            } else {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Failure",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.ChromeNetworkStack.Failure",
                        (int) (bytesDownloaded / 1024));
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Failure",
                        numInterruptions);
            }
            break;
        case DOWNLOAD_STATUS_CANCELLED:
            if (!useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Cancel",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Cancel",
                        numInterruptions);
            }
            break;
        default:
            break;
    }
}
 
Example 19
Source File: DownloadManagerService.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Helper method to record the metrics when a download completes.
 * @param useDownloadManager Whether the download goes through Android DownloadManager.
 * @param status Download completion status.
 * @param totalDuration Total time in milliseconds to download the file.
 * @param bytesDownloaded Total bytes downloaded.
 * @param numInterruptions Number of interruptions during the download.
 */
private void recordDownloadCompletionStats(boolean useDownloadManager, int status,
        long totalDuration, long bytesDownloaded, int numInterruptions, long bytesWasted) {
    switch (status) {
        case DOWNLOAD_STATUS_COMPLETE:
            if (useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.DownloadManager.Success",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.DownloadManager.Success",
                        (int) (bytesDownloaded / 1024));
            } else {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Success",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.ChromeNetworkStack.Success",
                        (int) (bytesDownloaded / 1024));
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Success",
                        numInterruptions);
                recordBytesWasted(
                        "MobileDownload.BytesWasted.ChromeNetworkStack.Success", bytesWasted);
            }
            break;
        case DOWNLOAD_STATUS_FAILED:
            if (useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.DownloadManager.Failure",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.DownloadManager.Failure",
                        (int) (bytesDownloaded / 1024));
            } else {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Failure",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCount1000Histogram(
                        "MobileDownload.BytesDownloaded.ChromeNetworkStack.Failure",
                        (int) (bytesDownloaded / 1024));
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Failure",
                        numInterruptions);
                recordBytesWasted(
                        "MobileDownload.BytesWasted.ChromeNetworkStack.Failure", bytesWasted);
            }
            break;
        case DOWNLOAD_STATUS_CANCELLED:
            if (!useDownloadManager) {
                RecordHistogram.recordLongTimesHistogram(
                        "MobileDownload.DownloadTime.ChromeNetworkStack.Cancel",
                        totalDuration, TimeUnit.MILLISECONDS);
                RecordHistogram.recordCountHistogram(
                        "MobileDownload.InterruptionsCount.ChromeNetworkStack.Cancel",
                        numInterruptions);
                recordBytesWasted(
                        "MobileDownload.BytesWasted.ChromeNetworkStack.Cancel", bytesWasted);
            }
            break;
        default:
            break;
    }
}
 
Example 20
Source File: ReaderModeManager.java    From delion with Apache License 2.0 4 votes vote down vote up
@Override
public void recordTimeSpentInReader(long timeMs) {
    RecordHistogram.recordLongTimesHistogram("DomDistiller.Time.ViewingReaderModePanel",
            timeMs, TimeUnit.MILLISECONDS);
}