Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-62227

Perf annotate tool on Linux doesn't show sources for dynamically linked builds

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Dev Platform 2022-01-10, Dev Platform 2022-01-24, Dev Platform 2022-02-07, Dev Platform 2022-02-21

      After recording profiles with "perf record" it's possible later to view per-instruction counter stats with "perf annotate" (or interactively from "perf report"). However, when building with `--link-model=dynamic` the report only shows assembly and doesn't include source lines.

      Full build command: `./buildscripts/scons.py --variables-files=etc/scons/mongodbtoolchain_stable_clang.vars --ninja generate-ninja ICECC=icecc CCACHE=ccache --dbg=off --opt=on --link-model=dynamic`

      Running perf tool:
      1. Start mongod
      2. $ perf record -p $(pidof mongod) -e cpu-cycles
      3. Execute a query against mongod
      4. stop perf (Ctrl+C), it will create perf.data file in the working dir
      5. $ perf annotate (by default it will use perf.data file)
      The tool should show information similar to this:

      switch (conf->go[*(const uint8_t *)conf->cur]) {
        4.00 │ 80:   movzbl (%rbx),%r10d
        2.00 │       movsbl (%rax,%r10,1),%eax
       20.64 │       add    $0xffffffff,%eax
      

      But when using dynamic linking it only shows disassembly and "s" command doesn't toggle the sources on/off (only recolors the line numbers).

            Assignee:
            daniel.moody@mongodb.com Daniel Moody
            Reporter:
            irina.yatsenko@mongodb.com Irina Yatsenko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: