Class: Benchcc::GCC
Instance Method Summary
collapse
Methods inherited from Compiler
#compile_code, guess_from_binary, #to_s
Constructor Details
#initialize(binary) ⇒ GCC
Returns a new instance of GCC.
130
131
132
133
|
# File 'lib/benchcc/compiler.rb', line 130
def initialize(binary)
@exe = `which #{binary}`.strip
raise "#{binary} not found" unless $?.success?
end
|
Instance Method Details
#compile_file(file, *args) ⇒ Object
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
# File 'lib/benchcc/compiler.rb', line 135
def compile_file(file, *args)
file = Pathname.new(file).expand_path
command = "/usr/bin/time -l #{@exe} #{args.join(' ')} -ftime-report #{file}"
stdout, stderr, status = Open3.capture3(command)
result = CompilationResult.new
result.stderr = stderr
result.stdout = stdout
result.code = file.read
result.command_line = command
raise CompilationError.new(result) unless status.success?
result.peak_memusg = stderr.match(/(\d+)\s+maximum/)[1].to_i
result.wall_time = stderr.match(/TOTAL.+/).to_s.split[-3].to_f
return result
end
|
#constexpr_depth ⇒ Object
153
|
# File 'lib/benchcc/compiler.rb', line 153
def constexpr_depth; 512; end
|
#template_depth ⇒ Object
152
|
# File 'lib/benchcc/compiler.rb', line 152
def template_depth; 900; end
|