Sha256: 98b7580bf703af3dbb456aacf2a205a7afe9f660c22d6314a48ed362c2f6a43d

Contents?: true

Size: 1007 Bytes

Versions: 5

Compression:

Stored size: 1007 Bytes

Contents

module PerfMonger
module Command

class CoreFinder
  class << self
    def find(name, os = nil, arch = nil)
      # check os
      unless os
        case RUBY_PLATFORM
        when /linux/
          os = "linux"
        when /darwin/
          os = "darwin"
        else
          os = nil
        end
      end

      # check arch
      unless arch
        case RUBY_PLATFORM
        when /x86_64|amd64/
          arch = "amd64"
        when /i\d86/
          arch = "386"
        else
          arch = nil
        end
      end

      if !os || !arch
        return nil
      end

      suffix = "_" + os + "_" + arch

      path = File.expand_path("../../../exec/perfmonger-#{name}#{suffix}", __FILE__)

      if File.executable?(path)
        return path
      else
        return nil
      end
    end

    def recorder
      self.find("recorder")
    end

    def player
      self.find("player")
    end

    def summarizer
      self.find("summarizer")
    end
  end
end

end # module
end # module

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
perfmonger-0.8.2 lib/perfmonger/command/core.rb
perfmonger-0.8.1 lib/perfmonger/command/core.rb
perfmonger-0.8.0 lib/perfmonger/command/core.rb
perfmonger-0.7.1 lib/perfmonger/command/core.rb
perfmonger-0.7.0 lib/perfmonger/command/core.rb