Skip to content

Commit

Permalink
Add support for ownContributionEstimate
Browse files Browse the repository at this point in the history
A percentage estimate for the contribution of the site to the global pressure
  • Loading branch information
kenchris committed Nov 15, 2024
1 parent f7f545a commit e56cc32
Showing 1 changed file with 36 additions and 3 deletions.
39 changes: 36 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -940,6 +940,7 @@ <h3>The <dfn>PressureRecord</dfn> interface</h3>
interface PressureRecord {
readonly attribute PressureSource source;
readonly attribute PressureState state;
readonly attribute double? ownContributionEstimate;
readonly attribute DOMHighResTimeStamp time;
[Default] object toJSON();
};
Expand All @@ -954,6 +955,19 @@ <h3>The <dfn>PressureRecord</dfn> interface</h3>
<li>
a <dfn>[[\State]]</dfn> value of type {{PressureState}}, which represents the current [=pressure state=].
</li>
<li>
<p>
an <dfn>[[\OwnContributionEstimate]]</dfn> value of type double?, which represents an estimated percentage
(value between 0 and 1) of the current web site contribution to the global pressure for the current source.
If the [=user agent=] cannot provide an estimate, the value will be null.
</p>
<p>
For CPU pressure, this will include the pressure of the CPU core responsible for loading and running the
web site, as well as any other associated CPU cores, in the case more than one are used. This can be the
case with web workers and shared processes e.g., a compositor or networking process, which some
[=user agents=] may use.
</p>
</li>
<li>
a <dfn>[[\Time]]</dfn> value of type {{DOMHighResTimeStamp}},
which corresponds to the
Expand All @@ -973,6 +987,12 @@ <h3>The <dfn>state</dfn> attribute</h3>
The {{PressureRecord/state}} [=getter steps=] are to return its {{PressureRecord/[[State]]}} internal slot.
</p>
</section>
<section>
<h3>The <dfn>ownContributionEstimate</dfn> attribute</h3>
<p>
The {{PressureRecord/ownContributionEstimate}} [=getter steps=] are to return its {{PressureRecord/[[OwnContributionEstimate]]}} internal slot.
</p>
</section>
<section>
<h3>The <dfn>time</dfn> attribute</h3>
<p>
Expand Down Expand Up @@ -1222,7 +1242,7 @@ <h3>Supporting algorithms</h3>
</li>
</ol>
The <dfn>has change in data</dfn> steps given the argument |observer:PressureObserver|, |source:PressureSource|,
|state:PressureState|, are as follows:
|state:PressureState|. |ownContributionEstimate:double?|, are as follows:
<ol>
<li>
If |observer|.{{PressureObserver/[[LastRecordMap]]}}[|source|] does not [=map/exist=], return true.
Expand All @@ -1233,6 +1253,9 @@ <h3>Supporting algorithms</h3>
<li>
If |record|.{{PressureRecord/[[State]]}} is not equal to |state|, return true.
</li>
<li>
If |record|.{{PressureRecord/[[OwnContributionEstimate]]}} is not equal to |ownContributionEstimate|, return true.
</li>
<li>
Return false.
</li>
Expand Down Expand Up @@ -1400,6 +1423,9 @@ <h3>Data Collection and Delivery</h3>
<li>
Let |state:PressureState| be null.
</li>
<li>
Let |ownContributionEstimate| be null.
</li>
<li>
If |pressureSource| is a [=virtual pressure source=]:
<ol>
Expand Down Expand Up @@ -1427,6 +1453,12 @@ <h3>Data Collection and Delivery</h3>
</p>
</aside>
</li>
<li>
If the [=user agent=] can calculate an |estimation| of the current site's
contribution to the overall pressure in an [=implementation-defined=] manner,
given |sample|'s [=pressure source sample/data=], then set |ownContributionEstimate|
to that |estimation|. The |estimation| should be in the range [0...1].
</li>
</ol>
</li>
<li>
Expand All @@ -1453,13 +1485,14 @@ <h3>Data Collection and Delivery</h3>
returns false, [=iteration/continue=].
</li>
<li>
If running [=has change in data=] with |observer|, |source| and |state|
If running [=has change in data=] with |observer|, |source|, |state| and |ownContributionEstimate|
returns false, [=iteration/continue=].
</li>
<li>
Let |record:PressureRecord| be a new {{PressureRecord}} object with its
{{PressureRecord/[[Source]]}} set to |source|,
{{PressureRecord/[[State]]}} set to |state|
{{PressureRecord/[[State]]}} set to |state|,
{{PressureRecord/[[OwnContributionEstimate]]}} set to |ownContributionEstimate|
and {{PressureRecord/[[Time]]}} set to |timeValue|.
</li>
<li>
Expand Down

0 comments on commit e56cc32

Please sign in to comment.