Skip to content

Error parsing perf output #336

@radoslawcybulski

Description

@radoslawcybulski

On fedora 42 (don't judge me):

y@fedora:~/work/magic-trace$ uname -a
Linux fedora 6.15.10-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 15 15:57:06 UTC 2025 x86_64 GNU/Linux
y@fedora:~/work/magic-trace$ grep intel_pt /proc/cpuinfo | wc -l
22

with perf, magic-trace built from source:

y@fedora:~/work/magic-trace$ perf --version
perf version 6.16.4-200.fc42.x86_64
y@fedora:~/work/magic-trace$ git log -n 1
commit 2dca730640ce7f664269ff1299abb1854740ace4 (HEAD, tag: v1.2.4)

running magic-trace against demo.c you provided gives this error:

y@fedora:~/work/magic-trace$ ./magic-trace attach -pid $(pidof demo_)
[ Attached. Press Ctrl-C to stop recording. ]
^C[ Got signal, detaching... ]
[ Snapshot taken. ]
[ perf record: Woken up 58 times to write data ]
[ perf record: Captured and wrote 7.367 MB /tmp/magic_trace.tmp.4a4ce4/perf.data ]
[ Finished recording. ]
[ Decoding, this takes a while... ]
(monitor.ml.Error
 ("BUG: exception raised while parsing perf output. Please report this to https://github.com/janestreet/magic-trace/issues/"
  (exn Not_found)
  (perf_output
   ("1190837/1190837 339075.341173319:          1                                 branches:u:   tr strt jmp                           0 [unknown] ([unknown]) =>     7f5029da6be4 _dl_load_cache_lookup+0x164 (/usr/lib64/ld-linux-x86-64.so.2)")))
 ("Raised at Base__Error.raise in file \"src/error.ml\" (inlined), line 9, characters 14-30"
  "Called from Base__Error.raise_s in file \"src/error.ml\", line 10, characters 19-40"
  "Called from Async_kernel__Pipe.map.(fun) in file \"src/pipe.ml\", line 1066, characters 65-70"
  "Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 180, characters 6-47"
  "Caught by monitor Monitor.protect"))

I also tried origin/master and it failed, although with different error:

y@fedora:~/work/magic-trace$ ./magic-trace attach -pid $(pidof demo_)
[ Attached. Press Ctrl-C to stop recording. ]
^C[ Got signal, detaching... ]
[ Snapshot taken. ]
[ perf record: Woken up 43 times to write data ]
(monitor.ml.Error (Failure "Perf didn't ack snapshot within timeout")
 ("Raised at Stdlib.failwith in file \"stdlib.ml\", line 29, characters 17-33"
  "Called from Magic_trace_lib__Perf_ctlfd.dispatch_and_block_for_ack in file \"src/perf_ctlfd.ml\", line 87, characters 9-25"
  "Called from Magic_trace_lib__Perf_tool_backend.Recording.Control.shutdown in file \"src/perf_tool_backend.ml\", line 216, characters 8-60"
  "Called from Magic_trace_lib__Perf_tool_backend.Recording.finish_recording in file \"src/perf_tool_backend.ml\", line 560, characters 4-36"
  "Called from Magic_trace_lib__Trace.Make_commands.detach.(fun) in file \"src/trace.ml\", line 433, characters 36-80"
  "Called from Async_kernel__Deferred0.bind.(fun) in file \"src/deferred0.ml\", line 54, characters 64-69"
  "Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 180, characters 6-47"
  "Caught by monitor Monitor.protect"))

I'd help, but ocaml is way above my paygrade, sorry. :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions