TabRanker: Query time logging with label_id and query_id.
When chrome browser is under memory pressure, TabManager::GetSortedLifecycleUnits is called to return list of tabs sorted by its reactivation score. We want to log this event by: (1) generates (and logs) a query_id for this query. (2) for each tab, when its reactivation score is calculated, we log its tab_features (with a random label_id) for this query. (3) when the tab is later on reactivated or closed, we log the label with the label_id generated before so that feature-label can be paired. Please see more details in the bug. Changes made in this CL: (1) Extending TabMetricsLogger chrome/browser/resource_coordinator/tab_metrics_logger.h chrome/browser/resource_coordinator/tab_metrics_logger.cc chrome/browser/resource_coordinator/tab_metrics_logger_unittest.cc Minor change of these functions to also take label_id and query_id as input. (label_id is passed in as input since it's different per tab, query_id is saved and set inside TabMetricsLogger since it's the same of all tabs per discard-query) (2) Populating the label_id and query_id chrome/browser/resource_coordinator/tab_activity_watcher.h chrome/browser/resource_coordinator/tab_activity_watcher.cc chrome/browser/resource_coordinator/tab_activity_watcher_browsertest.cc TabActivityWatcher::CalculateReactivationScore and TabActivityWatcher::WebContentsData::CalculateReactivationScore are extended to also take also_log_to_ukm as input. A tab_feature with a random label_id_ is logged whenever CalculateReactivationScore(true) is called. The same label_id_ is also logged in LogForegroundedOrClosedMetrics. We also add logic to block background time feature logging for now. (3) TabManager changes. chrome/browser/resource_coordinator/tab_lifecycle_unit.cc chrome/browser/resource_coordinator/tab_manager.h chrome/browser/resource_coordinator/tab_manager.cc These changes are necessary only because TabManager::GetSortedLifecycleUnits and TabActivityWatcher::CalculateReactivationScore are called at multiple places. And we only want to log some of them. a) TabLifecycleUnitSource::TabLifecycleUnit::GetSortKey is changed back to only sort by last_activity_time for now. b) is added as private function and called inside TabManager::DiscardTabImpl if TabRanker is enabled. c) CalculateReactivationScore(also_log_to_ukm=true) is called inside GetSortedLifecycleUnitsFromTabRanker, which is the only case we log query time features. Bug: 900454 Change-Id: Idc77b0ff6aa3488e10a449dfec6a96d4c61f8da0 Reviewed-on: https://chromium-review.googlesource.com/c/1350445Reviewed-by:Kentaro Hara <haraken@chromium.org> Reviewed-by:
Michael Giuffrida <michaelpg@chromium.org> Reviewed-by:
Robert Kaplow <rkaplow@chromium.org> Reviewed-by:
Sébastien Marchand <sebmarchand@chromium.org> Commit-Queue: Charles . <charleszhao@chromium.org> Cr-Commit-Position: refs/heads/master@{#612070}
Showing
This diff is collapsed.
Please register or sign in to comment