63
63
#include " mozilla/ProfilerLabels.h"
64
64
#include " mozilla/ProfilerMarkers.h"
65
65
#include " mozilla/Telemetry.h"
66
+ #include " mozilla/glean/GleanMetrics.h"
66
67
#include " nsCOMPtr.h" // for already_AddRefed
67
68
#include " nsDebug.h" // for NS_ASSERTION, etc
68
69
#include " nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
@@ -1776,18 +1777,20 @@ int32_t RecordContentFrameTime(
1776
1777
ContentFrameMarker{});
1777
1778
}
1778
1779
1779
- Telemetry::Accumulate (Telemetry::CONTENT_FRAME_TIME, fracLatencyNorm);
1780
+ mozilla::glean::gfx_content_frame_time::from_paint.AccumulateSamples (
1781
+ {static_cast <unsigned long long >(fracLatencyNorm)});
1780
1782
1781
1783
if (!(aTxnId == VsyncId ()) && aVsyncStart) {
1782
1784
latencyMs = (aCompositeEnd - aVsyncStart).ToMilliseconds ();
1783
1785
latencyNorm = latencyMs / aVsyncRate.ToMilliseconds ();
1784
1786
fracLatencyNorm = lround (latencyNorm * 100.0 );
1785
1787
int32_t result = fracLatencyNorm;
1786
- Telemetry::Accumulate (Telemetry::CONTENT_FRAME_TIME_VSYNC, fracLatencyNorm);
1788
+ mozilla::glean::gfx_content_frame_time::from_vsync.AccumulateSamples (
1789
+ {static_cast <unsigned long long >(fracLatencyNorm)});
1787
1790
1788
1791
if (aContainsSVGGroup) {
1789
- Telemetry::Accumulate (Telemetry::CONTENT_FRAME_TIME_WITH_SVG,
1790
- fracLatencyNorm);
1792
+ mozilla::glean::gfx_content_frame_time::with_svg. AccumulateSamples (
1793
+ { static_cast < unsigned long long >( fracLatencyNorm)} );
1791
1794
}
1792
1795
1793
1796
// Record CONTENT_FRAME_TIME_REASON.
@@ -1819,35 +1822,63 @@ int32_t RecordContentFrameTime(
1819
1822
// Success
1820
1823
Telemetry::AccumulateCategorical (
1821
1824
LABELS_CONTENT_FRAME_TIME_REASON::OnTime);
1825
+ mozilla::glean::gfx_content_frame_time::reason
1826
+ .EnumGet (glean::gfx_content_frame_time::ReasonLabel::eOnTime)
1827
+ .Add ();
1822
1828
} else {
1823
1829
if (aCompositeId == VsyncId ()) {
1824
1830
// aCompositeId is 0, possibly something got trigged from
1825
1831
// outside vsync?
1826
1832
Telemetry::AccumulateCategorical (
1827
1833
LABELS_CONTENT_FRAME_TIME_REASON::NoVsyncNoId);
1834
+ mozilla::glean::gfx_content_frame_time::reason
1835
+ .EnumGet (glean::gfx_content_frame_time::ReasonLabel::eNoVsyncNoId)
1836
+ .Add ();
1828
1837
} else if (aTxnId >= aCompositeId) {
1829
1838
// Vsync ids are nonsensical, maybe we're trying to catch up?
1830
1839
Telemetry::AccumulateCategorical (
1831
1840
LABELS_CONTENT_FRAME_TIME_REASON::NoVsync);
1841
+ mozilla::glean::gfx_content_frame_time::reason
1842
+ .EnumGet (glean::gfx_content_frame_time::ReasonLabel::eNoVsync)
1843
+ .Add ();
1832
1844
} else if (aCompositeId - aTxnId > 1 ) {
1833
1845
// Composite started late (and maybe took too long as well)
1834
1846
if (aFullPaintTime >= TimeDuration::FromMilliseconds (20 )) {
1835
1847
Telemetry::AccumulateCategorical (
1836
1848
LABELS_CONTENT_FRAME_TIME_REASON::MissedCompositeLong);
1849
+ mozilla::glean::gfx_content_frame_time::reason
1850
+ .EnumGet (glean::gfx_content_frame_time::ReasonLabel::
1851
+ eMissedCompositeLong)
1852
+ .Add ();
1837
1853
} else if (aFullPaintTime >= TimeDuration::FromMilliseconds (10 )) {
1838
1854
Telemetry::AccumulateCategorical (
1839
1855
LABELS_CONTENT_FRAME_TIME_REASON::MissedCompositeMid);
1856
+ mozilla::glean::gfx_content_frame_time::reason
1857
+ .EnumGet (glean::gfx_content_frame_time::ReasonLabel::
1858
+ eMissedCompositeMid)
1859
+ .Add ();
1840
1860
} else if (aFullPaintTime >= TimeDuration::FromMilliseconds (5 )) {
1841
1861
Telemetry::AccumulateCategorical (
1842
1862
LABELS_CONTENT_FRAME_TIME_REASON::MissedCompositeLow);
1863
+ mozilla::glean::gfx_content_frame_time::reason
1864
+ .EnumGet (glean::gfx_content_frame_time::ReasonLabel::
1865
+ eMissedCompositeLow)
1866
+ .Add ();
1843
1867
} else {
1844
1868
Telemetry::AccumulateCategorical (
1845
1869
LABELS_CONTENT_FRAME_TIME_REASON::MissedComposite);
1870
+ mozilla::glean::gfx_content_frame_time::reason
1871
+ .EnumGet (
1872
+ glean::gfx_content_frame_time::ReasonLabel::eMissedComposite)
1873
+ .Add ();
1846
1874
}
1847
1875
} else {
1848
1876
// Composite started on time, but must have taken too long.
1849
1877
Telemetry::AccumulateCategorical (
1850
1878
LABELS_CONTENT_FRAME_TIME_REASON::SlowComposite);
1879
+ mozilla::glean::gfx_content_frame_time::reason
1880
+ .EnumGet (glean::gfx_content_frame_time::ReasonLabel::eSlowComposite)
1881
+ .Add ();
1851
1882
}
1852
1883
}
1853
1884
@@ -1857,17 +1888,18 @@ int32_t RecordContentFrameTime(
1857
1888
latencyNorm = latencyMs / aVsyncRate.ToMilliseconds ();
1858
1889
fracLatencyNorm = lround (latencyNorm * 100.0 );
1859
1890
}
1860
- Telemetry::Accumulate (
1861
- Telemetry::CONTENT_FRAME_TIME_WITHOUT_RESOURCE_UPLOAD,
1862
- fracLatencyNorm);
1891
+ mozilla::glean::gfx_content_frame_time::without_resource_upload
1892
+ . AccumulateSamples (
1893
+ { static_cast < unsigned long long >( fracLatencyNorm)} );
1863
1894
1864
1895
if (aStats) {
1865
1896
latencyMs -= (double (aStats->gpu_cache_upload_time ) / 1000000.0 );
1866
1897
latencyNorm = latencyMs / aVsyncRate.ToMilliseconds ();
1867
1898
fracLatencyNorm = lround (latencyNorm * 100.0 );
1868
1899
}
1869
- Telemetry::Accumulate (Telemetry::CONTENT_FRAME_TIME_WITHOUT_UPLOAD,
1870
- fracLatencyNorm);
1900
+ mozilla::glean::gfx_content_frame_time::without_resource_upload
1901
+ .AccumulateSamples (
1902
+ {static_cast <unsigned long long >(fracLatencyNorm)});
1871
1903
}
1872
1904
return result;
1873
1905
}
@@ -1962,9 +1994,8 @@ void RecordCompositionPayloadsPresented(
1962
1994
mozilla::Telemetry::KEYPRESS_PRESENT_LATENCY, payload.mTimeStamp ,
1963
1995
presented);
1964
1996
} else if (payload.mType == CompositionPayloadType::eAPZScroll) {
1965
- Telemetry::AccumulateTimeDelta (
1966
- mozilla::Telemetry::SCROLL_PRESENT_LATENCY, payload.mTimeStamp ,
1967
- presented);
1997
+ mozilla::glean::gfx::scroll_present_latency.AccumulateRawDuration (
1998
+ presented - payload.mTimeStamp );
1968
1999
} else if (payload.mType ==
1969
2000
CompositionPayloadType::eMouseUpFollowedByClick) {
1970
2001
Telemetry::AccumulateTimeDelta (
0 commit comments