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

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordCountHistogram() . 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: TabUma.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Records the tab restore result into several UMA histograms.
 * @param succeeded Whether or not the tab restore succeeded.
 * @param time The time taken to perform the tab restore.
 * @param perceivedTime The perceived time taken to perform the tab restore.
 * @param errorCode The error code, on failure (as denoted by the |succeeded| parameter).
 */
private void recordTabRestoreResult(boolean succeeded, long time, long perceivedTime,
        int errorCode) {
    if (succeeded) {
        RecordHistogram.recordEnumeratedHistogram(
                "Tab.RestoreResult", TAB_RESTORE_RESULT_SUCCESS, TAB_RESTORE_RESULT_COUNT);
        RecordHistogram.recordCountHistogram("Tab.RestoreTime", (int) time);
        RecordHistogram.recordCountHistogram("Tab.PerceivedRestoreTime", (int) perceivedTime);
    } else {
        switch (errorCode) {
            case NetError.ERR_INTERNET_DISCONNECTED:
            case NetError.ERR_NAME_RESOLUTION_FAILED:
            case NetError.ERR_DNS_TIMED_OUT:
                RecordHistogram.recordEnumeratedHistogram("Tab.RestoreResult",
                        TAB_RESTORE_RESULT_FAILURE_NETWORK_CONNECTIVITY,
                        TAB_RESTORE_RESULT_COUNT);
                break;
            default:
                RecordHistogram.recordEnumeratedHistogram("Tab.RestoreResult",
                        TAB_RESTORE_RESULT_FAILURE_OTHER, TAB_RESTORE_RESULT_COUNT);
        }
    }
}
 
Example 2
Source File: TabUma.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Records the tab restore result into several UMA histograms.
 * @param succeeded Whether or not the tab restore succeeded.
 * @param time The time taken to perform the tab restore.
 * @param perceivedTime The perceived time taken to perform the tab restore.
 * @param errorCode The error code, on failure (as denoted by the |succeeded| parameter).
 */
private void recordTabRestoreResult(boolean succeeded, long time, long perceivedTime,
        int errorCode) {
    if (succeeded) {
        RecordHistogram.recordEnumeratedHistogram(
                "Tab.RestoreResult", TAB_RESTORE_RESULT_SUCCESS, TAB_RESTORE_RESULT_COUNT);
        RecordHistogram.recordCountHistogram("Tab.RestoreTime", (int) time);
        RecordHistogram.recordCountHistogram("Tab.PerceivedRestoreTime", (int) perceivedTime);
    } else {
        switch (errorCode) {
            case NetError.ERR_INTERNET_DISCONNECTED:
            case NetError.ERR_NAME_RESOLUTION_FAILED:
            case NetError.ERR_DNS_TIMED_OUT:
                RecordHistogram.recordEnumeratedHistogram("Tab.RestoreResult",
                        TAB_RESTORE_RESULT_FAILURE_NETWORK_CONNECTIVITY,
                        TAB_RESTORE_RESULT_COUNT);
                break;
            default:
                RecordHistogram.recordEnumeratedHistogram("Tab.RestoreResult",
                        TAB_RESTORE_RESULT_FAILURE_OTHER, TAB_RESTORE_RESULT_COUNT);
        }
    }
}
 
Example 3
Source File: TabPersistentStore.java    From delion with Apache License 2.0 5 votes vote down vote up
private void saveListToFile(byte[] listData) {
    if (Arrays.equals(mLastSavedMetadata, listData)) return;

    saveListToFile(getStateDirectory(), mSelectorIndex, listData);
    mLastSavedMetadata = listData;
    if (LibraryLoader.isInitialized()) {
        RecordHistogram.recordCountHistogram(
                "Android.TabPersistentStore.MetadataFileSize", listData.length);
    }
}
 
Example 4
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the given number of promo taps remaining.  Should be called only for users that
 * are still undecided.
 * @param promoTapsRemaining The number of taps remaining (should not be negative).
 */
public static void logPromoTapsRemaining(int promoTapsRemaining) {
    if (promoTapsRemaining >= 0) {
        RecordHistogram.recordCountHistogram("Search.ContextualSearchPromoTapsRemaining",
                promoTapsRemaining);
    }
}
 
Example 5
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the number of times the Peek Promo was seen.
 * @param count Number of times the Peek Promo was seen.
 * @param hasOpenedPanel Whether the Panel was opened.
 */
public static void logPeekPromoShowCount(int count, boolean hasOpenedPanel) {
    RecordHistogram.recordCountHistogram("Search.ContextualSearchPeekPromoCount", count);
    if (hasOpenedPanel) {
        RecordHistogram.recordCountHistogram(
                "Search.ContextualSearchPeekPromoCountUntilOpened", count);
    }
}
 
Example 6
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the number of times the Peek Promo was seen.
 * @param count Number of times the Peek Promo was seen.
 * @param hasOpenedPanel Whether the Panel was opened.
 */
public static void logPeekPromoShowCount(int count, boolean hasOpenedPanel) {
    RecordHistogram.recordCountHistogram("Search.ContextualSearchPeekPromoCount", count);
    if (hasOpenedPanel) {
        RecordHistogram.recordCountHistogram(
                "Search.ContextualSearchPeekPromoCountUntilOpened", count);
    }
}
 
Example 7
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the number of impressions and CTR for the previous week for the current user.
 * @param previousWeekImpressions The number of times the user saw the Contextual Search Bar.
 * @param previousWeekCtr The CTR expressed as a percentage.
 */
public static void logPreviousWeekCtr(int previousWeekImpressions, int previousWeekCtr) {
    RecordHistogram.recordCountHistogram(
            "Search.ContextualSearchPreviousWeekImpressions", previousWeekImpressions);
    RecordHistogram.recordPercentageHistogram(
            "Search.ContextualSearchPreviousWeekCtr", previousWeekCtr);
}
 
Example 8
Source File: PhysicalWebUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void uploadCounts(final String key) {
    String jsonCountsStr = mPrefs.getString(key, "[]");
    removePref(key);
    Integer[] counts = parseJsonIntegerArray(jsonCountsStr);
    if (counts == null) {
        Log.e(TAG, "Error reporting " + key + " with values: " + jsonCountsStr);
        return;
    }
    for (Integer count: counts) {
        RecordHistogram.recordCountHistogram(key, count);
    }
}
 
Example 9
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the given number of promo taps remaining.  Should be called only for users that
 * are still undecided.
 * @param promoTapsRemaining The number of taps remaining (should not be negative).
 */
public static void logPromoTapsRemaining(int promoTapsRemaining) {
    if (promoTapsRemaining >= 0) {
        RecordHistogram.recordCountHistogram("Search.ContextualSearchPromoTapsRemaining",
                promoTapsRemaining);
    }
}
 
Example 10
Source File: DownloadHistoryAdapter.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void recordDownloadCountHistograms(int[] itemCounts) {
    RecordHistogram.recordCountHistogram("Android.DownloadManager.InitialCount.Audio",
            itemCounts[DownloadFilter.FILTER_AUDIO]);
    RecordHistogram.recordCountHistogram("Android.DownloadManager.InitialCount.Document",
            itemCounts[DownloadFilter.FILTER_DOCUMENT]);
    RecordHistogram.recordCountHistogram("Android.DownloadManager.InitialCount.Image",
            itemCounts[DownloadFilter.FILTER_IMAGE]);
    RecordHistogram.recordCountHistogram("Android.DownloadManager.InitialCount.Other",
            itemCounts[DownloadFilter.FILTER_OTHER]);
    RecordHistogram.recordCountHistogram("Android.DownloadManager.InitialCount.Video",
            itemCounts[DownloadFilter.FILTER_VIDEO]);
}
 
Example 11
Source File: PhysicalWebUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void uploadCounts(final String key) {
    String jsonCountsStr = mPrefs.getString(key, "[]");
    removePref(key);
    Integer[] counts = parseJsonIntegerArray(jsonCountsStr);
    if (counts == null) {
        Log.e(TAG, "Error reporting " + key + " with values: " + jsonCountsStr);
        return;
    }
    for (Integer count: counts) {
        RecordHistogram.recordCountHistogram(key, count);
    }
}
 
Example 12
Source File: TabPersistentStore.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void saveListToFile(byte[] listData) {
    if (Arrays.equals(mLastSavedMetadata, listData)) return;

    saveListToFile(getStateDirectory(), mPersistencePolicy.getStateFileName(), listData);
    mLastSavedMetadata = listData;
    if (LibraryLoader.isInitialized()) {
        RecordHistogram.recordCountHistogram(
                "Android.TabPersistentStore.MetadataFileSize", listData.length);
    }
}
 
Example 13
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the number of times the Peek Promo was seen.
 * @param count Number of times the Peek Promo was seen.
 * @param hasOpenedPanel Whether the Panel was opened.
 */
public static void logPeekPromoShowCount(int count, boolean hasOpenedPanel) {
    RecordHistogram.recordCountHistogram("Search.ContextualSearchPeekPromoCount", count);
    if (hasOpenedPanel) {
        RecordHistogram.recordCountHistogram(
                "Search.ContextualSearchPeekPromoCountUntilOpened", count);
    }
}
 
Example 14
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the number of impressions and CTR for previous 28-day period for the current user.
 * @param previous28DayImpressions The number of times the user saw the Contextual Search Bar.
 * @param previous28DayCtr The CTR expressed as a percentage.
 */
public static void logPrevious28DayCtr(int previous28DayImpressions, int previous28DayCtr) {
    RecordHistogram.recordCountHistogram(
            "Search.ContextualSearchPrevious28DayImpressions", previous28DayImpressions);
    RecordHistogram.recordPercentageHistogram(
            "Search.ContextualSearchPrevious28DayCtr", previous28DayCtr);
}
 
Example 15
Source File: DownloadHistoryAdapter.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void recordTotalDownloadCountHistogram() {
    // The total count intentionally leaves out incognito downloads. This should be revisited
    // if/when incognito downloads are persistently available in downloads home.
    RecordHistogram.recordCountHistogram("Android.DownloadManager.InitialCount.Total",
            mRegularDownloadItems.size() + mOfflinePageItems.size());
}
 
Example 16
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 17
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 2 votes vote down vote up
/**
 * Logs the historic number of times that a Tap gesture triggered the peeking promo
 * for users that have never opened the panel.  This should be called periodically for
 * undecided users only.
 * @param promoTaps The historic number of taps that have caused the peeking bar for the promo,
 *        for users that have never opened the panel.
 */
public static void logPromoTapsForNeverOpened(int promoTaps) {
    RecordHistogram.recordCountHistogram("Search.ContextualSearchPromoTapsForNeverOpened",
            promoTaps);
}
 
Example 18
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Logs the number of taps that have been counted since the user last opened the panel, for
 * decided users.
 * @param tapsSinceOpen The number of taps to log.
 */
public static void logTapsSinceOpenForDecided(int tapsSinceOpen) {
    RecordHistogram.recordCountHistogram("Search.ContextualSearchTapsSinceOpenDecided",
            tapsSinceOpen);
}
 
Example 19
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Records the total count of times the promo panel has *ever* been opened.  This should only
 * be called when the user is still undecided.
 * @param count The total historic count of times the panel has ever been opened for the
 *        current user.
 */
public static void logPromoOpenCount(int count) {
    RecordHistogram.recordCountHistogram("Search.ContextualSearchPromoOpenCount", count);
}
 
Example 20
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Logs the number of taps that have been counted since the user last opened the panel, for
 * undecided users.
 * @param tapsSinceOpen The number of taps to log.
 */
public static void logTapsSinceOpenForUndecided(int tapsSinceOpen) {
    RecordHistogram.recordCountHistogram("Search.ContextualSearchTapsSinceOpenUndecided",
            tapsSinceOpen);
}