diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-12-07 10:31:45 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-07 10:31:45 -0600 |
commit | ff70c4426d9ea2f36dc18216678f743e9f56f561 (patch) | |
tree | 159f57fd2d7f029f2484a8bf6308366ffe07d637 /components/metrics/lib.rs | |
parent | 8e3056d0cc7caebc218d51373b3aa0ccd331fa20 (diff) | |
parent | 4d8660c91819fc13deafc7561432bceb41c4ad2f (diff) | |
download | servo-ff70c4426d9ea2f36dc18216678f743e9f56f561.tar.gz servo-ff70c4426d9ea2f36dc18216678f743e9f56f561.zip |
Auto merge of #19498 - ferjm:pwm.f64, r=jdm
Fix float conversion of paint timing metrics
This is a follow up of #19077
- [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/19498)
<!-- Reviewable:end -->
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()); } } |