New issue
Advanced search Search tips

Issue 871801 link

Starred by 2 users

Issue metadata

Status: Started
Owner:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Feature



Sign in to add a comment

[Mac] Add field power metrics

Project Member Reported by sdy@chromium.org, Aug 7

Issue description

It's technically possible to collect system power usage on Mac, and Chrome should do so.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Aug 15

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

commit 3bd1f5ed9cf7e4dadae9f765d57c4d256790bab1
Author: Sidney San Martín <sdy@chromium.org>
Date: Wed Aug 15 22:51:31 2018

[Mac] Start reporting system power usage. More metrics to come.

This change uses an undocumented interface to the Mac SMC (System
Management Controller) to read power consumption by different parts of
the computer, including CPU and GPU(s). These web pages and projects
were all helpful, or critical, in writing it and checking assumptions:

- https://opensource.apple.com/source/PowerManagement/PowerManagement-271.1.1/pmconfigd/PrivateLib.c.auto.html
- https://opensource.apple.com/source/IOKitUser/IOKitUser-647.6/pwr_mgt.subproj/IOPMLibPrivate.c
- https://web.archive.org/web/20140816041243/http://www.parhelia.ch/blog/statics/k3_keys.html
- https://stackoverflow.com/questions/28568775/description-for-apples-smc-keys
- https://github.com/theopolis/smc-fuzzer
- https://github.com/beltex/SMCKit/
- https://github.com/hholtmann/smcFanControl/
- https://github.com/Chris911/iStats
- https://github.com/RehabMan/OS-X-FakeSMC-kozlek/
- https://www.virtualbox.org/svn/vbox/trunk/src/VBox/Devices/EFI/VBoxSmcUtil-darwin.cpp

Bug: 871801
Change-Id: I4dcd8e06b7506743e9c5e7514c7f6f9c8f2b3205
Reviewed-on: https://chromium-review.googlesource.com/1165314
Commit-Queue: Sidney San Martín <sdy@chromium.org>
Reviewed-by: Robert Kaplow (slow) <rkaplow@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#583425}
[modify] https://crrev.com/3bd1f5ed9cf7e4dadae9f765d57c4d256790bab1/chrome/browser/BUILD.gn
[modify] https://crrev.com/3bd1f5ed9cf7e4dadae9f765d57c4d256790bab1/chrome/browser/metrics/chrome_metrics_service_client.cc
[add] https://crrev.com/3bd1f5ed9cf7e4dadae9f765d57c4d256790bab1/chrome/browser/metrics/power_metrics_provider_mac.h
[add] https://crrev.com/3bd1f5ed9cf7e4dadae9f765d57c4d256790bab1/chrome/browser/metrics/power_metrics_provider_mac.mm
[modify] https://crrev.com/3bd1f5ed9cf7e4dadae9f765d57c4d256790bab1/tools/metrics/histograms/histograms.xml

Project Member

Comment 2 by bugdroid1@chromium.org, Aug 18

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

commit 4b45324f9d4b2453dbfd79a511e2aa1ed9681391
Author: Sidney San Martín <sdy@chromium.org>
Date: Sat Aug 18 01:57:42 2018

[Mac] Fix wrong metric names.

In 3bd1f5ed9cf7e4dadae9f765d57c4d256790bab1, I renamed the histograms
right before commit, and I forgot to rename them in some places. Whoops.

TBR=rkaplow

Bug: 871801
Change-Id: Iff576c3d9c06878b4f2f60c6fb6557b16e915d1c
Reviewed-on: https://chromium-review.googlesource.com/1180293
Reviewed-by: Sidney San Martín <sdy@chromium.org>
Commit-Queue: Sidney San Martín <sdy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#584282}
[modify] https://crrev.com/4b45324f9d4b2453dbfd79a511e2aa1ed9681391/chrome/browser/metrics/power_metrics_provider_mac.mm
[modify] https://crrev.com/4b45324f9d4b2453dbfd79a511e2aa1ed9681391/tools/metrics/histograms/histograms.xml

Status: Started (was: Assigned)
Project Member

Comment 4 by bugdroid1@chromium.org, Aug 29

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

commit 943d3f6eaeaea6b614c7cce17b3b3335104bfbc1
Author: Sidney San Martín <sdy@chromium.org>
Date: Wed Aug 29 02:08:56 2018

[Mac] Skip logging a power metric if its value is zero.

Some machines have certain SMC sensor keys but don't return a value from
them. This change stops that from affecting stats. Also refactor a bit
to avoid adding repetition.

Bug: 871801
Change-Id: Ib7e50cc36b3ba3a3a5be180db66334e45a99131d
Reviewed-on: https://chromium-review.googlesource.com/1194496
Commit-Queue: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#586998}
[modify] https://crrev.com/943d3f6eaeaea6b614c7cce17b3b3335104bfbc1/chrome/browser/metrics/power_metrics_provider_mac.mm

Is this fixed?

Sign in to add a comment