forked from mirrors/gecko-dev
Bug 1795047 - Power use feature string should clarify what's available on each platform, r=canaltinova,dlrobertson.
Differential Revision: https://phabricator.services.mozilla.com/D159685
This commit is contained in:
parent
6faaf10d5f
commit
baad7da439
3 changed files with 61 additions and 9 deletions
|
|
@ -11,6 +11,10 @@
|
||||||
|
|
||||||
const UNITS = ["B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
const UNITS = ["B", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"];
|
||||||
|
|
||||||
|
const AppConstants = ChromeUtils.importESModule(
|
||||||
|
"resource://gre/modules/AppConstants.sys.mjs"
|
||||||
|
).AppConstants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Linearly interpolate between values.
|
* Linearly interpolate between values.
|
||||||
* https://en.wikipedia.org/wiki/Linear_interpolation
|
* https://en.wikipedia.org/wiki/Linear_interpolation
|
||||||
|
|
@ -533,9 +537,24 @@ const featureDescriptions = [
|
||||||
{
|
{
|
||||||
name: "Power Use",
|
name: "Power Use",
|
||||||
value: "power",
|
value: "power",
|
||||||
title:
|
title: (() => {
|
||||||
"Record the value of every energy meter available on the system with " +
|
switch (AppConstants.platform) {
|
||||||
"each sample. Only available on Windows 11 and Apple Silicon.",
|
case "win":
|
||||||
|
return (
|
||||||
|
"Record the value of every energy meter available on the system with " +
|
||||||
|
"each sample. Only available on Windows 11 with Intel CPUs."
|
||||||
|
);
|
||||||
|
case "linux":
|
||||||
|
return (
|
||||||
|
"Record the power used by the entire system with each sample. " +
|
||||||
|
"Only available with Intel CPUs and requires setting the sysctl kernel.perf_event_paranoid to 0."
|
||||||
|
);
|
||||||
|
case "macosx":
|
||||||
|
return "Record the power used by the entire system (Intel) or each process (Apple Silicon) with each sample.";
|
||||||
|
default:
|
||||||
|
return "Not supported on this platform.";
|
||||||
|
}
|
||||||
|
})(),
|
||||||
experimental: true,
|
experimental: true,
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,24 @@ class MOZ_RAII AutoProfilerStats {
|
||||||
// Profiler features
|
// Profiler features
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# if defined(__APPLE__) && defined(__aarch64__)
|
||||||
|
# define POWER_HELP "Sample per process power use"
|
||||||
|
# elif defined(__APPLE__) && defined(__x86_64__)
|
||||||
|
# define POWER_HELP \
|
||||||
|
"Record the power used by the entire system with each sample."
|
||||||
|
# elif defined(__linux__) && defined(__x86_64__)
|
||||||
|
# define POWER_HELP \
|
||||||
|
"Record the power used by the entire system with each sample. " \
|
||||||
|
"Only available with Intel CPUs and requires setting " \
|
||||||
|
"the sysctl kernel.perf_event_paranoid to 0."
|
||||||
|
# elif defined(_MSC_VER)
|
||||||
|
# define POWER_HELP \
|
||||||
|
"Record the value of every energy meter available on the system with " \
|
||||||
|
"each sample. Only available on Windows 11 with Intel CPUs."
|
||||||
|
# else
|
||||||
|
# define POWER_HELP "Not supported on this platform."
|
||||||
|
# endif
|
||||||
|
|
||||||
// Higher-order macro containing all the feature info in one place. Define
|
// Higher-order macro containing all the feature info in one place. Define
|
||||||
// |MACRO| appropriately to extract the relevant parts. Note that the number
|
// |MACRO| appropriately to extract the relevant parts. Note that the number
|
||||||
// values are used internally only and so can be changed without consequence.
|
// values are used internally only and so can be changed without consequence.
|
||||||
|
|
@ -216,9 +234,7 @@ class MOZ_RAII AutoProfilerStats {
|
||||||
MACRO(21, "processcpu", ProcessCPU, \
|
MACRO(21, "processcpu", ProcessCPU, \
|
||||||
"Sample the CPU utilization of each process") \
|
"Sample the CPU utilization of each process") \
|
||||||
\
|
\
|
||||||
MACRO(22, "power", Power, \
|
MACRO(22, "power", Power, POWER_HELP)
|
||||||
"Sample energy meters on Windows 11 and per process power use on " \
|
|
||||||
"Apple Silicon")
|
|
||||||
// *** Synchronize with lists in ProfilerState.h and geckoProfiler.json ***
|
// *** Synchronize with lists in ProfilerState.h and geckoProfiler.json ***
|
||||||
|
|
||||||
struct ProfilerFeature {
|
struct ProfilerFeature {
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,25 @@
|
||||||
// Profiler features
|
// Profiler features
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if defined(__APPLE__) && defined(__aarch64__)
|
||||||
|
# define POWER_HELP "Sample per process power use"
|
||||||
|
#elif defined(__APPLE__) && defined(__x86_64__)
|
||||||
|
# define POWER_HELP \
|
||||||
|
"Record the power used by the entire system with each sample."
|
||||||
|
#elif defined(__linux__) && defined(__x86_64__)
|
||||||
|
# define POWER_HELP \
|
||||||
|
"Record the power used by the entire system with each sample. " \
|
||||||
|
"Only available with Intel CPUs and requires setting " \
|
||||||
|
"the sysctl kernel.perf_event_paranoid to 0."
|
||||||
|
|
||||||
|
#elif defined(_MSC_VER)
|
||||||
|
# define POWER_HELP \
|
||||||
|
"Record the value of every energy meter available on the system with " \
|
||||||
|
"each sample. Only available on Windows 11 with Intel CPUs."
|
||||||
|
#else
|
||||||
|
# define POWER_HELP "Not supported on this platform."
|
||||||
|
#endif
|
||||||
|
|
||||||
// Higher-order macro containing all the feature info in one place. Define
|
// Higher-order macro containing all the feature info in one place. Define
|
||||||
// |MACRO| appropriately to extract the relevant parts. Note that the number
|
// |MACRO| appropriately to extract the relevant parts. Note that the number
|
||||||
// values are used internally only and so can be changed without consequence.
|
// values are used internally only and so can be changed without consequence.
|
||||||
|
|
@ -95,9 +114,7 @@
|
||||||
MACRO(21, "processcpu", ProcessCPU, \
|
MACRO(21, "processcpu", ProcessCPU, \
|
||||||
"Sample the CPU utilization of each process") \
|
"Sample the CPU utilization of each process") \
|
||||||
\
|
\
|
||||||
MACRO(22, "power", Power, \
|
MACRO(22, "power", Power, POWER_HELP)
|
||||||
"Sample energy meters on Windows 11 and per process power use on " \
|
|
||||||
"Apple Silicon")
|
|
||||||
// *** Synchronize with lists in BaseProfilerState.h and geckoProfiler.json ***
|
// *** Synchronize with lists in BaseProfilerState.h and geckoProfiler.json ***
|
||||||
|
|
||||||
struct ProfilerFeature {
|
struct ProfilerFeature {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue