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

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordCount1000Histogram() . 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: ToolbarProgressBar.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Start hiding progress bar animation.
 * @param delayed Whether a delayed fading out animation should be posted.
 */
public void finish(boolean delayed) {
    mIsStarted = false;

    if (delayed) {
        updateVisibleProgress();
        RecordHistogram.recordCount1000Histogram(PROGRESS_BAR_UPDATE_COUNT_HISTOGRAM,
                getProgressUpdateCount());
        RecordHistogram.recordCount100Histogram(
                PROGRESS_BAR_BREAK_POINT_UPDATE_COUNT_HISTOGRAM,
                mTargetProgressUpdateCount);
    } else {
        removeCallbacks(mHideRunnable);
        animate().cancel();
        if (mAnimatingView != null) {
            removeCallbacks(mStartSmoothIndeterminate);
            mAnimatingView.cancelAnimation();
            mTargetProgress = 0;
        }
        mIsRunningSmoothIndeterminate = false;
        setAlpha(0.0f);
    }
}
 
Example 2
Source File: ToolbarProgressBar.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Start hiding progress bar animation.
 * @param delayed Whether a delayed fading out animation should be posted.
 */
public void finish(boolean delayed) {
    mIsStarted = false;

    if (delayed) {
        updateVisibleProgress();
        RecordHistogram.recordCount1000Histogram(PROGRESS_BAR_UPDATE_COUNT_HISTOGRAM,
                getProgressUpdateCount());
        RecordHistogram.recordCount100Histogram(
                PROGRESS_BAR_BREAK_POINT_UPDATE_COUNT_HISTOGRAM,
                mTargetProgressUpdateCount);
    } else {
        removeCallbacks(mHideRunnable);
        animate().cancel();
        if (mAnimatingView != null) {
            removeCallbacks(mStartSmoothIndeterminate);
            mAnimatingView.cancelAnimation();
            mTargetProgress = 0;
        }
        mIsRunningSmoothIndeterminate = false;
        setAlpha(0.0f);
    }
}
 
Example 3
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the duration since a recent scroll.
 * @param durationSinceRecentScrollMs The amount of time since the most recent scroll.
 * @param wasSearchContentViewSeen If the panel was opened.
 */
public static void logRecentScrollDuration(
        int durationSinceRecentScrollMs, boolean wasSearchContentViewSeen) {
    String histogram = wasSearchContentViewSeen ? "Search.ContextualSearchRecentScrollSeen"
                                                : "Search.ContextualSearchRecentScrollNotSeen";
    if (durationSinceRecentScrollMs < 1000) {
        RecordHistogram.recordCount1000Histogram(histogram, durationSinceRecentScrollMs);
    }
}
 
Example 4
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the duration since a recent scroll.
 * @param durationSinceRecentScrollMs The amount of time since the most recent scroll.
 * @param wasSearchContentViewSeen If the panel was opened.
 */
public static void logRecentScrollDuration(
        int durationSinceRecentScrollMs, boolean wasSearchContentViewSeen) {
    String histogram = wasSearchContentViewSeen ? "Search.ContextualSearchRecentScrollSeen"
                                                : "Search.ContextualSearchRecentScrollNotSeen";
    if (durationSinceRecentScrollMs < 1000) {
        RecordHistogram.recordCount1000Histogram(histogram, durationSinceRecentScrollMs);
    }
}
 
Example 5
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 6
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 7
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;
    }
}