New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 620832 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
not on Chrome anymore
Closed: Aug 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 3
Type: Feature

Blocked on:
issue 618862



Sign in to add a comment

Task manager should support idle wakeups on Windows

Project Member Reported by brucedaw...@chromium.org, Jun 16 2016

Issue description

When investigating idle chrome power usage bugs such as  crbug.com/620505  it is very useful to have idle wakeups as a task manager column. This would make correlating context switches to a particular Chrome process easier, and would avoid the need to use ETW or Process Explorer.

This information appears to be available through NtQuerySystemInformation and the SYSTEM_THREAD_INFORMATION structures which are contained in the SYSTEM_PROCESS_INFORMATION structure. This is explained here:

http://alax.info/blog/1182

 
Blockedon: 618862
I have working code to do this. Just like with PrivateWorkingSetSnapshot it grabs the data for all processes at once. Therefore this bug and  bug 618862  should be addressed together. In fact, the same API call can be used to get idle wakeups and private working-set data, as well as some other potentially useful information.

Querying the data (idle wakeups and private working set) for all processes on the system takes ~1-2 ms, which compares favorably with the ~1.6 ms per-process that the ProcessMetrics::GetWorkingSetKBytes we are currently using takes.

See also this archived Android CL:

https://chromiumcodereview.appspot.com/1242943005/
Is there any way to trace idle wakeups from ETW? If so, that seems like it'd be a terrific thing to sync with Chrome traces, in which case we could create a TBMv2 metric that just counts the number present in the ETW trace, and this might be another use case for synced ETW traces w/ Chrome traces.

If such a thing isn't possible, then using NtQuerySystemInformation seems like a reasonable backup.
ETW certainly supports recording idle wakeups. However it requires administrator access and is extremely complex. Therefore NtQuerySystemInformation is a better choice for Chrome's task manager - a few dozen lines of code does the trick.
Owner: stanisc@chromium.org
Status: Assigned (was: Untriaged)
Implementing this will probably make  crbug.com/618862  some combination of obsolete and fixed. That is, the old PrivateWorkingSetSnapshot class will probably go away.

Note that if we have a version of SYSTEM_PROCESS_INFORMATION and SYSTEM_THREAD_INFORMATION defined for this then we should probably use custom names to avoid ODR violations - there are other definitions of SYSTEM_PROCESS_INFORMATION.
Status: Started (was: Assigned)
Once this code is used to get private working set as well then be sure to test that the PDH DLLs are not loaded by default. They should only be needed if one of the other memory columns is enabled. Loading less code is part of maintaining good performance.
Project Member

Comment 8 by bugdroid1@chromium.org, Aug 6 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/71b5b48907b3a310e9006a427dda3f2ffbc08bc3

commit 71b5b48907b3a310e9006a427dda3f2ffbc08bc3
Author: stanisc <stanisc@chromium.org>
Date: Sat Aug 06 00:54:24 2016

Task manager should support Idle Wakeups on Windows

This change adds a special SharedSampler that can refresh
multiple TaskManager resources for all chrome Task Groups
in a single operation.

On OS_WIN the implementation is based on
NtQuerySystemInformation and currently provides
only Idle Wakeups per second to start with. It should be
fairly straightforward to support a few other resource
types later, for example CPU usage and Private Memory.

On non-Windows platforms SharedSampler has a trivial stub
implementation that does nothing.

BUG= 620832 

Review-Url: https://codereview.chromium.org/2178733002
Cr-Commit-Position: refs/heads/master@{#410236}

[add] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/shared_sampler.h
[add] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/shared_sampler_posix.cc
[add] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/shared_sampler_win.cc
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/task_group.cc
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/task_group.h
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/task_group_sampler.h
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/task_manager_impl.cc
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/sampling/task_manager_impl.h
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/task_manager_browsertest.cc
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/task_manager_browsertest_util.cc
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/task_manager_browsertest_util.h
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/task_management/task_manager_tester.cc
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/browser/ui/task_manager/task_manager_columns.cc
[modify] https://crrev.com/71b5b48907b3a310e9006a427dda3f2ffbc08bc3/chrome/chrome_browser.gypi

Status: Fixed (was: Started)

Sign in to add a comment