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

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordPercentageHistogram() . 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: DataReductionProxyUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Record UMA on data savings displayed to the user. Called when the user views the data
 * savings in the UI.
 * @param compressedTotalBytes The total data used as shown to the user.
 * @param originalTotalBytes Original total size as shown to the user.
 * @param percentage Percentage savings as shown to the user.
 */
public static void dataReductionProxyUserViewedSavings(
        long compressedTotalBytes, long originalTotalBytes, double percentage) {
    // The byte counts are stored in KB. The largest histogram bucket is set to ~1 TB.
    RecordHistogram.recordCustomCountHistogram(USER_VIEWED_ORIGINAL_SIZE_HISTOGRAM_NAME,
            (int) (originalTotalBytes / 1024), 1, 1000 * 1000 * 1000, 100);
    RecordHistogram.recordCustomCountHistogram(USER_VIEWED_SAVINGS_SIZE_HISTOGRAM_NAME,
            (int) ((originalTotalBytes - compressedTotalBytes) / 1024), 1, 1000 * 1000 * 1000,
            100);

    RecordHistogram.recordPercentageHistogram(
            USER_VIEWED_SAVINGS_PERCENT_HISTOGRAM_NAME, (int) percentage);
}
 
Example 2
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 3
Source File: PrecacheController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void recordBatteryLevelAtStart() {
    mDeviceState.saveCurrentBatteryPercentage(mAppContext);

    // Report battery percentage.
    RecordHistogram.recordPercentageHistogram(
            "Precache.BatteryPercentage.Start", mDeviceState.getSavedBatteryPercentage());
}
 
Example 4
Source File: PrecacheController.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
private void recordBatteryLevelAtEnd() {
    int delta_percentage = mDeviceState.getCurrentBatteryPercentage(mAppContext)
            - mDeviceState.getSavedBatteryPercentage();
    if (delta_percentage >= 0) {
        RecordHistogram.recordPercentageHistogram(
                "Precache.BatteryPercentageDiff.End", delta_percentage);
    }
}
 
Example 5
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 6
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 7
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 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: ContextualSearchUma.java    From 365browser 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 10
Source File: PrecacheController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void recordBatteryLevelAtStart() {
    mDeviceState.saveCurrentBatteryPercentage(mAppContext);

    // Report battery percentage.
    RecordHistogram.recordPercentageHistogram(
            "Precache.BatteryPercentage.Start", mDeviceState.getSavedBatteryPercentage());
}
 
Example 11
Source File: PrecacheController.java    From 365browser with Apache License 2.0 5 votes vote down vote up
private void recordBatteryLevelAtEnd() {
    int delta_percentage = mDeviceState.getCurrentBatteryPercentage(mAppContext)
            - mDeviceState.getSavedBatteryPercentage();
    if (delta_percentage >= 0) {
        RecordHistogram.recordPercentageHistogram(
                "Precache.BatteryPercentageDiff.End", delta_percentage);
    }
}
 
Example 12
Source File: ContextualSearchUma.java    From 365browser 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 13
Source File: RecordCastAction.java    From AndroidChromium with Apache License 2.0 3 votes vote down vote up
/**
 * Record the ratio of the time the media element was detached from the remote playback session
 * to the total duration of the session (as from when the element has been attached till when
 * the session stopped or disconnected), in percents.
 *
 * @param percentage The ratio in percents.
 */
public static void recordRemoteSessionTimeWithoutMediaElementPercentage(int percentage) {
    if (LibraryLoader.isInitialized()) {
        RecordHistogram.recordPercentageHistogram(
                "Cast.Sender.SessionTimeWithoutMediaElementPercentage", percentage);
    }
}
 
Example 14
Source File: RecordCastAction.java    From 365browser with Apache License 2.0 3 votes vote down vote up
/**
 * Record the ratio of the time the media element was detached from the remote playback session
 * to the total duration of the session (as from when the element has been attached till when
 * the session stopped or disconnected), in percents.
 *
 * @param percentage The ratio in percents.
 */
public static void recordRemoteSessionTimeWithoutMediaElementPercentage(int percentage) {
    if (LibraryLoader.isInitialized()) {
        RecordHistogram.recordPercentageHistogram(
                "Cast.Sender.SessionTimeWithoutMediaElementPercentage", percentage);
    }
}
 
Example 15
Source File: RecordCastAction.java    From delion with Apache License 2.0 3 votes vote down vote up
/**
 * Record the ratio of the time the media element was detached from the remote playback session
 * to the total duration of the session (as from when the element has been attached till when
 * the session stopped or disconnected), in percents.
 *
 * @param percentage The ratio in percents.
 */
public static void recordRemoteSessionTimeWithoutMediaElementPercentage(int percentage) {
    if (LibraryLoader.isInitialized()) {
        RecordHistogram.recordPercentageHistogram(
                "Cast.Sender.SessionTimeWithoutMediaElementPercentage", percentage);
    }
}
 
Example 16
Source File: DownloadUtils.java    From 365browser with Apache License 2.0 2 votes vote down vote up
/**
 * Records metrics related to downloading a page. Should be called after a tap on the download
 * page button.
 * @param tab The Tab containing the page being downloaded.
 */
public static void recordDownloadPageMetrics(Tab tab) {
    RecordHistogram.recordPercentageHistogram("OfflinePages.SavePage.PercentLoaded",
            tab.getProgress());
}
 
Example 17
Source File: DownloadUtils.java    From AndroidChromium with Apache License 2.0 2 votes vote down vote up
/**
 * Records metrics related to downloading a page. Should be called after a tap on the download
 * page button.
 * @param tab The Tab containing the page being downloaded.
 */
public static void recordDownloadPageMetrics(Tab tab) {
    RecordHistogram.recordPercentageHistogram("OfflinePages.SavePage.PercentLoaded",
            tab.getProgress());
}