Skip to content

Commit 87e0224

Browse files
committed
feat: add native tracer CLI
1 parent 0f3c634 commit 87e0224

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ ruby trace.rb <path to ruby file>
1616
# or in the folder of `$CODETRACER_DB_TRACE_PATH` if such an env var is defined
1717
```
1818

19+
You can also invoke a lightweight CLI that loads the native tracer extension
20+
directly:
21+
22+
```bash
23+
ruby src/native_trace.rb <path to ruby file>
24+
```
25+
1926
however you probably want to use it in combination with CodeTracer, which would be released soon.
2027

2128
### Development

src/native_trace.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env ruby
2+
# SPDX-License-Identifier: MIT
3+
# Simple utility loading the native tracer extension and executing a program.
4+
5+
if ARGV.empty?
6+
$stderr.puts("usage: ruby native_trace.rb <program> [args]")
7+
exit 1
8+
end
9+
10+
# Path to the compiled native extension
11+
ext_path = File.expand_path('../ext/native_tracer/target/release/libcodetracer_ruby_recorder', __dir__)
12+
require ext_path
13+
14+
program = ARGV.shift
15+
load program
16+

0 commit comments

Comments
 (0)