Skip to content

Profiling TileDB Performance

Beka Davis edited this page Oct 25, 2022 · 6 revisions

Flamegraphs

  $ perf script -F comm,pid,tid,cpu,time,event,ip,sym,dso,trace | stackcollapse-perf.pl --tid | c++filt > collapsed.txt
  $ grep tilevcf collapsed.txt | flamegraph.pl > output.svg

MacOS Profiling Using Instruments

Launching Instruments

  1. Open the Xcode App
  2. Click Xcode -> Open Developer Tool -> Instruments to open Instruments
  • Note: Xcode does not need to be running once Instruments is open

Run Profile

  • Check Xcode CLI version with /usr/bin/xcodebuild --version
  • If the Command Line Tools are not installed, run xcode-select --install

Xcode older than v13.0

Run an instrument profile trace and save the results to an output .trace file
instruments -t "<Instrument>" -D "<output_trace_destination>" python <executable>
Example: instruments -t "Time Profiler" -D "/tmp/pysc.trace" python ./tools/ingestor -x krasnow.h5ad --corestats

Xcode v13.0 and newer

Note: for versions 13.0+, instruments is removed from the Command Line Tools and replaced with xctrace
The .trace file will automatically be saved to the working directory
xctrace record --template '<Instrument>' --launch 'which python' -- <executable>
Example: xctrace record --template 'Time Profiler' --launch 'which python' -- ./tools/ingestor -x krasnow.h5ad --corestats
Example: xctrace record --template 'Time Profiler' --launch 'which python' -- foo.py

Analyze Profile in Instruments

  1. Open the .trace file in Instruments
  2. Highlight the section you want to analyze
  • To remove highlight: View -> Clear Inspection Range
  1. In the Profile section, hold the Option key and click the arrow next to a Symbol Name to open / collapse its entire Call Tree