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.
122
123
124
125
|
# File 'lib/benchcc/compiler.rb', line 122
def initialize(binary)
@exe = `which #{binary}`.strip
raise "#{binary} not found" unless $?.success?
end
|
Instance Method Details
#compile_file(file, *args) ⇒ Object
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
# File 'lib/benchcc/compiler.rb', line 127
def compile_file(file, *args)
file = Pathname.new(file).expand_path
command = "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
145
|
# File 'lib/benchcc/compiler.rb', line 145
def constexpr_depth; 512; end
|
#template_depth ⇒ Object
144
|
# File 'lib/benchcc/compiler.rb', line 144
def template_depth; 900; end
|