Skip to content

Commit

Permalink
Log UpdateJumpList() and CreateIconFiles() execution time to UMA
Browse files Browse the repository at this point in the history
The separation of JumpListIcons delete tasks and update tasks as in
crrev.com/2807883002 indicates the update task (i.e., RunUpdateJumpList
method) is now the major contributor of the overall long execution time.
So it's time to investigate the subtasks in RunUpdateJumpList().

The count of the new icon files that will be created per update is also
logged to UMA.

BUG=40407, 179576

Review-Url: https://codereview.chromium.org/2811393002
Cr-Commit-Position: refs/heads/master@{#464510}
  • Loading branch information
chengx authored and Commit bot committed Apr 13, 2017
1 parent aee5ec5 commit 6f797ff
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
12 changes: 12 additions & 0 deletions chrome/browser/win/jumplist.cc
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,9 @@ bool CreateIconFile(const gfx::ImageSkia& image_skia,
// loaded icons.
void CreateIconFiles(const base::FilePath& icon_dir,
const ShellLinkItemList& item_list) {
// TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407.
SCOPED_UMA_HISTOGRAM_TIMER("WinJumplist.CreateIconFilesDuration");

for (ShellLinkItemList::const_iterator item = item_list.begin();
item != item_list.end(); ++item) {
base::FilePath icon_path;
Expand Down Expand Up @@ -177,6 +180,9 @@ bool UpdateJumpList(const wchar_t* app_id,
const ShellLinkItemList& most_visited_pages,
const ShellLinkItemList& recently_closed_pages,
IncognitoModePrefs::Availability incognito_availability) {
// TODO(chengx): Remove the UMA histogram after fixing http://crbug.com/40407.
SCOPED_UMA_HISTOGRAM_TIMER("WinJumplist.UpdateJumpListDuration");

// JumpList is implemented only on Windows 7 or later.
// So, we should return now when this function is called on earlier versions
// of Windows.
Expand Down Expand Up @@ -255,6 +261,12 @@ void RunUpdateJumpList(IncognitoModePrefs::Availability incognito_availability,
// jumplist icons. The jumplist links should be updated anyway, as it doesn't
// involve disk IO.
if (base::DirectoryExists(icon_dir) && base::IsDirectoryEmpty(icon_dir)) {
// TODO(chengx): Remove the UMA histogram after fixing
// http://crbug.com/40407.
UMA_HISTOGRAM_COUNTS_100(
"WinJumplist.CreateIconFilesCount",
local_most_visited_pages.size() + local_recently_closed_pages.size());

// Create icon files for shortcuts in the "Most Visited" category.
CreateIconFiles(icon_dir, local_most_visited_pages);

Expand Down
24 changes: 24 additions & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -81553,6 +81553,22 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<summary>The type of category clicked in the Windows Jumplist</summary>
</histogram>

<histogram name="WinJumplist.CreateIconFilesCount">
<owner>chengx@chromium.org</owner>
<summary>
Count of jumplist icons that will be created per jumplist update. It is
recorded whenever UpdateJumpList() is called.
</summary>
</histogram>

<histogram name="WinJumplist.CreateIconFilesDuration" units="ms">
<owner>chengx@chromium.org</owner>
<summary>
Time spent in CreateIconFiles(). This method is called whenever there is a
jumplist update and the JumpListIcons folder is empty.
</summary>
</histogram>

<histogram name="WinJumplist.DeleteStatusJumpListIcons"
enum="JumplisticonsDeleteCategory">
<owner>chengx@chromium.org</owner>
Expand Down Expand Up @@ -81679,6 +81695,14 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
</summary>
</histogram>

<histogram name="WinJumplist.UpdateJumpListDuration" units="ms">
<owner>chengx@chromium.org</owner>
<summary>
Time spent in UpdateJumpList(). This method is called whenever there is a
jumplist update.
</summary>
</histogram>

<histogram name="WinTimeTicks.FailedToChangeCores" enum="WindowsVersion">
<obsolete>
Removed 01/2017.
Expand Down

0 comments on commit 6f797ff

Please sign in to comment.