mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
profile: Integrate the time profiler with the macOS signpost
infrastructure. With this change, if you supply the `-Z signpost` flag, Instruments.app can display Servo events overlaid with callstack data. Even better, you can get call stack profiling for individual Servo events (one layout, one network request, one style recalculation, etc.) This adds a dependency on the `signpost` crate. On unsupported OS's, this crate is an no-op.
This commit is contained in:
parent
8b26c3ead5
commit
cb11d85150
7 changed files with 197 additions and 45 deletions
|
@ -217,6 +217,10 @@ pub struct Opts {
|
|||
// don't skip any backtraces on panic
|
||||
pub full_backtraces: bool,
|
||||
|
||||
/// True to use OS native signposting facilities. This makes profiling events (script activity,
|
||||
/// reflow, compositing, etc.) appear in Instruments.app on macOS.
|
||||
pub signpost: bool,
|
||||
|
||||
/// Print the version and exit.
|
||||
pub is_printing_version: bool,
|
||||
}
|
||||
|
@ -322,6 +326,10 @@ pub struct DebugOptions {
|
|||
/// useful when modifying the shaders, to ensure they all compile
|
||||
/// after each change is made.
|
||||
pub precache_shaders: bool,
|
||||
|
||||
/// True to use OS native signposting facilities. This makes profiling events (script activity,
|
||||
/// reflow, compositing, etc.) appear in Instruments.app on macOS.
|
||||
pub signpost: bool,
|
||||
}
|
||||
|
||||
|
||||
|
@ -361,6 +369,7 @@ impl DebugOptions {
|
|||
"msaa" => debug_options.use_msaa = true,
|
||||
"full-backtraces" => debug_options.full_backtraces = true,
|
||||
"precache-shaders" => debug_options.precache_shaders = true,
|
||||
"signpost" => debug_options.signpost = true,
|
||||
"" => {},
|
||||
_ => return Err(option)
|
||||
};
|
||||
|
@ -411,6 +420,7 @@ pub fn print_debug_usage(app: &str) -> ! {
|
|||
print_option("full-backtraces", "Print full backtraces for all errors");
|
||||
print_option("wr-debug", "Display webrender tile borders. Must be used with -w option.");
|
||||
print_option("precache-shaders", "Compile all shaders during init. Must be used with -w option.");
|
||||
print_option("signpost", "Emit native OS signposts for profile events (currently macOS only)");
|
||||
|
||||
println!("");
|
||||
|
||||
|
@ -549,6 +559,7 @@ pub fn default_opts() -> Opts {
|
|||
is_printing_version: false,
|
||||
webrender_debug: false,
|
||||
precache_shaders: false,
|
||||
signpost: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -860,6 +871,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
|||
is_printing_version: is_printing_version,
|
||||
webrender_debug: debug_options.webrender_debug,
|
||||
precache_shaders: debug_options.precache_shaders,
|
||||
signpost: debug_options.signpost,
|
||||
};
|
||||
|
||||
set_defaults(opts);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue