gecko-dev/docs/performance/profiling_with_instruments.md
Kim Moir 5f981c24b9 Bug 1712168 - migrate profiler mdn docs to in tree performance docs r=julienw
***
bug 1712168 - migrate profiler mdn docs to in tree performance docs  r=#firefox-source-docs-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D116154
2021-06-03 13:47:50 +00:00

2.3 KiB

Profiling with Instruments

Instruments can be used for memory profiling and for statistical profiling.

Official Apple documentation

Basic Usage

  • Select "Time Profiler" from the "Choose a profiling template for:" dialog.
  • In the top left, next to the record and pause button, there will be a "[machine name] > All Processes". Click "All Processes" and select "firefox" from the "Running Applications" section.
  • Click the record button (red circle in top left)
  • Wait for the amount of time that you want to profile
  • Click the stop button

Command line tools

There is instruments and iprofiler.

How do we monitor performance counters (cache miss etc.)? Instruments has a "Counters" instrument that can do this.

Memory profiling

Instruments will record a call stack at each allocation point. The call tree view can be quite helpful here. Switch from "Statistics". This malloc profiling is done using the malloc_logger infrastructure (similar to MallocStackLogging). Currently this means you need to build with jemalloc disabled (ac_add_options --disable-jemalloc). You also need the fix to Bug 719427

The DTPerformanceSession api can be used to control profiling from applications like the old CHUD API we use in Shark builds. Bug 667036

System Trace might be useful.