mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
changed f64 to u64 for navigation start timing until it had to be float
This commit is contained in:
parent
b23131abf1
commit
0a09ee5cd8
13 changed files with 66 additions and 66 deletions
|
@ -1311,7 +1311,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
||||||
// we get the current time, inform the layout thread about it and remove the
|
// we get the current time, inform the layout thread about it and remove the
|
||||||
// pending metric from the list.
|
// pending metric from the list.
|
||||||
if !self.pending_paint_metrics.is_empty() {
|
if !self.pending_paint_metrics.is_empty() {
|
||||||
let paint_time = precise_time_ns() as f64;
|
let paint_time = precise_time_ns();
|
||||||
let mut to_remove = Vec::new();
|
let mut to_remove = Vec::new();
|
||||||
// For each pending paint metrics pipeline id
|
// For each pending paint metrics pipeline id
|
||||||
for (id, pending_epoch) in &self.pending_paint_metrics {
|
for (id, pending_epoch) in &self.pending_paint_metrics {
|
||||||
|
|
|
@ -34,10 +34,10 @@ pub trait ProfilerMetadataFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait ProgressiveWebMetric {
|
pub trait ProgressiveWebMetric {
|
||||||
fn get_navigation_start(&self) -> Option<f64>;
|
fn get_navigation_start(&self) -> Option<u64>;
|
||||||
fn set_navigation_start(&mut self, time: f64);
|
fn set_navigation_start(&mut self, time: u64);
|
||||||
fn get_time_profiler_chan(&self) -> &ProfilerChan;
|
fn get_time_profiler_chan(&self) -> &ProfilerChan;
|
||||||
fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: f64);
|
fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: u64);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// maximum task time is 50ms (in ns)
|
/// maximum task time is 50ms (in ns)
|
||||||
|
@ -51,8 +51,8 @@ fn set_metric<U: ProgressiveWebMetric>(
|
||||||
metadata: Option<TimerMetadata>,
|
metadata: Option<TimerMetadata>,
|
||||||
metric_type: ProgressiveWebMetricType,
|
metric_type: ProgressiveWebMetricType,
|
||||||
category: ProfilerCategory,
|
category: ProfilerCategory,
|
||||||
attr: &Cell<Option<f64>>,
|
attr: &Cell<Option<u64>>,
|
||||||
metric_time: Option<f64>)
|
metric_time: Option<u64>)
|
||||||
{
|
{
|
||||||
let navigation_start = match pwm.get_navigation_start() {
|
let navigation_start = match pwm.get_navigation_start() {
|
||||||
Some(time) => time,
|
Some(time) => time,
|
||||||
|
@ -63,7 +63,7 @@ fn set_metric<U: ProgressiveWebMetric>(
|
||||||
};
|
};
|
||||||
let now = match metric_time {
|
let now = match metric_time {
|
||||||
Some(time) => time,
|
Some(time) => time,
|
||||||
None => precise_time_ns() as f64,
|
None => precise_time_ns(),
|
||||||
};
|
};
|
||||||
let time = now - navigation_start;
|
let time = now - navigation_start;
|
||||||
attr.set(Some(time));
|
attr.set(Some(time));
|
||||||
|
@ -76,8 +76,8 @@ fn set_metric<U: ProgressiveWebMetric>(
|
||||||
category,
|
category,
|
||||||
metadata,
|
metadata,
|
||||||
&pwm.get_time_profiler_chan(),
|
&pwm.get_time_profiler_chan(),
|
||||||
time as u64,
|
time,
|
||||||
time as u64,
|
time,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
|
@ -97,13 +97,13 @@ fn set_metric<U: ProgressiveWebMetric>(
|
||||||
#[derive(MallocSizeOf)]
|
#[derive(MallocSizeOf)]
|
||||||
pub struct InteractiveMetrics {
|
pub struct InteractiveMetrics {
|
||||||
/// when we navigated to the page
|
/// when we navigated to the page
|
||||||
navigation_start: Option<f64>,
|
navigation_start: Option<u64>,
|
||||||
/// indicates if the page is visually ready
|
/// indicates if the page is visually ready
|
||||||
dom_content_loaded: Cell<Option<f64>>,
|
dom_content_loaded: Cell<Option<u64>>,
|
||||||
/// main thread is available -- there's been a 10s window with no tasks longer than 50ms
|
/// main thread is available -- there's been a 10s window with no tasks longer than 50ms
|
||||||
main_thread_available: Cell<Option<f64>>,
|
main_thread_available: Cell<Option<u64>>,
|
||||||
// max(main_thread_available, dom_content_loaded)
|
// max(main_thread_available, dom_content_loaded)
|
||||||
time_to_interactive: Cell<Option<f64>>,
|
time_to_interactive: Cell<Option<u64>>,
|
||||||
#[ignore_malloc_size_of = "can't measure channels"]
|
#[ignore_malloc_size_of = "can't measure channels"]
|
||||||
time_profiler_chan: ProfilerChan,
|
time_profiler_chan: ProfilerChan,
|
||||||
}
|
}
|
||||||
|
@ -142,7 +142,7 @@ impl InteractiveWindow {
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum InteractiveFlag {
|
pub enum InteractiveFlag {
|
||||||
DOMContentLoaded,
|
DOMContentLoaded,
|
||||||
TimeToInteractive(f64),
|
TimeToInteractive(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InteractiveMetrics {
|
impl InteractiveMetrics {
|
||||||
|
@ -158,21 +158,21 @@ impl InteractiveMetrics {
|
||||||
|
|
||||||
pub fn set_dom_content_loaded(&self) {
|
pub fn set_dom_content_loaded(&self) {
|
||||||
if self.dom_content_loaded.get().is_none() {
|
if self.dom_content_loaded.get().is_none() {
|
||||||
self.dom_content_loaded.set(Some(precise_time_ns() as f64));
|
self.dom_content_loaded.set(Some(precise_time_ns()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_main_thread_available(&self, time: f64) {
|
pub fn set_main_thread_available(&self, time: u64) {
|
||||||
if self.main_thread_available.get().is_none() {
|
if self.main_thread_available.get().is_none() {
|
||||||
self.main_thread_available.set(Some(time));
|
self.main_thread_available.set(Some(time));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_dom_content_loaded(&self) -> Option<f64> {
|
pub fn get_dom_content_loaded(&self) -> Option<u64> {
|
||||||
self.dom_content_loaded.get()
|
self.dom_content_loaded.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_main_thread_available(&self) -> Option<f64> {
|
pub fn get_main_thread_available(&self) -> Option<u64> {
|
||||||
self.main_thread_available.get()
|
self.main_thread_available.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,21 +213,21 @@ impl InteractiveMetrics {
|
||||||
Some(metric_time));
|
Some(metric_time));
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_tti(&self) -> Option<f64> {
|
pub fn get_tti(&self) -> Option<u64> {
|
||||||
self.time_to_interactive.get()
|
self.time_to_interactive.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProgressiveWebMetric for InteractiveMetrics {
|
impl ProgressiveWebMetric for InteractiveMetrics {
|
||||||
fn get_navigation_start(&self) -> Option<f64> {
|
fn get_navigation_start(&self) -> Option<u64> {
|
||||||
self.navigation_start
|
self.navigation_start
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_navigation_start(&mut self, time: f64) {
|
fn set_navigation_start(&mut self, time: u64) {
|
||||||
self.navigation_start = Some(time);
|
self.navigation_start = Some(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_queued_constellation_msg(&self, _name: ProgressiveWebMetricType, _time: f64) { }
|
fn send_queued_constellation_msg(&self, _name: ProgressiveWebMetricType, _time: u64) { }
|
||||||
|
|
||||||
fn get_time_profiler_chan(&self) -> &ProfilerChan {
|
fn get_time_profiler_chan(&self) -> &ProfilerChan {
|
||||||
&self.time_profiler_chan
|
&self.time_profiler_chan
|
||||||
|
@ -236,9 +236,9 @@ impl ProgressiveWebMetric for InteractiveMetrics {
|
||||||
|
|
||||||
pub struct PaintTimeMetrics {
|
pub struct PaintTimeMetrics {
|
||||||
pending_metrics: RefCell<HashMap<Epoch, (Option<TimerMetadata>, bool)>>,
|
pending_metrics: RefCell<HashMap<Epoch, (Option<TimerMetadata>, bool)>>,
|
||||||
navigation_start: Option<f64>,
|
navigation_start: Option<u64>,
|
||||||
first_paint: Cell<Option<f64>>,
|
first_paint: Cell<Option<u64>>,
|
||||||
first_contentful_paint: Cell<Option<f64>>,
|
first_contentful_paint: Cell<Option<u64>>,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
time_profiler_chan: ProfilerChan,
|
time_profiler_chan: ProfilerChan,
|
||||||
constellation_chan: IpcSender<LayoutMsg>,
|
constellation_chan: IpcSender<LayoutMsg>,
|
||||||
|
@ -322,7 +322,7 @@ impl PaintTimeMetrics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn maybe_set_metric(&self, epoch: Epoch, paint_time: f64) {
|
pub fn maybe_set_metric(&self, epoch: Epoch, paint_time: u64) {
|
||||||
if self.first_paint.get().is_some() && self.first_contentful_paint.get().is_some() ||
|
if self.first_paint.get().is_some() && self.first_contentful_paint.get().is_some() ||
|
||||||
self.navigation_start.is_none() {
|
self.navigation_start.is_none() {
|
||||||
// If we already set all paint metrics or we have not set navigation start yet,
|
// If we already set all paint metrics or we have not set navigation start yet,
|
||||||
|
@ -354,25 +354,25 @@ impl PaintTimeMetrics {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_first_paint(&self) -> Option<f64> {
|
pub fn get_first_paint(&self) -> Option<u64> {
|
||||||
self.first_paint.get()
|
self.first_paint.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_first_contentful_paint(&self) -> Option<f64> {
|
pub fn get_first_contentful_paint(&self) -> Option<u64> {
|
||||||
self.first_contentful_paint.get()
|
self.first_contentful_paint.get()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProgressiveWebMetric for PaintTimeMetrics {
|
impl ProgressiveWebMetric for PaintTimeMetrics {
|
||||||
fn get_navigation_start(&self) -> Option<f64> {
|
fn get_navigation_start(&self) -> Option<u64> {
|
||||||
self.navigation_start
|
self.navigation_start
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_navigation_start(&mut self, time: f64) {
|
fn set_navigation_start(&mut self, time: u64) {
|
||||||
self.navigation_start = Some(time);
|
self.navigation_start = Some(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: f64) {
|
fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: u64) {
|
||||||
let msg = ConstellationControlMsg::PaintMetric(self.pipeline_id, name, time);
|
let msg = ConstellationControlMsg::PaintMetric(self.pipeline_id, name, time);
|
||||||
if let Err(e) = self.script_chan.send(msg) {
|
if let Err(e) = self.script_chan.send(msg) {
|
||||||
warn!("Sending metric to script thread failed ({}).", e);
|
warn!("Sending metric to script thread failed ({}).", e);
|
||||||
|
|
|
@ -1961,7 +1961,7 @@ impl Document {
|
||||||
|
|
||||||
if self.tti_window.borrow().needs_check() {
|
if self.tti_window.borrow().needs_check() {
|
||||||
self.get_interactive_metrics().maybe_set_tti(self,
|
self.get_interactive_metrics().maybe_set_tti(self,
|
||||||
InteractiveFlag::TimeToInteractive(self.tti_window.borrow().get_start() as f64));
|
InteractiveFlag::TimeToInteractive(self.tti_window.borrow().get_start()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -114,13 +114,13 @@ pub struct Performance {
|
||||||
entries: DomRefCell<PerformanceEntryList>,
|
entries: DomRefCell<PerformanceEntryList>,
|
||||||
observers: DomRefCell<Vec<PerformanceObserver>>,
|
observers: DomRefCell<Vec<PerformanceObserver>>,
|
||||||
pending_notification_observers_task: Cell<bool>,
|
pending_notification_observers_task: Cell<bool>,
|
||||||
navigation_start_precise: f64,
|
navigation_start_precise: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Performance {
|
impl Performance {
|
||||||
fn new_inherited(global: &GlobalScope,
|
fn new_inherited(global: &GlobalScope,
|
||||||
navigation_start: u64,
|
navigation_start: u64,
|
||||||
navigation_start_precise: f64) -> Performance {
|
navigation_start_precise: u64) -> Performance {
|
||||||
Performance {
|
Performance {
|
||||||
reflector_: Reflector::new(),
|
reflector_: Reflector::new(),
|
||||||
timing: if global.is::<Window>() {
|
timing: if global.is::<Window>() {
|
||||||
|
@ -139,7 +139,7 @@ impl Performance {
|
||||||
|
|
||||||
pub fn new(global: &GlobalScope,
|
pub fn new(global: &GlobalScope,
|
||||||
navigation_start: u64,
|
navigation_start: u64,
|
||||||
navigation_start_precise: f64) -> DomRoot<Performance> {
|
navigation_start_precise: u64) -> DomRoot<Performance> {
|
||||||
reflect_dom_object(
|
reflect_dom_object(
|
||||||
Box::new(Performance::new_inherited(global, navigation_start, navigation_start_precise)),
|
Box::new(Performance::new_inherited(global, navigation_start, navigation_start_precise)),
|
||||||
global,
|
global,
|
||||||
|
@ -260,7 +260,7 @@ impl Performance {
|
||||||
Some(ref timing) => timing.navigation_start_precise(),
|
Some(ref timing) => timing.navigation_start_precise(),
|
||||||
None => self.navigation_start_precise,
|
None => self.navigation_start_precise,
|
||||||
};
|
};
|
||||||
(time::precise_time_ns() as f64 - nav_start) / 1000000 as f64
|
(time::precise_time_ns() - nav_start) as f64 / 1000000.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub struct PerformancePaintTiming {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PerformancePaintTiming {
|
impl PerformancePaintTiming {
|
||||||
fn new_inherited(metric_type: ProgressiveWebMetricType, start_time: f64) -> PerformancePaintTiming {
|
fn new_inherited(metric_type: ProgressiveWebMetricType, start_time: u64) -> PerformancePaintTiming {
|
||||||
let name = match metric_type {
|
let name = match metric_type {
|
||||||
ProgressiveWebMetricType::FirstPaint => DOMString::from("first-paint"),
|
ProgressiveWebMetricType::FirstPaint => DOMString::from("first-paint"),
|
||||||
ProgressiveWebMetricType::FirstContentfulPaint => DOMString::from("first-contentful-paint"),
|
ProgressiveWebMetricType::FirstContentfulPaint => DOMString::from("first-contentful-paint"),
|
||||||
|
@ -26,7 +26,7 @@ impl PerformancePaintTiming {
|
||||||
PerformancePaintTiming {
|
PerformancePaintTiming {
|
||||||
entry: PerformanceEntry::new_inherited(name,
|
entry: PerformanceEntry::new_inherited(name,
|
||||||
DOMString::from("paint"),
|
DOMString::from("paint"),
|
||||||
start_time,
|
start_time as f64,
|
||||||
0.)
|
0.)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ impl PerformancePaintTiming {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(global: &GlobalScope,
|
pub fn new(global: &GlobalScope,
|
||||||
metric_type: ProgressiveWebMetricType,
|
metric_type: ProgressiveWebMetricType,
|
||||||
start_time: f64) -> DomRoot<PerformancePaintTiming> {
|
start_time: u64) -> DomRoot<PerformancePaintTiming> {
|
||||||
let entry = PerformancePaintTiming::new_inherited(metric_type, start_time);
|
let entry = PerformancePaintTiming::new_inherited(metric_type, start_time);
|
||||||
reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap)
|
reflect_dom_object(Box::new(entry), global, PerformancePaintTimingBinding::Wrap)
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,13 +15,13 @@ use dom_struct::dom_struct;
|
||||||
pub struct PerformanceTiming {
|
pub struct PerformanceTiming {
|
||||||
reflector_: Reflector,
|
reflector_: Reflector,
|
||||||
navigation_start: u64,
|
navigation_start: u64,
|
||||||
navigation_start_precise: f64,
|
navigation_start_precise: u64,
|
||||||
document: Dom<Document>,
|
document: Dom<Document>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PerformanceTiming {
|
impl PerformanceTiming {
|
||||||
fn new_inherited(nav_start: u64,
|
fn new_inherited(nav_start: u64,
|
||||||
nav_start_precise: f64,
|
nav_start_precise: u64,
|
||||||
document: &Document)
|
document: &Document)
|
||||||
-> PerformanceTiming {
|
-> PerformanceTiming {
|
||||||
PerformanceTiming {
|
PerformanceTiming {
|
||||||
|
@ -35,7 +35,7 @@ impl PerformanceTiming {
|
||||||
#[allow(unrooted_must_root)]
|
#[allow(unrooted_must_root)]
|
||||||
pub fn new(window: &Window,
|
pub fn new(window: &Window,
|
||||||
navigation_start: u64,
|
navigation_start: u64,
|
||||||
navigation_start_precise: f64)
|
navigation_start_precise: u64)
|
||||||
-> DomRoot<PerformanceTiming> {
|
-> DomRoot<PerformanceTiming> {
|
||||||
let timing = PerformanceTiming::new_inherited(navigation_start,
|
let timing = PerformanceTiming::new_inherited(navigation_start,
|
||||||
navigation_start_precise,
|
navigation_start_precise,
|
||||||
|
@ -90,7 +90,7 @@ impl PerformanceTimingMethods for PerformanceTiming {
|
||||||
|
|
||||||
|
|
||||||
impl PerformanceTiming {
|
impl PerformanceTiming {
|
||||||
pub fn navigation_start_precise(&self) -> f64 {
|
pub fn navigation_start_precise(&self) -> u64 {
|
||||||
self.navigation_start_precise
|
self.navigation_start_precise
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,7 @@ pub struct Window {
|
||||||
custom_element_registry: MutNullableDom<CustomElementRegistry>,
|
custom_element_registry: MutNullableDom<CustomElementRegistry>,
|
||||||
performance: MutNullableDom<Performance>,
|
performance: MutNullableDom<Performance>,
|
||||||
navigation_start: Cell<u64>,
|
navigation_start: Cell<u64>,
|
||||||
navigation_start_precise: Cell<f64>,
|
navigation_start_precise: Cell<u64>,
|
||||||
screen: MutNullableDom<Screen>,
|
screen: MutNullableDom<Screen>,
|
||||||
session_storage: MutNullableDom<Storage>,
|
session_storage: MutNullableDom<Storage>,
|
||||||
local_storage: MutNullableDom<Storage>,
|
local_storage: MutNullableDom<Storage>,
|
||||||
|
@ -1045,7 +1045,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_navigation_start(&self) -> f64 {
|
pub fn get_navigation_start(&self) -> u64 {
|
||||||
self.navigation_start_precise.get()
|
self.navigation_start_precise.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1734,7 +1734,7 @@ impl Window {
|
||||||
let current_time = time::get_time();
|
let current_time = time::get_time();
|
||||||
let now = (current_time.sec * 1000 + current_time.nsec as i64 / 1000000) as u64;
|
let now = (current_time.sec * 1000 + current_time.nsec as i64 / 1000000) as u64;
|
||||||
self.navigation_start.set(now);
|
self.navigation_start.set(now);
|
||||||
self.navigation_start_precise.set(time::precise_time_ns() as f64);
|
self.navigation_start_precise.set(time::precise_time_ns());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn send_to_constellation(&self, msg: ScriptMsg) {
|
fn send_to_constellation(&self, msg: ScriptMsg) {
|
||||||
|
@ -1777,7 +1777,7 @@ impl Window {
|
||||||
window_size: Option<WindowSizeData>,
|
window_size: Option<WindowSizeData>,
|
||||||
origin: MutableOrigin,
|
origin: MutableOrigin,
|
||||||
navigation_start: u64,
|
navigation_start: u64,
|
||||||
navigation_start_precise: f64,
|
navigation_start_precise: u64,
|
||||||
webgl_chan: WebGLChan,
|
webgl_chan: WebGLChan,
|
||||||
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
webvr_chan: Option<IpcSender<WebVRMsg>>,
|
||||||
microtask_queue: Rc<MicrotaskQueue>,
|
microtask_queue: Rc<MicrotaskQueue>,
|
||||||
|
|
|
@ -90,7 +90,7 @@ pub struct WorkerGlobalScope {
|
||||||
/// `IpcSender` doesn't exist
|
/// `IpcSender` doesn't exist
|
||||||
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
|
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
|
||||||
|
|
||||||
navigation_start_precise: f64,
|
navigation_start_precise: u64,
|
||||||
performance: MutNullableDom<Performance>,
|
performance: MutNullableDom<Performance>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ impl WorkerGlobalScope {
|
||||||
navigator: Default::default(),
|
navigator: Default::default(),
|
||||||
from_devtools_sender: init.from_devtools_sender,
|
from_devtools_sender: init.from_devtools_sender,
|
||||||
from_devtools_receiver,
|
from_devtools_receiver,
|
||||||
navigation_start_precise: precise_time_ns() as f64,
|
navigation_start_precise: precise_time_ns(),
|
||||||
performance: Default::default(),
|
performance: Default::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ struct InProgressLoad {
|
||||||
/// Timestamp reporting the time when the browser started this load.
|
/// Timestamp reporting the time when the browser started this load.
|
||||||
navigation_start: u64,
|
navigation_start: u64,
|
||||||
/// High res timestamp reporting the time when the browser started this load.
|
/// High res timestamp reporting the time when the browser started this load.
|
||||||
navigation_start_precise: f64,
|
navigation_start_precise: u64,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl InProgressLoad {
|
impl InProgressLoad {
|
||||||
|
@ -183,7 +183,7 @@ impl InProgressLoad {
|
||||||
url: ServoUrl,
|
url: ServoUrl,
|
||||||
origin: MutableOrigin) -> InProgressLoad {
|
origin: MutableOrigin) -> InProgressLoad {
|
||||||
let current_time = get_time();
|
let current_time = get_time();
|
||||||
let navigation_start_precise = precise_time_ns() as f64;
|
let navigation_start_precise = precise_time_ns();
|
||||||
layout_chan.send(message::Msg::SetNavigationStart(navigation_start_precise)).unwrap();
|
layout_chan.send(message::Msg::SetNavigationStart(navigation_start_precise)).unwrap();
|
||||||
InProgressLoad {
|
InProgressLoad {
|
||||||
pipeline_id: id,
|
pipeline_id: id,
|
||||||
|
@ -2655,7 +2655,7 @@ impl ScriptThread {
|
||||||
fn handle_paint_metric(&self,
|
fn handle_paint_metric(&self,
|
||||||
pipeline_id: PipelineId,
|
pipeline_id: PipelineId,
|
||||||
metric_type: ProgressiveWebMetricType,
|
metric_type: ProgressiveWebMetricType,
|
||||||
metric_value: f64) {
|
metric_value: u64) {
|
||||||
let window = self.documents.borrow().find_window(pipeline_id);
|
let window = self.documents.borrow().find_window(pipeline_id);
|
||||||
if let Some(window) = window {
|
if let Some(window) = window {
|
||||||
let entry = PerformancePaintTiming::new(&window.upcast::<GlobalScope>(),
|
let entry = PerformancePaintTiming::new(&window.upcast::<GlobalScope>(),
|
||||||
|
|
|
@ -97,7 +97,7 @@ pub enum Msg {
|
||||||
RegisterPaint(Atom, Vec<Atom>, Box<Painter>),
|
RegisterPaint(Atom, Vec<Atom>, Box<Painter>),
|
||||||
|
|
||||||
/// Send to layout the precise time when the navigation started.
|
/// Send to layout the precise time when the navigation started.
|
||||||
SetNavigationStart(f64),
|
SetNavigationStart(u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
#[derive(Debug, PartialEq)]
|
||||||
|
|
|
@ -122,7 +122,7 @@ pub enum LayoutControlMsg {
|
||||||
/// and `false` is returned if all fonts have loaded.
|
/// and `false` is returned if all fonts have loaded.
|
||||||
GetWebFontLoadState(IpcSender<bool>),
|
GetWebFontLoadState(IpcSender<bool>),
|
||||||
/// Send the paint time for a specific epoch to the layout thread.
|
/// Send the paint time for a specific epoch to the layout thread.
|
||||||
PaintMetric(Epoch, f64),
|
PaintMetric(Epoch, u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// can be passed to `LoadUrl` to load a page with GET/POST
|
/// can be passed to `LoadUrl` to load a page with GET/POST
|
||||||
|
@ -324,7 +324,7 @@ pub enum ConstellationControlMsg {
|
||||||
/// Notifies the script thread of WebVR events.
|
/// Notifies the script thread of WebVR events.
|
||||||
WebVREvents(PipelineId, Vec<WebVREvent>),
|
WebVREvents(PipelineId, Vec<WebVREvent>),
|
||||||
/// Notifies the script thread about a new recorded paint metric.
|
/// Notifies the script thread about a new recorded paint metric.
|
||||||
PaintMetric(PipelineId, ProgressiveWebMetricType, f64),
|
PaintMetric(PipelineId, ProgressiveWebMetricType, u64),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Debug for ConstellationControlMsg {
|
impl fmt::Debug for ConstellationControlMsg {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use ipc_channel::ipc;
|
use ipc_channel::ipc;
|
||||||
use metrics::{InteractiveMetrics, InteractiveFlag, InteractiveWindow};
|
use metrics::{InteractiveMetrics, InteractiveFlag};
|
||||||
use metrics::{ProfilerMetadataFactory, ProgressiveWebMetric};
|
use metrics::{ProfilerMetadataFactory, ProgressiveWebMetric};
|
||||||
use profile_traits::time::{ProfilerChan, TimerMetadata};
|
use profile_traits::time::{ProfilerChan, TimerMetadata};
|
||||||
use time;
|
use time;
|
||||||
|
@ -24,7 +24,7 @@ fn test_interactive() -> InteractiveMetrics {
|
||||||
assert_eq!((&interactive).get_navigation_start(), None);
|
assert_eq!((&interactive).get_navigation_start(), None);
|
||||||
assert_eq!(interactive.get_tti(), None);
|
assert_eq!(interactive.get_tti(), None);
|
||||||
|
|
||||||
interactive.set_navigation_start(time::precise_time_ns() as f64);
|
interactive.set_navigation_start(time::precise_time_ns());
|
||||||
|
|
||||||
interactive
|
interactive
|
||||||
}
|
}
|
||||||
|
@ -52,16 +52,16 @@ fn test_set_mta() {
|
||||||
let t = time::precise_time_ns();
|
let t = time::precise_time_ns();
|
||||||
interactive.maybe_set_tti(
|
interactive.maybe_set_tti(
|
||||||
&profiler_metadata_factory,
|
&profiler_metadata_factory,
|
||||||
InteractiveFlag::TimeToInteractive(t as f64),
|
InteractiveFlag::TimeToInteractive(t),
|
||||||
);
|
);
|
||||||
let mta = interactive.get_main_thread_available();
|
let mta = interactive.get_main_thread_available();
|
||||||
assert!(mta.is_some());
|
assert!(mta.is_some());
|
||||||
assert_eq!(mta, Some(t as f64));
|
assert_eq!(mta, Some(t));
|
||||||
|
|
||||||
//try to overwrite
|
//try to overwrite
|
||||||
interactive.maybe_set_tti(
|
interactive.maybe_set_tti(
|
||||||
&profiler_metadata_factory,
|
&profiler_metadata_factory,
|
||||||
InteractiveFlag::TimeToInteractive(time::precise_time_ns() as f64),
|
InteractiveFlag::TimeToInteractive(time::precise_time_ns()),
|
||||||
);
|
);
|
||||||
assert_eq!(interactive.get_main_thread_available(), mta);
|
assert_eq!(interactive.get_main_thread_available(), mta);
|
||||||
assert_eq!(interactive.get_tti(), None);
|
assert_eq!(interactive.get_tti(), None);
|
||||||
|
@ -75,7 +75,7 @@ fn test_set_tti_dcl() {
|
||||||
let t = time::precise_time_ns();
|
let t = time::precise_time_ns();
|
||||||
interactive.maybe_set_tti(
|
interactive.maybe_set_tti(
|
||||||
&profiler_metadata_factory,
|
&profiler_metadata_factory,
|
||||||
InteractiveFlag::TimeToInteractive(t as f64),
|
InteractiveFlag::TimeToInteractive(t),
|
||||||
);
|
);
|
||||||
let mta = interactive.get_main_thread_available();
|
let mta = interactive.get_main_thread_available();
|
||||||
assert!(mta.is_some());
|
assert!(mta.is_some());
|
||||||
|
@ -100,7 +100,7 @@ fn test_set_tti_mta() {
|
||||||
let t = time::precise_time_ns();
|
let t = time::precise_time_ns();
|
||||||
interactive.maybe_set_tti(
|
interactive.maybe_set_tti(
|
||||||
&profiler_metadata_factory,
|
&profiler_metadata_factory,
|
||||||
InteractiveFlag::TimeToInteractive(t as f64),
|
InteractiveFlag::TimeToInteractive(t),
|
||||||
);
|
);
|
||||||
let mta = interactive.get_main_thread_available();
|
let mta = interactive.get_main_thread_available();
|
||||||
assert!(mta.is_some());
|
assert!(mta.is_some());
|
||||||
|
|
|
@ -70,7 +70,7 @@ fn test_common(display_list: &DisplayList, epoch: Epoch) -> PaintTimeMetrics {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Should not set any metric until navigation start is set.
|
// Should not set any metric until navigation start is set.
|
||||||
paint_time_metrics.maybe_set_metric(epoch, 0.);
|
paint_time_metrics.maybe_set_metric(epoch, 0);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
paint_time_metrics.get_first_paint(),
|
paint_time_metrics.get_first_paint(),
|
||||||
None,
|
None,
|
||||||
|
@ -82,7 +82,7 @@ fn test_common(display_list: &DisplayList, epoch: Epoch) -> PaintTimeMetrics {
|
||||||
"first contentful paint is None"
|
"first contentful paint is None"
|
||||||
);
|
);
|
||||||
|
|
||||||
let navigation_start = time::precise_time_ns() as f64;
|
let navigation_start = time::precise_time_ns();
|
||||||
paint_time_metrics.set_navigation_start(navigation_start);
|
paint_time_metrics.set_navigation_start(navigation_start);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
(&paint_time_metrics).get_navigation_start().unwrap(),
|
(&paint_time_metrics).get_navigation_start().unwrap(),
|
||||||
|
@ -101,7 +101,7 @@ fn test_first_paint_setter() {
|
||||||
};
|
};
|
||||||
let epoch = Epoch(0);
|
let epoch = Epoch(0);
|
||||||
let paint_time_metrics = test_common(&empty_display_list, epoch);
|
let paint_time_metrics = test_common(&empty_display_list, epoch);
|
||||||
let now = time::precise_time_ns() as f64;
|
let now = time::precise_time_ns();
|
||||||
paint_time_metrics.maybe_set_metric(epoch, now);
|
paint_time_metrics.maybe_set_metric(epoch, now);
|
||||||
assert!(
|
assert!(
|
||||||
paint_time_metrics.get_first_paint().is_some(),
|
paint_time_metrics.get_first_paint().is_some(),
|
||||||
|
@ -135,7 +135,7 @@ fn test_first_contentful_paint_setter() {
|
||||||
};
|
};
|
||||||
let epoch = Epoch(0);
|
let epoch = Epoch(0);
|
||||||
let paint_time_metrics = test_common(&display_list, epoch);
|
let paint_time_metrics = test_common(&display_list, epoch);
|
||||||
let now = time::precise_time_ns() as f64;
|
let now = time::precise_time_ns();
|
||||||
paint_time_metrics.maybe_set_metric(epoch, now);
|
paint_time_metrics.maybe_set_metric(epoch, now);
|
||||||
assert!(
|
assert!(
|
||||||
paint_time_metrics.get_first_contentful_paint().is_some(),
|
paint_time_metrics.get_first_contentful_paint().is_some(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue