avm2: Add new feature tracy_avm, which emits tracy spans for AVM2 methods
This commit is contained in:
parent
038a714dbf
commit
52eb5d6614
|
@ -4269,6 +4269,7 @@ dependencies = [
|
|||
"symphonia",
|
||||
"thiserror",
|
||||
"tracing",
|
||||
"tracy-client",
|
||||
"ttf-parser",
|
||||
"unic-segment",
|
||||
"url",
|
||||
|
|
|
@ -68,6 +68,7 @@ unic-segment = "0.9.0"
|
|||
id3 = "1.14.0"
|
||||
either = "1.13.0"
|
||||
chardetng = "0.1.17"
|
||||
tracy-client = { version = "0.17.1", optional = true, default-features = false }
|
||||
|
||||
[target.'cfg(not(target_family = "wasm"))'.dependencies.futures]
|
||||
workspace = true
|
||||
|
@ -79,6 +80,7 @@ version = "0.4.43"
|
|||
default = []
|
||||
lzma = ["lzma-rs", "swf/lzma"]
|
||||
avm_debug = []
|
||||
tracy_avm = ["dep:tracy-client"]
|
||||
deterministic = []
|
||||
timeline_debug = []
|
||||
mp3 = ["symphonia"]
|
||||
|
|
|
@ -184,6 +184,18 @@ pub fn exec<'gc>(
|
|||
resolved_signature,
|
||||
bound_class,
|
||||
)?;
|
||||
|
||||
#[cfg(feature = "tracy_avm")]
|
||||
let _span = {
|
||||
let mut name = WString::new();
|
||||
display_function(&mut name, &method, bound_class);
|
||||
let span = tracy_client::Client::running()
|
||||
.expect("tracy_client should be running")
|
||||
.span_alloc(None, &name.to_utf8_lossy(), "rust", 0, 0);
|
||||
span.emit_color(0x2c4980);
|
||||
span
|
||||
};
|
||||
|
||||
activation
|
||||
.context
|
||||
.avm2
|
||||
|
@ -210,6 +222,23 @@ pub fn exec<'gc>(
|
|||
bound_class,
|
||||
callee,
|
||||
)?;
|
||||
|
||||
#[cfg(feature = "tracy_avm")]
|
||||
let _span = {
|
||||
let mut name = WString::new();
|
||||
display_function(&mut name, &method, bound_class);
|
||||
let option = tracy_client::Client::running();
|
||||
let span = option.expect("tracy_client should be running").span_alloc(
|
||||
None,
|
||||
&name.to_utf8_lossy(),
|
||||
bm.owner_movie().url(),
|
||||
line!(),
|
||||
0,
|
||||
);
|
||||
span.emit_color(0x425fa1);
|
||||
span
|
||||
};
|
||||
|
||||
activation
|
||||
.context
|
||||
.avm2
|
||||
|
|
Loading…
Reference in New Issue