-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support installing the gem on TruffleRuby
* Fixes #159
- Loading branch information
Showing
7 changed files
with
82 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module StackProf | ||
# Define the same methods as stackprof.c | ||
class << self | ||
def running? | ||
false | ||
end | ||
|
||
def run(*args) | ||
unimplemented | ||
end | ||
|
||
def start(*args) | ||
unimplemented | ||
end | ||
|
||
def stop | ||
unimplemented | ||
end | ||
|
||
def results(*args) | ||
unimplemented | ||
end | ||
|
||
def sample | ||
unimplemented | ||
end | ||
|
||
def use_postponed_job! | ||
# noop | ||
end | ||
|
||
private def unimplemented | ||
raise "Use --cpusampler=flamegraph or --cpusampler instead of StackProf on TruffleRuby.\n" \ | ||
"See https://www.graalvm.org/tools/profiling/ and `ruby --help:cpusampler` for more details." | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -308,4 +308,4 @@ def idle | |
r.close | ||
w.close | ||
end | ||
end | ||
end unless RUBY_ENGINE == 'truffleruby' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
$:.unshift File.expand_path('../../lib', __FILE__) | ||
require 'stackprof' | ||
require 'minitest/autorun' | ||
|
||
if RUBY_ENGINE == 'truffleruby' | ||
class StackProfTruffleRubyTest < MiniTest::Test | ||
def test_error | ||
error = assert_raises RuntimeError do | ||
StackProf.run(mode: :cpu) do | ||
unreacheable | ||
end | ||
end | ||
|
||
assert_match(/TruffleRuby/, error.message) | ||
assert_match(/--cpusampler/, error.message) | ||
end | ||
end | ||
end |