Skip to content

Misleading documentation: the native recorder seems to be using rb_add_event_hook2, *not* the "TracePoint API" #112

@nickysn

Description

@nickysn

The current README states:

Current approach: TracePoint API

Currently we're using the [TracePoint API](https://rubyapi.org/3.4/o/tracepoint). This is very flexible and can function with probably multiple Ruby versions out of the box. However, this is limited:

    it's not optimal
    it can't track more detailed info/state, needed for some CodeTracer features(or for more optimal replays).

For other languages, we've used a more deeply integrated approach: patching the interpreter or VM itself (e.g. Noir).

Possible Alternative Approaches

Create a C extension for the VM, based on the rb_add_event_hook2
This would be a straight-forward port of the current code, but developed as a native extension (e.g. in C/C++ or Rust). The expected speedup will be significant.

Examining the source code of the native recorder, written in Rust lead to the discovery that we're already using the undocumented rb_add_event_hook2() API function, mentioned as "Possible Alternative Approaches", with the undocumented RUBY_EVENT_HOOK_FLAG_RAW_ARG parameter. I'm not sure about the "Pure" Ruby recorder, though. This still needs to be checked, but the documentation needs to be updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions