mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
Make ScriptEvaluate count script execution in DOM events and timers (#34286)
Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
4a06dc53f6
commit
26748621cd
3 changed files with 77 additions and 85 deletions
|
@ -42,6 +42,8 @@ pub fn is_execution_stack_empty() -> bool {
|
|||
/// RAII struct that pushes and pops entries from the script settings stack.
|
||||
pub struct AutoEntryScript {
|
||||
global: DomRoot<GlobalScope>,
|
||||
#[cfg(feature = "tracing")]
|
||||
span: tracing::span::EnteredSpan,
|
||||
}
|
||||
|
||||
impl AutoEntryScript {
|
||||
|
@ -56,6 +58,8 @@ impl AutoEntryScript {
|
|||
});
|
||||
AutoEntryScript {
|
||||
global: DomRoot::from_ref(global),
|
||||
#[cfg(feature = "tracing")]
|
||||
span: tracing::info_span!("ScriptEvaluate", servo_profiling = true).entered(),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ use net_traits::{
|
|||
fetch_async, CoreResourceMsg, CoreResourceThread, FetchResponseListener, IpcSend,
|
||||
ReferrerPolicy, ResourceThreads,
|
||||
};
|
||||
use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time, time_profile};
|
||||
use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time};
|
||||
use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
|
||||
use script_traits::transferable::MessagePortImpl;
|
||||
use script_traits::{
|
||||
|
@ -2677,20 +2677,6 @@ impl GlobalScope {
|
|||
script_base_url: ServoUrl,
|
||||
can_gc: CanGc,
|
||||
) -> bool {
|
||||
let metadata = profile_time::TimerMetadata {
|
||||
url: if filename.is_empty() {
|
||||
self.get_url().as_str().into()
|
||||
} else {
|
||||
filename.into()
|
||||
},
|
||||
iframe: profile_time::TimerMetadataFrameType::RootWindow,
|
||||
incremental: profile_time::TimerMetadataReflowType::FirstReflow,
|
||||
};
|
||||
time_profile!(
|
||||
profile_time::ProfilerCategory::ScriptEvaluate,
|
||||
Some(metadata),
|
||||
self.time_profiler_chan().clone(),
|
||||
|| {
|
||||
let cx = GlobalScope::get_cx();
|
||||
|
||||
let ar = enter_realm(self);
|
||||
|
@ -2767,8 +2753,6 @@ impl GlobalScope {
|
|||
maybe_resume_unwind();
|
||||
result
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
/// <https://html.spec.whatwg.org/multipage/#timer-initialisation-steps>
|
||||
|
|
|
@ -78,7 +78,11 @@ pub enum ProfilerCategory {
|
|||
ScriptDevtoolsMsg = 0x62,
|
||||
ScriptDocumentEvent = 0x63,
|
||||
ScriptDomEvent = 0x64,
|
||||
|
||||
/// Rust tracing only: the script thread is executing a script.
|
||||
/// This may include time doing layout or parse work initiated by the script.
|
||||
ScriptEvaluate = 0x65,
|
||||
|
||||
ScriptEvent = 0x66,
|
||||
ScriptFileRead = 0x67,
|
||||
ScriptImageCacheMsg = 0x68,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue