diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2016-09-29 17:59:35 -0700 |
---|---|---|
committer | Keith Yeung <kungfukeith11@gmail.com> | 2016-10-01 00:12:49 -0700 |
commit | cb11d8515051a3d6b33ba9403e25fba4fdc17a66 (patch) | |
tree | 0fa6ba4c49d34489e31bf5e4e0729088aa3d1827 /components/util/opts.rs | |
parent | 8b26c3ead53bb375eaa4475de48a7f097b589b90 (diff) | |
download | servo-cb11d8515051a3d6b33ba9403e25fba4fdc17a66.tar.gz servo-cb11d8515051a3d6b33ba9403e25fba4fdc17a66.zip |
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.
Diffstat (limited to 'components/util/opts.rs')
-rw-r--r-- | components/util/opts.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/components/util/opts.rs b/components/util/opts.rs index 659ead8b4c5..8cc67c1d217 100644 --- a/components/util/opts.rs +++ b/components/util/opts.rs @@ -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); |