| Reformat using OxCaml's `ocamlformat`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Use `Time_ns.now ()` instead of hand-coded `clock_gettime`
Since we're querying a well-known clock now, we dont' need to do the
extra work.
| 4 年前 |
| Determine and write down base time in trace
This allows our patched Perfetto viewer to display absolute timestamps.
| 4 年前 |
| Run clang-format over our C stubs
| 4 年前 |
| Fix race condition on frequently hit breakpoint
Specifying a breakpoint `-trigger SYMBOL` on a `SYMBOL` that is
very frequently executed would oftentimes result in magic-trace
waiting indefinitely, never taking a snapshot. The root-cause
was that by default we configure breakpoints as single-hit, but
if the first hit occurs between the time where magic-trace creates
the breakpoint, and the time where it registers the breakpoint's
file descriptor with `epoll`, magic-trace never sees the notification.
This is fixed by only enabling the breakpoint after registering
its file descriptor with `epoll`.
Disclaimer: The initial commit was written entirely by Claude Opus 4.6,
but I performed manual cleanup.
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 1 个月前 |
| Fix race condition on frequently hit breakpoint
Specifying a breakpoint `-trigger SYMBOL` on a `SYMBOL` that is
very frequently executed would oftentimes result in magic-trace
waiting indefinitely, never taking a snapshot. The root-cause
was that by default we configure breakpoints as single-hit, but
if the first hit occurs between the time where magic-trace creates
the breakpoint, and the time where it registers the breakpoint's
file descriptor with `epoll`, magic-trace never sees the notification.
This is fixed by only enabling the breakpoint after registering
its file descriptor with `epoll`.
Disclaimer: The initial commit was written entirely by Claude Opus 4.6,
but I performed manual cleanup.
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 1 个月前 |
| Fix race condition on frequently hit breakpoint
Specifying a breakpoint `-trigger SYMBOL` on a `SYMBOL` that is
very frequently executed would oftentimes result in magic-trace
waiting indefinitely, never taking a snapshot. The root-cause
was that by default we configure breakpoints as single-hit, but
if the first hit occurs between the time where magic-trace creates
the breakpoint, and the time where it registers the breakpoint's
file descriptor with `epoll`, magic-trace never sees the notification.
This is fixed by only enabling the breakpoint after registering
its file descriptor with `epoll`.
Disclaimer: The initial commit was written entirely by Claude Opus 4.6,
but I performed manual cleanup.
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 1 个月前 |
| Fix up some messages about sampling wiki links
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 2 年前 |
| Added warnings to `-callgraph-mode` and added option for stitched lbr
This feature has two changes related to `callgraph_mode`.
* Based on user feedback from #224, I added warnings when the `-callgraph-mode`
defaults to either `Dwarf` or `Last_branch_record` to notify the user of
potential drawbacks from such selection. These warnings only show if they do
not explicitly set the flag.
* Added a fourth option to run with `Last_branch_record { stitched = true }`
which calls `perf report --call-graph lbr` and `perf script --stitch-lbr`.
There are a few design decisions here though. First I decided to add it as a
variant of `Callgraph_mode` for simplicity of interface for the user. However
this has the awkward effect of this now being a parameter needed for both
decoding and recording (which `Backend_intf` doesn't support). I would think
this could perhaps be useful in other scenarios and so instead of pulling this
out to `trace.ml` I decided to add a way for `decode_events` to have access to
a `Recording.Data.t` record. Open to alternative ideas though.
I also added a wiki page to document the options for `-callgraph-mode`. This is
not in the PR, but here is the link to the wiki repo:
https://github.com/Lamoreauxaj/magic-trace.wiki.git. See [this
page](https://github.com/Lamoreauxaj/magic-trace/wiki/Sampling-callgraph-modes).
If this PR is merged, this wiki page would need to be merged too (I referenced
it in the cli help documentation). And since I referenced it, the domain would
need to redirect to the wiki page.
Signed-off-by: Aaron Lamoreaux <alamoreaux@janestreet.com>
| 3 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Reformat using OxCaml's `ocamlformat`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Reformat using OxCaml's `ocamlformat`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Allow sharing traces with -share flag
Signed-off-by: Michael Jarrett <mjarrett@janestreet.com>
| 6 个月前 |
| Allow sharing traces with -share flag
Signed-off-by: Michael Jarrett <mjarrett@janestreet.com>
| 6 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Pin OxCaml opam repository to a specific commit
Nearly every time the OxCaml opam repository is updated, our GitHub Actions
break and likewise following the installation instructions from the Wiki fails.
Hopefully we can avoid this churn by pinning that repository to a particular
commit.
The `ocamlformat` changes in this commit are the consequence of a version update;
I've suppressed comment formatting to avoid most of the churn.
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 18 天前 |
| Recognize `int3` instructions in trace parser
Not quite sure why we'd be seeing this, but let's not crash when we do.
For now, treat a software interrupt as a jump.
Ref https://github.com/janestreet/magic-trace/issues/257
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Use OxCaml
Migrate the project from OCaml to [OxCaml](https://oxcaml.org/).
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Replace signals with perf controlfd where supported
Use perf controlfd to snapshot, cause snapshot-on-exit, and cleanly
shutdown perf, replacing SIGUSR2, SIGINT, and SIGTERM respectively.
Signed-off-by: Ilana Brooks <ibrooks@janestreet.com>
| 10 个月前 |
| Replace signals with perf controlfd where supported
Use perf controlfd to snapshot, cause snapshot-on-exit, and cleanly
shutdown perf, replacing SIGUSR2, SIGINT, and SIGTERM respectively.
Signed-off-by: Ilana Brooks <ibrooks@janestreet.com>
| 10 个月前 |
| Remove the perf ctlfd timeout
The operations perf is doing behind the scenes are effectively unbounded
depending on the parameters we pass it. We encountered an issue with
-multi-thread causing the snapshot itself to take too long.
If there's a real need for a timeout in the future, we can make it
configurable.
Signed-off-by: Ilana Brooks <ibrooks@janestreet.com>
| 17 天前 |
| Replace signals with perf controlfd where supported
Use perf controlfd to snapshot, cause snapshot-on-exit, and cleanly
shutdown perf, replacing SIGUSR2, SIGINT, and SIGTERM respectively.
Signed-off-by: Ilana Brooks <ibrooks@janestreet.com>
| 10 个月前 |
| Fix: regex errors for 'tr strt jmp' in modern Linux perf.
Signed-off-by: Ethan Van Der Heijden <ethanvanderheijden@gmail.com>
| 4 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Make dlfilter backend less aggressive about filtering out errors
Ref https://github.com/janestreet/magic-trace/issues/260
| 3 年前 |
| Added support to run perf with dlfilter which filters out jumps within same function
This addresses #32. Since 5.14, perf supports passing `--dlfilter file.so`. This
PR creates a filter which skips over any Intel PT events which are branches
within the same function. This filter is implemented in `perf_dlfilter.c` and
built into `perf_dlfilter.so` by dune and using ocaml-crunch compiled into the
ocaml executable for use.
Some things to note:
* There is a custom dune rule which builds the shared object. `ocaml-crunch` was
added as a dependency and now to build, `gcc` is also required.
* magic-trace will detect support in `perf_capabilities.ml` for `--dlfilter` by
checking the perf version. This ensures compatibility with older perf
versions.
* `perf_dlfilter.h` is the include header from perf which is required. It's
possible to use the system version, but placing it in magic-trace will ensure
one can build even if that include is not present.
How much faster is magic-trace using the dlfilter? When running on a demo
program, on a 19.194 MB perf.data file, running `perf script` goes from 1.980s
with 1308709 lines to 0.534s with 358954 lines. On a 180.123 MB perf.data file,
it goes from 110.279s with 75715521 lines to 53.746s with 20747507 lines. This
does not include magic-trace's decoding time, but this should scale linearly
with the number of lines.
A future feature however could be to use this dlfilter to also pass information
to ocaml without having to parse text using regex. However this feature alone is
still a significant improvement for now.
Signed-off-by: Aaron Lamoreaux <alamoreaux@janestreet.com>
| 3 年前 |
| Use OxCaml
Migrate the project from OCaml to [OxCaml](https://oxcaml.org/).
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Reformat using OxCaml's `ocamlformat`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Replace signals with perf controlfd where supported
Use perf controlfd to snapshot, cause snapshot-on-exit, and cleanly
shutdown perf, replacing SIGUSR2, SIGINT, and SIGTERM respectively.
Signed-off-by: Ilana Brooks <ibrooks@janestreet.com>
| 10 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Run clang-format over our C stubs
| 4 年前 |
| Accept expect-test changes due to updated version of `Quickcheck`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Fix typos
Signed-off-by: int-y1 <jason_yuen2007@hotmail.com>
| 2 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| .ocamlformat: 0.21 -> 0.24.1
Signed-off-by: Hao Lian <hi@haolian.org>
| 3 年前 |
| Drop dependency on `ocaml-probes`
We now do the `ptrace` dance ourselves.
| 4 年前 |
| Drop dependency on `ocaml-probes`
We now do the `ptrace` dance ourselves.
| 4 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Fix race condition on frequently hit breakpoint
Specifying a breakpoint `-trigger SYMBOL` on a `SYMBOL` that is
very frequently executed would oftentimes result in magic-trace
waiting indefinitely, never taking a snapshot. The root-cause
was that by default we configure breakpoints as single-hit, but
if the first hit occurs between the time where magic-trace creates
the breakpoint, and the time where it registers the breakpoint's
file descriptor with `epoll`, magic-trace never sees the notification.
This is fixed by only enabling the breakpoint after registering
its file descriptor with `epoll`.
Disclaimer: The initial commit was written entirely by Claude Opus 4.6,
but I performed manual cleanup.
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 1 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Recognize `int3` instructions in trace parser
Not quite sure why we'd be seeing this, but let's not crash when we do.
For now, treat a software interrupt as a jump.
Ref https://github.com/janestreet/magic-trace/issues/257
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Reformat using OxCaml's `ocamlformat`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Reformat using OxCaml's `ocamlformat`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Reformat using OxCaml's `ocamlformat`
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Use OxCaml
Migrate the project from OCaml to [OxCaml](https://oxcaml.org/).
Signed-off-by: Kevin Svetlitski <ksvetlitski@janestreet.com>
| 5 个月前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |
| Merge `core` and `src` directories
The split made sense back when we were pursuing a direct backend, but
now it only serves to confuse.
Signed-off-by: Tudor Brindus <tbrindus@janestreet.com>
| 1 年前 |