Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on time #68

Merged
merged 1 commit into from
Sep 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions malloc_size_of/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ servo = [
"serde",
"serde_bytes",
"string_cache",
"time",
"url",
"uuid",
"webrender_api",
Expand All @@ -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 }
Expand Down
6 changes: 0 additions & 6 deletions malloc_size_of/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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")]
Expand Down
1 change: 0 additions & 1 deletion style/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
13 changes: 5 additions & 8 deletions style/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down Expand Up @@ -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.
Expand All @@ -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,
Expand Down Expand Up @@ -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")
}
}
Expand All @@ -374,7 +371,7 @@ impl TraversalStatistics {
aggregated: PerThreadTraversalStatistics,
traversal: &D,
parallel: bool,
start: f64,
start: Instant,
) -> TraversalStatistics
where
E: TElement,
Expand All @@ -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,
}
Expand Down
3 changes: 2 additions & 1 deletion style/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
};
Expand Down