mirror of
https://github.com/servo/servo.git
synced 2025-07-08 07:53:40 +01:00
Auto merge of #19516 - ferjm:pwm.url, r=jdm
Print url of recorded PWM This makes it a bit easier to compare results with other browsers. - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19516) <!-- Reviewable:end -->
This commit is contained in:
commit
c4482ebe77
10 changed files with 45 additions and 9 deletions
|
@ -489,7 +489,8 @@ impl UnprivilegedPipelineContent {
|
|||
let paint_time_metrics = PaintTimeMetrics::new(self.id,
|
||||
self.time_profiler_chan.clone(),
|
||||
self.layout_to_constellation_chan.clone(),
|
||||
self.script_chan.clone());
|
||||
self.script_chan.clone(),
|
||||
self.load_data.url.clone());
|
||||
let layout_pair = STF::create(InitialScriptState {
|
||||
id: self.id,
|
||||
browsing_context_id: self.browsing_context_id,
|
||||
|
|
|
@ -20,4 +20,5 @@ msg = {path = "../msg"}
|
|||
profile_traits = {path = "../profile_traits"}
|
||||
script_traits = {path = "../script_traits"}
|
||||
servo_config = {path = "../config"}
|
||||
servo_url = {path = "../url"}
|
||||
time = "0.1"
|
||||
|
|
|
@ -14,6 +14,7 @@ extern crate msg;
|
|||
extern crate profile_traits;
|
||||
extern crate script_traits;
|
||||
extern crate servo_config;
|
||||
extern crate servo_url;
|
||||
extern crate time;
|
||||
|
||||
use gfx::display_list::{DisplayItem, DisplayList};
|
||||
|
@ -24,6 +25,7 @@ use profile_traits::time::{ProfilerChan, ProfilerCategory, send_profile_data};
|
|||
use profile_traits::time::TimerMetadata;
|
||||
use script_traits::{ConstellationControlMsg, LayoutMsg, ProgressiveWebMetricType};
|
||||
use servo_config::opts;
|
||||
use servo_url::ServoUrl;
|
||||
use std::cell::{Cell, RefCell};
|
||||
use std::cmp::Ordering;
|
||||
use std::collections::HashMap;
|
||||
|
@ -38,6 +40,7 @@ pub trait ProgressiveWebMetric {
|
|||
fn set_navigation_start(&mut self, time: u64);
|
||||
fn get_time_profiler_chan(&self) -> &ProfilerChan;
|
||||
fn send_queued_constellation_msg(&self, name: ProgressiveWebMetricType, time: u64);
|
||||
fn get_url(&self) -> &ServoUrl;
|
||||
}
|
||||
|
||||
/// TODO make this configurable
|
||||
|
@ -62,7 +65,8 @@ fn set_metric<U: ProgressiveWebMetric>(
|
|||
metric_type: ProgressiveWebMetricType,
|
||||
category: ProfilerCategory,
|
||||
attr: &Cell<Option<u64>>,
|
||||
metric_time: Option<u64>)
|
||||
metric_time: Option<u64>,
|
||||
url: &ServoUrl)
|
||||
{
|
||||
let navigation_start = match pwm.get_navigation_start() {
|
||||
Some(time) => time,
|
||||
|
@ -95,7 +99,7 @@ fn set_metric<U: ProgressiveWebMetric>(
|
|||
// Print the metric to console if the print-pwm option was given.
|
||||
if opts::get().print_pwm {
|
||||
println!("Navigation start: {}", pwm.get_navigation_start().unwrap().to_ms());
|
||||
println!("{:?} {:?}", metric_type, time.to_ms());
|
||||
println!("{:?} {:?} {:?}", url, metric_type, time.to_ms());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -117,6 +121,7 @@ pub struct InteractiveMetrics {
|
|||
time_to_interactive: Cell<Option<u64>>,
|
||||
#[ignore_malloc_size_of = "can't measure channels"]
|
||||
time_profiler_chan: ProfilerChan,
|
||||
url: ServoUrl
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, MallocSizeOf)]
|
||||
|
@ -157,13 +162,14 @@ pub enum InteractiveFlag {
|
|||
}
|
||||
|
||||
impl InteractiveMetrics {
|
||||
pub fn new(time_profiler_chan: ProfilerChan) -> InteractiveMetrics {
|
||||
pub fn new(time_profiler_chan: ProfilerChan, url: ServoUrl) -> InteractiveMetrics {
|
||||
InteractiveMetrics {
|
||||
navigation_start: None,
|
||||
dom_content_loaded: Cell::new(None),
|
||||
main_thread_available: Cell::new(None),
|
||||
time_to_interactive: Cell::new(None),
|
||||
time_profiler_chan: time_profiler_chan,
|
||||
url,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -221,7 +227,9 @@ impl InteractiveMetrics {
|
|||
ProgressiveWebMetricType::TimeToInteractive,
|
||||
ProfilerCategory::TimeToInteractive,
|
||||
&self.time_to_interactive,
|
||||
Some(metric_time));
|
||||
Some(metric_time),
|
||||
&self.url,
|
||||
);
|
||||
}
|
||||
|
||||
pub fn get_tti(&self) -> Option<u64> {
|
||||
|
@ -247,6 +255,10 @@ impl ProgressiveWebMetric for InteractiveMetrics {
|
|||
fn get_time_profiler_chan(&self) -> &ProfilerChan {
|
||||
&self.time_profiler_chan
|
||||
}
|
||||
|
||||
fn get_url(&self) -> &ServoUrl {
|
||||
&self.url
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PaintTimeMetrics {
|
||||
|
@ -258,6 +270,7 @@ pub struct PaintTimeMetrics {
|
|||
time_profiler_chan: ProfilerChan,
|
||||
constellation_chan: IpcSender<LayoutMsg>,
|
||||
script_chan: IpcSender<ConstellationControlMsg>,
|
||||
url: ServoUrl,
|
||||
}
|
||||
|
||||
impl PaintTimeMetrics {
|
||||
|
@ -265,7 +278,8 @@ impl PaintTimeMetrics {
|
|||
pipeline_id: PipelineId,
|
||||
time_profiler_chan: ProfilerChan,
|
||||
constellation_chan: IpcSender<LayoutMsg>,
|
||||
script_chan: IpcSender<ConstellationControlMsg>)
|
||||
script_chan: IpcSender<ConstellationControlMsg>,
|
||||
url: ServoUrl)
|
||||
-> PaintTimeMetrics {
|
||||
PaintTimeMetrics {
|
||||
pending_metrics: RefCell::new(HashMap::new()),
|
||||
|
@ -276,6 +290,7 @@ impl PaintTimeMetrics {
|
|||
time_profiler_chan,
|
||||
constellation_chan,
|
||||
script_chan,
|
||||
url,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -294,6 +309,7 @@ impl PaintTimeMetrics {
|
|||
ProfilerCategory::TimeToFirstPaint,
|
||||
&self.first_paint,
|
||||
None,
|
||||
&self.url,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -354,6 +370,7 @@ impl PaintTimeMetrics {
|
|||
ProfilerCategory::TimeToFirstPaint,
|
||||
&self.first_paint,
|
||||
Some(paint_time),
|
||||
&self.url,
|
||||
);
|
||||
|
||||
if pending_metric.1 {
|
||||
|
@ -364,6 +381,7 @@ impl PaintTimeMetrics {
|
|||
ProfilerCategory::TimeToFirstContentfulPaint,
|
||||
&self.first_contentful_paint,
|
||||
Some(paint_time),
|
||||
&self.url,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -397,4 +415,8 @@ impl ProgressiveWebMetric for PaintTimeMetrics {
|
|||
fn get_time_profiler_chan(&self) -> &ProfilerChan {
|
||||
&self.time_profiler_chan
|
||||
}
|
||||
|
||||
fn get_url(&self) -> &ServoUrl {
|
||||
&self.url
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2186,7 +2186,7 @@ impl Document {
|
|||
(DocumentReadyState::Complete, true)
|
||||
};
|
||||
|
||||
let interactive_time = InteractiveMetrics::new(window.time_profiler_chan().clone());
|
||||
let interactive_time = InteractiveMetrics::new(window.time_profiler_chan().clone(), url.clone());
|
||||
|
||||
Document {
|
||||
node: Node::new_document_node(),
|
||||
|
|
|
@ -1557,7 +1557,8 @@ impl ScriptThread {
|
|||
paint_time_metrics: PaintTimeMetrics::new(new_pipeline_id,
|
||||
self.time_profiler_chan.clone(),
|
||||
self.layout_to_constellation_chan.clone(),
|
||||
self.control_chan.clone()),
|
||||
self.control_chan.clone(),
|
||||
load_data.url.clone()),
|
||||
});
|
||||
|
||||
// Pick a layout thread, any layout thread
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue