mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Plumb time profiler output into tracing (#34238)
* Plumb time profiler output into tracing Signed-off-by: Delan Azabani <dazabani@igalia.com> * Enter the span tightly around the callback Signed-off-by: Delan Azabani <dazabani@igalia.com> * Use `info_span!()` shorthand Signed-off-by: Delan Azabani <dazabani@igalia.com> --------- Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
495cceb7de
commit
aa7116c75d
16 changed files with 279 additions and 82 deletions
|
@ -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};
|
||||
use profile_traits::{ipc as profile_ipc, mem as profile_mem, time as profile_time, time_profile};
|
||||
use script_traits::serializable::{BlobData, BlobImpl, FileBlob};
|
||||
use script_traits::transferable::MessagePortImpl;
|
||||
use script_traits::{
|
||||
|
@ -2686,7 +2686,7 @@ impl GlobalScope {
|
|||
iframe: profile_time::TimerMetadataFrameType::RootWindow,
|
||||
incremental: profile_time::TimerMetadataReflowType::FirstReflow,
|
||||
};
|
||||
profile_time::profile(
|
||||
time_profile!(
|
||||
profile_time::ProfilerCategory::ScriptEvaluate,
|
||||
Some(metadata),
|
||||
self.time_profiler_chan().clone(),
|
||||
|
|
|
@ -27,8 +27,9 @@ use net_traits::{
|
|||
ResourceTimingType,
|
||||
};
|
||||
use profile_traits::time::{
|
||||
profile, ProfilerCategory, TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType,
|
||||
ProfilerCategory, TimerMetadata, TimerMetadataFrameType, TimerMetadataReflowType,
|
||||
};
|
||||
use profile_traits::time_profile;
|
||||
use script_traits::DocumentActivity;
|
||||
use servo_config::pref;
|
||||
use servo_url::ServoUrl;
|
||||
|
@ -521,17 +522,32 @@ impl ServoParser {
|
|||
iframe: TimerMetadataFrameType::RootWindow,
|
||||
incremental: TimerMetadataReflowType::FirstReflow,
|
||||
};
|
||||
let profiler_category = self.tokenizer.profiler_category();
|
||||
profile(
|
||||
profiler_category,
|
||||
Some(metadata),
|
||||
self.document
|
||||
.window()
|
||||
.upcast::<GlobalScope>()
|
||||
.time_profiler_chan()
|
||||
.clone(),
|
||||
|| self.do_parse_sync(can_gc),
|
||||
)
|
||||
let profiler_chan = self
|
||||
.document
|
||||
.window()
|
||||
.upcast::<GlobalScope>()
|
||||
.time_profiler_chan()
|
||||
.clone();
|
||||
match self.tokenizer {
|
||||
Tokenizer::Html(_) => time_profile!(
|
||||
ProfilerCategory::ScriptParseHTML,
|
||||
Some(metadata),
|
||||
profiler_chan,
|
||||
|| self.do_parse_sync(can_gc),
|
||||
),
|
||||
Tokenizer::AsyncHtml(_) => time_profile!(
|
||||
ProfilerCategory::ScriptParseHTML,
|
||||
Some(metadata),
|
||||
profiler_chan,
|
||||
|| self.do_parse_sync(can_gc),
|
||||
),
|
||||
Tokenizer::Xml(_) => time_profile!(
|
||||
ProfilerCategory::ScriptParseXML,
|
||||
Some(metadata),
|
||||
profiler_chan,
|
||||
|| self.do_parse_sync(can_gc),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
fn do_parse_sync(&self, can_gc: CanGc) {
|
||||
|
@ -720,14 +736,6 @@ impl Tokenizer {
|
|||
Tokenizer::Xml(_) => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
fn profiler_category(&self) -> ProfilerCategory {
|
||||
match *self {
|
||||
Tokenizer::Html(_) => ProfilerCategory::ScriptParseHTML,
|
||||
Tokenizer::AsyncHtml(_) => ProfilerCategory::ScriptParseHTML,
|
||||
Tokenizer::Xml(_) => ProfilerCategory::ScriptParseXML,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The context required for asynchronously fetching a document
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue