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

The following examples show how to use org.chromium.base.metrics.RecordHistogram#recordMediumTimesHistogram() . 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: BottomSheetMetrics.java    From 365browser with Apache License 2.0 6 votes vote down vote up
@Override
public void onSheetOpened() {
    mIsSheetOpen = true;

    boolean isFirstOpen = mLastOpenTime == 0;
    mLastOpenTime = System.currentTimeMillis();

    if (isFirstOpen) {
        RecordHistogram.recordMediumTimesHistogram("Android.ChromeHome.TimeToFirstOpen",
                mLastOpenTime - mCreationTime, TimeUnit.MILLISECONDS);
    } else {
        RecordHistogram.recordMediumTimesHistogram(
                "Android.ChromeHome.TimeBetweenCloseAndNextOpen",
                mLastOpenTime - mLastCloseTime, TimeUnit.MILLISECONDS);
    }
}
 
Example 2
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 6 votes vote down vote up
/**
 * Log the duration of finishing loading the SERP after the panel is opened.
 * @param wasPrefetch Whether the request was prefetch-enabled or not.
 * @param durationMs The duration of loading the SERP till completely loaded, in milliseconds.
 *        Note that this value will be 0 when the SERP is prefetched and the user waits a
 *        while before opening the panel.
 */
public static void logSearchPanelLoadDuration(boolean wasPrefetch, long durationMs) {
    if (wasPrefetch) {
        RecordHistogram.recordMediumTimesHistogram("Search.ContextualSearchDurationPrefetched",
                durationMs, TimeUnit.MILLISECONDS);
    } else {
        RecordHistogram.recordMediumTimesHistogram(
                "Search.ContextualSearchDurationNonPrefetched", durationMs,
                TimeUnit.MILLISECONDS);
    }

   // Also record a summary histogram with counts for each possibility.
    int code = !wasPrefetch ? NOT_PREFETCHED
            : (durationMs == 0 ? PREFETCHED_FULLY_LOADED : PREFETCHED_PARIALLY_LOADED);
    RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefetchSummary",
            code, PREFETCH_BOUNDARY);
}
 
Example 3
Source File: NewTabPageUma.java    From 365browser with Apache License 2.0 6 votes vote down vote up
/**
 * Records how much time elapsed from start until the search box became available to the user.
 */
public static void recordSearchAvailableLoadTime(ChromeActivity activity) {
    // Log the time it took for the search box to be displayed at startup, based on the
    // timestamp on the intent for the activity. If the user has interacted with the
    // activity already, it's not a startup, and the timestamp on the activity would not be
    // relevant either.
    if (activity.getLastUserInteractionTime() != 0) return;
    long timeFromIntent = SystemClock.elapsedRealtime()
            - IntentHandler.getTimestampFromIntent(activity.getIntent());
    if (activity.hadWarmStart()) {
        RecordHistogram.recordMediumTimesHistogram(
                "NewTabPage.SearchAvailableLoadTime2.WarmStart", timeFromIntent,
                TimeUnit.MILLISECONDS);
    } else {
        RecordHistogram.recordMediumTimesHistogram(
                "NewTabPage.SearchAvailableLoadTime2.ColdStart", timeFromIntent,
                TimeUnit.MILLISECONDS);
    }
}
 
Example 4
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 6 votes vote down vote up
/**
 * Log the duration of finishing loading the SERP after the panel is opened.
 * @param wasPrefetch Whether the request was prefetch-enabled or not.
 * @param durationMs The duration of loading the SERP till completely loaded, in milliseconds.
 *        Note that this value will be 0 when the SERP is prefetched and the user waits a
 *        while before opening the panel.
 */
public static void logSearchPanelLoadDuration(boolean wasPrefetch, long durationMs) {
    if (wasPrefetch) {
        RecordHistogram.recordMediumTimesHistogram("Search.ContextualSearchDurationPrefetched",
                durationMs, TimeUnit.MILLISECONDS);
    } else {
        RecordHistogram.recordMediumTimesHistogram(
                "Search.ContextualSearchDurationNonPrefetched", durationMs,
                TimeUnit.MILLISECONDS);
    }

   // Also record a summary histogram with counts for each possibility.
    int code = !wasPrefetch ? NOT_PREFETCHED
            : (durationMs == 0 ? PREFETCHED_FULLY_LOADED : PREFETCHED_PARIALLY_LOADED);
    RecordHistogram.recordEnumeratedHistogram("Search.ContextualSearchPrefetchSummary",
            code, PREFETCH_BOUNDARY);
}
 
Example 5
Source File: BottomSheetMetrics.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void onSheetClosed() {
    mIsSheetOpen = false;
    recordSheetCloseReason(mSheetCloseReason);
    mSheetCloseReason = CLOSED_BY_NONE;

    mLastCloseTime = System.currentTimeMillis();
    RecordHistogram.recordMediumTimesHistogram("Android.ChromeHome.DurationOpen",
            mLastCloseTime - mLastOpenTime, TimeUnit.MILLISECONDS);
}
 
Example 6
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the duration from starting a prefetched search until the panel navigates to the results
 * and they start becoming viewable. Should be called only for searches that are prefetched.
 * @param durationMs The duration to record.
 * @param didResolve Whether a Search Term resolution was required as part of the loading.
 */
public static void logPrefetchedSearchNavigatedDuration(long durationMs, boolean didResolve) {
    String histogramName = didResolve ? "Search.ContextualSearchResolvedSearchDuration"
                                      : "Search.ContextualSearchLiteralSearchDuration";
    RecordHistogram.recordMediumTimesHistogram(
            histogramName, durationMs, TimeUnit.MILLISECONDS);
}
 
Example 7
Source File: LogoDelegateImpl.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void getSearchProviderLogo(final LogoObserver logoObserver) {
    if (mIsDestroyed) return;

    final long loadTimeStart = System.currentTimeMillis();

    LogoObserver wrapperCallback = new LogoObserver() {
        @Override
        public void onLogoAvailable(Logo logo, boolean fromCache) {
            if (mIsDestroyed) return;
            mOnLogoClickUrl = logo != null ? logo.onClickUrl : null;
            mAnimatedLogoUrl = logo != null ? logo.animatedLogoUrl : null;
            if (logo != null) {
                RecordHistogram.recordSparseSlowlyHistogram(LOGO_SHOWN_UMA_NAME,
                        logo.animatedLogoUrl == null ? STATIC_LOGO_SHOWN : CTA_IMAGE_SHOWN);
                if (mShouldRecordLoadTime) {
                    long loadTime = System.currentTimeMillis() - loadTimeStart;
                    RecordHistogram.recordMediumTimesHistogram(
                            LOGO_SHOWN_TIME_UMA_NAME, loadTime, TimeUnit.MILLISECONDS);
                }
            }
            // If there currently is no Doodle, don't record the time if a refresh happens
            // later.
            mShouldRecordLoadTime = false;
            logoObserver.onLogoAvailable(logo, fromCache);
        }
    };

    mLogoBridge.getCurrentLogo(wrapperCallback);
}
 
Example 8
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the duration from starting a prefetched search until the panel navigates to the results
 * and they start becoming viewable. Should be called only for searches that are prefetched.
 * @param durationMs The duration to record.
 * @param didResolve Whether a Search Term resolution was required as part of the loading.
 */
public static void logPrefetchedSearchNavigatedDuration(long durationMs, boolean didResolve) {
    String histogramName = didResolve ? "Search.ContextualSearchResolvedSearchDuration"
                                      : "Search.ContextualSearchLiteralSearchDuration";
    RecordHistogram.recordMediumTimesHistogram(
            histogramName, durationMs, TimeUnit.MILLISECONDS);
}
 
Example 9
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 5 votes vote down vote up
/**
 * Logs the duration from starting a prefetched search until the panel navigates to the results
 * and they start becoming viewable. Should be called only for searches that are prefetched.
 * @param durationMs The duration to record.
 * @param didResolve Whether a Search Term resolution was required as part of the loading.
 */
public static void logPrefetchedSearchNavigatedDuration(long durationMs, boolean didResolve) {
    String histogramName = didResolve ? "Search.ContextualSearchResolvedSearchDuration"
                                      : "Search.ContextualSearchLiteralSearchDuration";
    RecordHistogram.recordMediumTimesHistogram(
            histogramName, durationMs, TimeUnit.MILLISECONDS);
}
 
Example 10
Source File: NewTabPage.java    From 365browser with Apache License 2.0 5 votes vote down vote up
@Override
public void openMostVisitedItem(int windowDisposition, Tile tile) {
    if (mIsDestroyed) return;

    super.openMostVisitedItem(windowDisposition, tile);

    if (windowDisposition != WindowOpenDisposition.NEW_WINDOW) {
        RecordHistogram.recordMediumTimesHistogram("NewTabPage.MostVisitedTime",
                System.nanoTime() - mLastShownTimeNs, TimeUnit.NANOSECONDS);
    }
}
 
Example 11
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Logs the duration from starting a search until the Search Term is resolved.
 * @param durationMs The duration to record.
 */
public static void logSearchTermResolutionDuration(long durationMs) {
    RecordHistogram.recordMediumTimesHistogram(
            "Search.ContextualSearchResolutionDuration", durationMs, TimeUnit.MILLISECONDS);
}
 
Example 12
Source File: SnippetArticleViewHolder.java    From 365browser with Apache License 2.0 4 votes vote down vote up
private void recordFaviconFetchTime(long faviconFetchStartTimeMs) {
    RecordHistogram.recordMediumTimesHistogram(
            "NewTabPage.ContentSuggestions.ArticleFaviconFetchTime",
            SystemClock.elapsedRealtime() - faviconFetchStartTimeMs, TimeUnit.MILLISECONDS);
}
 
Example 13
Source File: NewTabPage.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/** Records UMA for the NTP being hidden and the time spent on it. */
private void recordNTPHidden() {
    RecordHistogram.recordMediumTimesHistogram(
            "NewTabPage.TimeSpent", System.nanoTime() - mLastShownTimeNs, TimeUnit.NANOSECONDS);
    SuggestionsMetrics.recordSurfaceHidden();
}
 
Example 14
Source File: ContextualSearchUma.java    From 365browser with Apache License 2.0 4 votes vote down vote up
/**
 * Logs the duration from opening the panel beyond peek until the panel is closed.
 * @param durationMs The duration to record.
 */
public static void logPanelOpenDuration(long durationMs) {
    RecordHistogram.recordMediumTimesHistogram(
            "Search.ContextualSearchPanelOpenDuration", durationMs, TimeUnit.MILLISECONDS);
}
 
Example 15
Source File: NewTabPage.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
private void recordNTPInteractionTime() {
    RecordHistogram.recordMediumTimesHistogram(
            "NewTabPage.TimeSpent", System.nanoTime() - mLastShownTimeNs, TimeUnit.NANOSECONDS);
}
 
Example 16
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Logs the duration from opening the panel beyond peek until the panel is closed.
 * @param durationMs The duration to record.
 */
public static void logPanelOpenDuration(long durationMs) {
    RecordHistogram.recordMediumTimesHistogram(
            "Search.ContextualSearchPanelOpenDuration", durationMs, TimeUnit.MILLISECONDS);
}
 
Example 17
Source File: ContextualSearchUma.java    From AndroidChromium with Apache License 2.0 4 votes vote down vote up
/**
 * Logs the duration from starting a search until the Search Term is resolved.
 * @param durationMs The duration to record.
 */
public static void logSearchTermResolutionDuration(long durationMs) {
    RecordHistogram.recordMediumTimesHistogram(
            "Search.ContextualSearchResolutionDuration", durationMs, TimeUnit.MILLISECONDS);
}
 
Example 18
Source File: NewTabPage.java    From delion with Apache License 2.0 4 votes vote down vote up
private void recordNTPInteractionTime() {
    RecordHistogram.recordMediumTimesHistogram(
            "NewTabPage.TimeSpent", System.nanoTime() - mLastShownTimeNs, TimeUnit.NANOSECONDS);
}
 
Example 19
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Logs the duration from opening the panel beyond peek until the panel is closed.
 * @param durationMs The duration to record.
 */
public static void logPanelOpenDuration(long durationMs) {
    RecordHistogram.recordMediumTimesHistogram(
            "Search.ContextualSearchPanelOpenDuration", durationMs, TimeUnit.MILLISECONDS);
}
 
Example 20
Source File: ContextualSearchUma.java    From delion with Apache License 2.0 4 votes vote down vote up
/**
 * Logs the duration from starting a search until the Search Term is resolved.
 * @param durationMs The duration to record.
 */
public static void logSearchTermResolutionDuration(long durationMs) {
    RecordHistogram.recordMediumTimesHistogram(
            "Search.ContextualSearchResolutionDuration", durationMs, TimeUnit.MILLISECONDS);
}