Sha256: a046369b2a904eb2e40cb15e7ca8a7ad60951acb9df1d999ea862d95c55c9f71

Contents?: true

Size: 671 Bytes

Versions: 7

Compression:

Stored size: 671 Bytes

Contents

module Lrama
  class Report
    module Profile
      # 1. Wrap target method with Profile.report_profile like below:
      #
      #   Lrama::Report::Profile.report_profile { method }
      #
      # 2. Run lrama command, for example
      #
      #   $ ./exe/lrama --trace=time spec/fixtures/integration/ruby_3_2_0/parse.tmp.y
      #
      # 3. Generate html file
      #
      #   $ stackprof --d3-flamegraph tmp/stackprof-cpu-myapp.dump > tmp/flamegraph.html
      #
      def self.report_profile
        require "stackprof"

        StackProf.run(mode: :cpu, raw: true, out: 'tmp/stackprof-cpu-myapp.dump') do
          yield
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
lrama-0.5.9 lib/lrama/report/profile.rb
lrama-0.5.8 lib/lrama/report/profile.rb
lrama-0.5.7 lib/lrama/report/profile.rb
lrama-0.5.6 lib/lrama/report/profile.rb
lrama-0.5.5 lib/lrama/report/profile.rb
lrama-0.5.4 lib/lrama/report/profile.rb
lrama-0.5.3 lib/lrama/report/profile.rb