Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(416)

Side by Side Diff: chrome/browser/win/jumplist.cc

Issue 2964873002: Log the ratio of the duration spent adding the two JumpList categories (Closed)
Patch Set: Remove explicit cast, update comments Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/win/jumplist.h" 5 #include "chrome/browser/win/jumplist.h"
6 6
7 #include "base/base_paths.h" 7 #include "base/base_paths.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 746
747 // Update the "Most Visited" category of the JumpList if it exists. 747 // Update the "Most Visited" category of the JumpList if it exists.
748 // This update request is applied into the JumpList when we commit this 748 // This update request is applied into the JumpList when we commit this
749 // transaction. 749 // transaction.
750 if (!jumplist_updater.AddCustomCategory( 750 if (!jumplist_updater.AddCustomCategory(
751 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED), 751 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED),
752 most_visited_pages, kMostVisitedItems)) { 752 most_visited_pages, kMostVisitedItems)) {
753 return; 753 return;
754 } 754 }
755 755
756 base::TimeDelta most_visited_category_time =
757 add_custom_category_timer.Elapsed();
758
756 // Update the "Recently Closed" category of the JumpList. 759 // Update the "Recently Closed" category of the JumpList.
757 if (!jumplist_updater.AddCustomCategory( 760 if (!jumplist_updater.AddCustomCategory(
758 l10n_util::GetStringUTF16(IDS_RECENTLY_CLOSED), recently_closed_pages, 761 l10n_util::GetStringUTF16(IDS_RECENTLY_CLOSED), recently_closed_pages,
759 kRecentlyClosedItems)) { 762 kRecentlyClosedItems)) {
760 return; 763 return;
761 } 764 }
762 765
766 base::TimeDelta add_category_total_time = add_custom_category_timer.Elapsed();
767
768 if (recently_closed_pages.size() == kRecentlyClosedItems &&
769 most_visited_pages.size() == kMostVisitedItems) {
770 // TODO(chengx): Remove the UMA histogram after fixing crbug/736530.
771 double most_visited_over_recently_closed =
772 most_visited_category_time.InMillisecondsF() /
773 (add_category_total_time - most_visited_category_time)
774 .InMillisecondsF();
775
776 // The ratio above is typically between 1 and 10. Multiply it by 10 to
777 // retain decimal precision.
778 UMA_HISTOGRAM_COUNTS_100("WinJumplist.RatioAddCategoryTime",
779 most_visited_over_recently_closed * 10);
780 }
781
763 // If AddCustomCategory takes longer than the maximum allowed time, abort the 782 // If AddCustomCategory takes longer than the maximum allowed time, abort the
764 // current update and skip the next |kUpdatesToSkipUnderHeavyLoad| updates. 783 // current update and skip the next |kUpdatesToSkipUnderHeavyLoad| updates.
765 if (add_custom_category_timer.Elapsed() >= kTimeOutForAddCustomCategory) { 784 if (add_category_total_time >= kTimeOutForAddCustomCategory) {
766 update_transaction->update_timeout = true; 785 update_transaction->update_timeout = true;
767 return; 786 return;
768 } 787 }
769 788
770 // Update the "Tasks" category of the JumpList. 789 // Update the "Tasks" category of the JumpList.
771 if (!UpdateTaskCategory(&jumplist_updater, incognito_availability)) 790 if (!UpdateTaskCategory(&jumplist_updater, incognito_availability))
772 return; 791 return;
773 792
774 base::ElapsedTimer commit_update_timer; 793 base::ElapsedTimer commit_update_timer;
775 794
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 const URLIconCache& icons_cache) { 882 const URLIconCache& icons_cache) {
864 // Put all cached icon file paths into a set. 883 // Put all cached icon file paths into a set.
865 base::flat_set<base::FilePath> cached_files; 884 base::flat_set<base::FilePath> cached_files;
866 cached_files.reserve(icons_cache.size()); 885 cached_files.reserve(icons_cache.size());
867 886
868 for (const auto& url_path_pair : icons_cache) 887 for (const auto& url_path_pair : icons_cache)
869 cached_files.insert(url_path_pair.second); 888 cached_files.insert(url_path_pair.second);
870 889
871 DeleteNonCachedFiles(icon_dir, cached_files); 890 DeleteNonCachedFiles(icon_dir, cached_files);
872 } 891 }
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698