Class: PerfMonger::Command::CoreFinder

Inherits:
Object
  • Object
show all
Defined in:
lib/perfmonger/command/core.rb

Class Method Summary collapse

Class Method Details

.find(name, os = nil, arch = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/perfmonger/command/core.rb', line 7

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

.playerObject



51
52
53
# File 'lib/perfmonger/command/core.rb', line 51

def player
  self.find("player")
end

.plot_formatterObject



59
60
61
# File 'lib/perfmonger/command/core.rb', line 59

def plot_formatter
  self.find("plot-formatter")
end

.recorderObject



47
48
49
# File 'lib/perfmonger/command/core.rb', line 47

def recorder
  self.find("recorder")
end

.summarizerObject



55
56
57
# File 'lib/perfmonger/command/core.rb', line 55

def summarizer
  self.find("summarizer")
end