mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 14:22:01 +00:00
servo: Merge #19994 - Remove traversal telemetry (from Manishearth:rm-telemetry); r=upsuper
Source-Repo: https://github.com/servo/servo Source-Revision: e654afbc3e47d97835328e6131ef51b2e27e3409 --HG-- extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear extra : subtree_revision : 9c2646dea983c0d03022566fa69a04897146cfc8
This commit is contained in:
parent
50c6f0526f
commit
a17da12d3c
@ -7,7 +7,7 @@
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use context::{StyleContext, ThreadLocalStyleContext, TraversalStatistics};
|
||||
use context::{StyleContext, ThreadLocalStyleContext};
|
||||
use dom::{SendNode, TElement, TNode};
|
||||
use parallel;
|
||||
use parallel::{DispatchMode, WORK_UNIT_MAX};
|
||||
@ -33,7 +33,7 @@ pub fn traverse_dom<E, D>(
|
||||
traversal: &D,
|
||||
token: PreTraverseToken<E>,
|
||||
pool: Option<&rayon::ThreadPool>
|
||||
) -> (bool, Option<TraversalStatistics>)
|
||||
)
|
||||
where
|
||||
E: TElement,
|
||||
D: DomTraversal<E>,
|
||||
@ -43,7 +43,6 @@ where
|
||||
|
||||
let dump_stats = traversal.shared_context().options.dump_style_statistics;
|
||||
let is_nightly = traversal.shared_context().options.is_nightly();
|
||||
let mut used_parallel = false;
|
||||
let start_time = if dump_stats { Some(time::precise_time_s()) } else { None };
|
||||
|
||||
// Declare the main-thread context, as well as the worker-thread contexts,
|
||||
@ -90,7 +89,6 @@ where
|
||||
// moving to the next level in the dom so that we can pass the same
|
||||
// depth for all the children.
|
||||
if pool.is_some() && discovered.len() > WORK_UNIT_MAX {
|
||||
used_parallel = true;
|
||||
let pool = pool.unwrap();
|
||||
maybe_tls = Some(ScopedTLS::<ThreadLocalStyleContext<E>>::new(pool));
|
||||
let root_opaque = root.as_node().opaque();
|
||||
@ -115,7 +113,6 @@ where
|
||||
nodes_remaining_at_current_depth = discovered.len();
|
||||
}
|
||||
}
|
||||
let mut maybe_stats = None;
|
||||
// Accumulate statistics
|
||||
if dump_stats || is_nightly {
|
||||
let mut aggregate =
|
||||
@ -136,8 +133,5 @@ where
|
||||
aggregate.finish(traversal, parallel, start_time.unwrap());
|
||||
println!("{}", aggregate);
|
||||
}
|
||||
maybe_stats = Some(aggregate);
|
||||
}
|
||||
|
||||
(used_parallel, maybe_stats)
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
//! Data needed to style a Gecko document.
|
||||
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use context::TraversalStatistics;
|
||||
use dom::TElement;
|
||||
use gecko_bindings::bindings::{self, RawServoStyleSet};
|
||||
use gecko_bindings::structs::{RawGeckoPresContextOwned, ServoStyleSetSizes, ServoStyleSheet};
|
||||
@ -18,7 +17,6 @@ use properties::ComputedValues;
|
||||
use selector_parser::SnapshotMap;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use stylesheets::{StylesheetContents, StylesheetInDocument};
|
||||
use stylist::Stylist;
|
||||
|
||||
@ -110,40 +108,11 @@ impl StylesheetInDocument for GeckoStyleSheet {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
/// Helper struct for counting traversals
|
||||
pub struct TraversalCount {
|
||||
/// Total number of events
|
||||
pub total_count: AtomicUsize,
|
||||
/// Number of events which were parallel
|
||||
pub parallel_count: AtomicUsize
|
||||
}
|
||||
|
||||
impl TraversalCount {
|
||||
fn record(&self, parallel: bool, count: u32) {
|
||||
self.total_count.fetch_add(count as usize, Ordering::Relaxed);
|
||||
if parallel {
|
||||
self.parallel_count.fetch_add(count as usize, Ordering::Relaxed);
|
||||
}
|
||||
}
|
||||
|
||||
fn get(&self) -> (u32, u32) {
|
||||
(self.total_count.load(Ordering::Relaxed) as u32,
|
||||
self.parallel_count.load(Ordering::Relaxed) as u32)
|
||||
}
|
||||
}
|
||||
|
||||
/// The container for data that a Servo-backed Gecko document needs to style
|
||||
/// itself.
|
||||
pub struct PerDocumentStyleDataImpl {
|
||||
/// Rule processor.
|
||||
pub stylist: Stylist,
|
||||
/// Counter for traversals that could have been parallel, for telemetry
|
||||
pub traversal_count: TraversalCount,
|
||||
/// Counter for traversals, weighted by elements traversed,
|
||||
pub traversal_count_traversed: TraversalCount,
|
||||
/// Counter for traversals, weighted by elements styled,
|
||||
pub traversal_count_styled: TraversalCount,
|
||||
}
|
||||
|
||||
/// The data itself is an `AtomicRefCell`, which guarantees the proper semantics
|
||||
@ -165,9 +134,6 @@ impl PerDocumentStyleData {
|
||||
|
||||
PerDocumentStyleData(AtomicRefCell::new(PerDocumentStyleDataImpl {
|
||||
stylist: Stylist::new(device, quirks_mode.into()),
|
||||
traversal_count: Default::default(),
|
||||
traversal_count_traversed: Default::default(),
|
||||
traversal_count_styled: Default::default(),
|
||||
}))
|
||||
}
|
||||
|
||||
@ -187,13 +153,6 @@ impl Drop for PerDocumentStyleDataImpl {
|
||||
if !structs::GECKO_IS_NIGHTLY {
|
||||
return
|
||||
}
|
||||
let (total, parallel) = self.traversal_count.get();
|
||||
let (total_t, parallel_t) = self.traversal_count_traversed.get();
|
||||
let (total_s, parallel_s) = self.traversal_count_styled.get();
|
||||
|
||||
unsafe { bindings::Gecko_RecordTraversalStatistics(total, parallel,
|
||||
total_t, parallel_t,
|
||||
total_s, parallel_s) }
|
||||
}
|
||||
}
|
||||
|
||||
@ -261,15 +220,6 @@ impl PerDocumentStyleDataImpl {
|
||||
pub fn add_size_of(&self, ops: &mut MallocSizeOfOps, sizes: &mut ServoStyleSetSizes) {
|
||||
self.stylist.add_size_of(ops, sizes);
|
||||
}
|
||||
|
||||
/// Record that a traversal happened for later collection as telemetry
|
||||
pub fn record_traversal(&self, was_parallel: bool, stats: Option<TraversalStatistics>) {
|
||||
self.traversal_count.record(was_parallel, 1);
|
||||
if let Some(stats) = stats {
|
||||
self.traversal_count_traversed.record(was_parallel, stats.elements_traversed);
|
||||
self.traversal_count_styled.record(was_parallel, stats.elements_styled);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
unsafe impl HasFFI for PerDocumentStyleData {
|
||||
|
@ -546,16 +546,6 @@ extern "C" {
|
||||
extern "C" {
|
||||
pub fn Servo_SourceSizeList_Drop(ptr: RawServoSourceSizeListOwned);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_RecordTraversalStatistics(
|
||||
total: u32,
|
||||
parallel: u32,
|
||||
total_t: u32,
|
||||
parallel_t: u32,
|
||||
total_s: u32,
|
||||
parallel_s: u32,
|
||||
);
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Gecko_IsSignificantChild(
|
||||
node: RawGeckoNodeBorrowed,
|
||||
|
@ -279,19 +279,8 @@ fn traverse_subtree(
|
||||
None
|
||||
};
|
||||
|
||||
let is_restyle = element.get_data().is_some();
|
||||
|
||||
let traversal = RecalcStyleOnly::new(shared_style_context);
|
||||
let (used_parallel, stats) = driver::traverse_dom(&traversal, token, thread_pool);
|
||||
|
||||
if traversal_flags.contains(TraversalFlags::ParallelTraversal) &&
|
||||
!traversal_flags.contains(TraversalFlags::AnimationOnly) &&
|
||||
is_restyle && !element.is_native_anonymous() {
|
||||
// We turn off parallel traversal for background tabs; this
|
||||
// shouldn't count in telemetry. We're also focusing on restyles so
|
||||
// we ensure that it's a restyle.
|
||||
per_doc_data.record_traversal(used_parallel, stats);
|
||||
}
|
||||
driver::traverse_dom(&traversal, token, thread_pool);
|
||||
}
|
||||
|
||||
/// Traverses the subtree rooted at `root` for restyling.
|
||||
|
Loading…
Reference in New Issue
Block a user