Sha256: 58ffc2c5da4aaab60824d1faa854c5485069478007f60656bf97d25cad874129

Contents?: true

Size: 517 Bytes

Versions: 2

Compression:

Stored size: 517 Bytes

Contents

# frozen_string_literal: true

require_relative 'pf2/pf2'
require_relative 'pf2/session'
require_relative 'pf2/version'

module Pf2
  class Error < StandardError; end

  def self.start(...)
    @@session = Pf2::Session.new(...)
    @@session.start
  end

  def self.stop
    @@session.stop
  end

  def self.profile(&block)
    raise ArgumentError, "block required" unless block_given?
    start(threads: Thread.list)
    yield
    result = stop
    @@session = nil # let GC clean up the session
    result
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pf2-0.7.1 lib/pf2.rb
pf2-0.7.0 lib/pf2.rb