How to profile Swift benchmarks in Instruments

I was asked this question via DMs and thought the answer might be useful for more people:

When profiling individual benchmarks I'll do the following:

  1. Open Instruments,
  2. Choose Time Profiler template,
  3. Choose Target , navigate to Benchmark_O binary
    (mine is built in /Users/mondo/Developer/swift-source/build/Ninja-Release/swift-macosx-x86_64/bin )
  4. Specify command line Arguments ,
    eg: --num-iters=1 --num-samples=2000 AngryPhonebook
  5. Record Trace

@palimondo this seems like something that would be useful to add in a document in the benchmark directory. We should also add something that shows how to do analogous perf measurement on Linux (windows, other platforms, etc).

Your thoughts?

It might even make sense to add it to the README since it is such a basic operation.

Yeah, there was also your unmerged update to benchmarking documentation floating around somewhere... It'll try to get to updating docs together with RFC: BenchmarkInfo refactoring.