forked from ruby/lrama
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move
Lrama::Report::Profile
to Lrama::Report::Profile::CallStack
- Loading branch information
Showing
5 changed files
with
55 additions
and
48 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,3 @@ | ||
# rbs_inline: enabled | ||
# frozen_string_literal: true | ||
|
||
module Lrama | ||
class Report | ||
module Profile | ||
# See "Call-stack Profiling Lrama" in README.md for how to use. | ||
# | ||
# @rbs enabled: bool | ||
# @rbs &: -> void | ||
# @rbs return: StackProf::result | void | ||
def self.report_profile(enabled) | ||
if enabled && require_stackprof | ||
StackProf.run(mode: :cpu, raw: true, out: 'tmp/stackprof-cpu-myapp.dump') do | ||
yield | ||
end | ||
else | ||
yield | ||
end | ||
end | ||
|
||
# @rbs return: bool | ||
def self.require_stackprof | ||
require "stackprof" | ||
true | ||
rescue LoadError | ||
warn "stackprof is not installed. Please run `bundle install`." | ||
false | ||
end | ||
end | ||
end | ||
end | ||
require_relative 'profile/call_stack' |
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,34 @@ | ||
# rbs_inline: enabled | ||
# frozen_string_literal: true | ||
|
||
module Lrama | ||
class Report | ||
module Profile | ||
module CallStack | ||
# See "Call-stack Profiling Lrama" in README.md for how to use. | ||
# | ||
# @rbs enabled: bool | ||
# @rbs &: -> void | ||
# @rbs return: StackProf::result | void | ||
def self.report_profile(enabled) | ||
if enabled && require_stackprof | ||
StackProf.run(mode: :cpu, raw: true, out: 'tmp/stackprof-cpu-myapp.dump') do | ||
yield | ||
end | ||
else | ||
yield | ||
end | ||
end | ||
|
||
# @rbs return: bool | ||
def self.require_stackprof | ||
require "stackprof" | ||
true | ||
rescue LoadError | ||
warn "stackprof is not installed. Please run `bundle install`." | ||
false | ||
end | ||
end | ||
end | ||
end | ||
end |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
# Generated from lib/lrama/report/profile/call_stack.rb with RBS::Inline | ||
|
||
module Lrama | ||
class Report | ||
module Profile | ||
module CallStack | ||
# See "Call-stack Profiling Lrama" in README.md for how to use. | ||
# | ||
# @rbs enabled: bool | ||
# @rbs &: -> void | ||
# @rbs return: StackProf::result | void | ||
def self.report_profile: (bool enabled) { () -> void } -> (StackProf::result | void) | ||
|
||
# @rbs return: bool | ||
def self.require_stackprof: () -> bool | ||
end | ||
end | ||
end | ||
end |