Closed Bug 1224975 Opened 6 years ago Closed 6 years ago

add telemetry for web font loading

Categories

(Core :: Graphics: Text, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla45
Tracking Status
firefox45 --- fixed

People

(Reporter: jtd, Assigned: jtd)

Details

Attachments

(1 file)

I think it would be useful to add telemetry for web font loading.

Possible per font data:

- time load started after navigationStart
- total load time
- resource load time
- sanitize time
- activation time
- font size

Possible per document load data:

- number of fonts activated per page
- total size of all fonts activated
More precise list to add to Histograms.js:

WEBFONT_FONTFACE_PARSE_AFTER_START
WEBFONT_DOWNLOAD_TIME
WEBFONT_DOWNLOAD_TIME_AFTER_START
WEBFONT_SANITIZE_TIME
WEBFONT_ACTIVATE_TIME
WEBFONT_FONTTYPE
WEBFONT_PER_PAGE
WEBFONT_SIZE_PER_PAGE
WEBFONT_SIZE
Add telemetry reporting for various webfont loading statistics:

  WEBFONT_DOWNLOAD_TIME - time to download font resource
  WEBFONT_DOWNLOAD_TIME_AFTER_START - time from navStart to font load complete

  WEBFONT_FONTTYPE - font type woff/woff2/ttf
  WEBFONT_SRCTYPE - local/url/data url

  WEBFONT_SIZE - downloaded font resource size
  WEBFONT_COMPRESSION_WOFF - compressed / uncompressed font size in % for woff fonts
  WEBFONT_COMPRESSION_WOFF2 - compressed / uncompressed font size in % for woff2 fonts

  WEBFONT_PER_PAGE - number of fonts loaded on a page
  WEBFONT_SIZE_PER_PAGE - size in kb of all the fonts loaded on a page

In a couple places I also tweaked the userfont logging to add important information (e.g. when fonts are loaded from the userfont cache).
Attachment #8691760 - Flags: review?(m_kato)
Comment on attachment 8691760 [details] [diff] [review]
patch, add telemetry for webfont loading

Review of attachment 8691760 [details] [diff] [review]:
-----------------------------------------------------------------

::: layout/style/FontFaceSet.cpp
@@ +1753,5 @@
> +  }
> +
> +  TimeStamp navStart = mFontFaceSet->GetNavigationStartTimeStamp();
> +  Telemetry::AccumulateTimeDelta(Telemetry::WEBFONT_DOWNLOAD_TIME_AFTER_START,
> +                                 navStart, aDoneTime);

If navStart is 0 (it means that it cannot get nsDOMNavigationTiming), I think that we shouldn't add telemetry.  If it is infallible, no problem.
Attachment #8691760 - Flags: review?(m_kato) → review+
(In reply to Makoto Kato [:m_kato] from comment #3)

> > +  TimeStamp navStart = mFontFaceSet->GetNavigationStartTimeStamp();
> > +  Telemetry::AccumulateTimeDelta(Telemetry::WEBFONT_DOWNLOAD_TIME_AFTER_START,
> > +                                 navStart, aDoneTime);
> 
> If navStart is 0 (it means that it cannot get nsDOMNavigationTiming), I
> think that we shouldn't add telemetry.  If it is infallible, no problem.

Sounds fair, will do.
https://hg.mozilla.org/mozilla-central/rev/b88dbbba1287
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.