diff --git a/malloc_size_of/Cargo.toml b/malloc_size_of/Cargo.toml index 0c7fd3b8a..fe38be093 100644 --- a/malloc_size_of/Cargo.toml +++ b/malloc_size_of/Cargo.toml @@ -19,7 +19,6 @@ servo = [ "serde", "serde_bytes", "string_cache", - "time", "url", "uuid", "webrender_api", @@ -46,7 +45,6 @@ smallbitvec = "2.3.0" smallvec = "1.13" string_cache = { version = "0.8", optional = true } thin-vec = { version = "0.2.13" } -time = { version = "0.1.41", optional = true } tokio = { version = "1", features = ["sync"] } url = { version = "2.5", features = ["serde"], optional = true } uuid = { version = "1.7.0", optional = true } diff --git a/malloc_size_of/lib.rs b/malloc_size_of/lib.rs index 78937ef47..0f1344713 100644 --- a/malloc_size_of/lib.rs +++ b/malloc_size_of/lib.rs @@ -69,8 +69,6 @@ extern crate smallbitvec; extern crate smallvec; #[cfg(feature = "servo")] extern crate string_cache; -#[cfg(feature = "servo")] -extern crate time; #[cfg(feature = "url")] extern crate url; #[cfg(feature = "servo")] @@ -945,10 +943,6 @@ impl MallocSizeOf for xml5ever::QualName { } } -#[cfg(feature = "servo")] -malloc_size_of_is_0!(time::Duration); -#[cfg(feature = "servo")] -malloc_size_of_is_0!(time::Tm); #[cfg(feature = "servo")] malloc_size_of_is_0!(std::time::Duration); #[cfg(feature = "servo")] diff --git a/style/Cargo.toml b/style/Cargo.toml index 259862d56..74d7100c2 100644 --- a/style/Cargo.toml +++ b/style/Cargo.toml @@ -93,7 +93,6 @@ style_derive = {path = "../style_derive"} style_traits = {path = "../style_traits"} to_shmem = {path = "../to_shmem"} to_shmem_derive = {path = "../to_shmem_derive"} -time = "0.1" thin-vec = "0.2.1" uluru = "3.0" unicode-bidi = { version = "0.3", default-features = false } diff --git a/style/context.rs b/style/context.rs index 1f8b2eb6a..533761768 100644 --- a/style/context.rs +++ b/style/context.rs @@ -37,6 +37,7 @@ use servo_arc::Arc; use servo_atoms::Atom; use std::fmt; use std::ops; +use std::time::{Duration, Instant}; use style_traits::CSSPixel; use style_traits::DevicePixel; #[cfg(feature = "servo")] @@ -306,7 +307,7 @@ pub struct TraversalStatistics { /// The number of times the stylist was rebuilt. pub stylist_rebuilds: u32, /// Time spent in the traversal, in milliseconds. - pub traversal_time_ms: f64, + pub traversal_time: Duration, /// Whether this was a parallel traversal. pub is_parallel: bool, /// Whether this is a "large" traversal. @@ -317,10 +318,6 @@ pub struct TraversalStatistics { /// See https://bugzilla.mozilla.org/show_bug.cgi?id=1331856#c2 impl fmt::Display for TraversalStatistics { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - debug_assert!( - self.traversal_time_ms != 0.0, - "should have set traversal time" - ); writeln!(f, "[PERF] perf block start")?; writeln!( f, @@ -361,7 +358,7 @@ impl fmt::Display for TraversalStatistics { )?; writeln!(f, "[PERF],declarations,{}", self.declarations)?; writeln!(f, "[PERF],stylist_rebuilds,{}", self.stylist_rebuilds)?; - writeln!(f, "[PERF],traversal_time_ms,{}", self.traversal_time_ms)?; + writeln!(f, "[PERF],traversal_time_ms,{}", self.traversal_time.as_secs_f64() * 1000.)?; writeln!(f, "[PERF] perf block end") } } @@ -374,7 +371,7 @@ impl TraversalStatistics { aggregated: PerThreadTraversalStatistics, traversal: &D, parallel: bool, - start: f64, + start: Instant, ) -> TraversalStatistics where E: TElement, @@ -393,7 +390,7 @@ impl TraversalStatistics { dependency_selectors: stylist.num_invalidations() as u32, declarations: stylist.num_declarations() as u32, stylist_rebuilds: stylist.num_rebuilds() as u32, - traversal_time_ms: (time::precise_time_s() - start) * 1000.0, + traversal_time: Instant::now() - start, is_parallel: parallel, is_large, } diff --git a/style/driver.rs b/style/driver.rs index 59f401895..f441f58f8 100644 --- a/style/driver.rs +++ b/style/driver.rs @@ -14,6 +14,7 @@ use crate::parallel; use crate::scoped_tls::ScopedTLS; use crate::traversal::{DomTraversal, PerLevelTraversalData, PreTraverseToken}; use std::collections::VecDeque; +use std::time::Instant; #[cfg(feature = "servo")] fn should_report_statistics() -> bool { @@ -102,7 +103,7 @@ where let report_stats = should_report_statistics(); let dump_stats = traversal.shared_context().options.dump_style_statistics; let start_time = if dump_stats { - Some(time::precise_time_s()) + Some(Instant::now()) } else { None };