Log set_context in profile data (#3362)

Any context loss is relevant to performance. Also, having the event in the log
may help debugging any context-loss-related issues we might encounter.
This commit is contained in:
Kaz Wesley 2022-03-24 13:30:15 -07:00 committed by GitHub
parent 85a5770b7f
commit 39f39fa687
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -960,6 +960,7 @@ impl SceneData {
}
pub fn set_context(&self, context: Option<&Context>) {
let _profiler = profiler::start_objective!(profiler::APP_LIFETIME, "@set_context");
self.symbols.set_context(context);
*self.context.borrow_mut() = context.cloned();
self.dirty.shape.set();

View File

@ -287,6 +287,8 @@ impl Measurement {
pub enum Class {
/// Profiler that is active during the execution of anything else, after early startup.
OnFrame,
/// Profiler that is run when a WebGL context is acquired or lost.
SetContext,
/// Any profiler that doesn't need special treatment.
Normal,
}
@ -423,6 +425,7 @@ impl Label {
fn classify(&self) -> Class {
match self.name.as_str() {
"@on_frame" => Class::OnFrame,
"@set_context" => Class::SetContext,
// Data producer is probably newer than consumer. Forward compatibility isn't necessary.
name if name.starts_with('@') => panic!("Unrecognized special profiler: {:?}", name),
_ => Class::Normal,