diff options
author | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2017-12-05 20:07:45 +0100 |
---|---|---|
committer | Fernando Jiménez Moreno <ferjmoreno@gmail.com> | 2017-12-07 07:26:39 +0100 |
commit | 4d8660c91819fc13deafc7561432bceb41c4ad2f (patch) | |
tree | 386dbb03012ff85f7d9d53753e2ae7ff5223265c /components/metrics/lib.rs | |
parent | 462409ada54b002689d01c7c7243f0d9fe90df26 (diff) | |
download | servo-4d8660c91819fc13deafc7561432bceb41c4ad2f.tar.gz servo-4d8660c91819fc13deafc7561432bceb41c4ad2f.zip |
Fix float conversion of paint timing metrics
Diffstat (limited to 'components/metrics/lib.rs')
-rw-r--r-- | components/metrics/lib.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/components/metrics/lib.rs b/components/metrics/lib.rs index bd2d488f100..72706d0a0a7 100644 --- a/components/metrics/lib.rs +++ b/components/metrics/lib.rs @@ -46,6 +46,15 @@ pub const MAX_TASK_NS: u64 = 50000000; /// 10 second window (in ns) const INTERACTIVE_WINDOW_SECONDS_IN_NS: u64 = 10000000000; +pub trait ToMs<T> { + fn to_ms(&self) -> T; +} + +impl ToMs<f64> for u64 { + fn to_ms(&self) -> f64 { + *self as f64 / 1000000. + } +} fn set_metric<U: ProgressiveWebMetric>( pwm: &U, @@ -85,8 +94,8 @@ 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()); - println!("{:?} {:?}", metric_type, time); + println!("Navigation start: {}", pwm.get_navigation_start().unwrap().to_ms()); + println!("{:?} {:?}", metric_type, time.to_ms()); } } |