Module: BatchExperiment::FirstLineExtractor
- Extended by:
- Extractor
- Defined in:
- lib/batch_experiment/sample_extractors.rb
Overview
A very simple sample extractor that extracts the first line of the command output, the run time and the memory usage (the last two are automatically added to any command output by ::batch and ::experiment).
Class Method Summary collapse
-
.extract_from_lines(lines) ⇒ Array<String>
Optionally, you can define this method instead of #extract.
-
.names ⇒ Array<String>
Return the field names for each of the elements returned by extract.
Methods included from Extractor
extract, extract_from_lines, get_field, get_hfield, names
Class Method Details
.extract_from_lines(lines) ⇒ Array<String>
Optionally, you can define this method instead of #extract. The #extract method will call this method if not overrided.
15 16 17 18 19 20 |
# File 'lib/batch_experiment/sample_extractors.rb', line 15 def self.extract_from_lines(lines) [ (lines[0] or ''), Extractor.get_field(lines, 'ext_time'), Extractor.get_field(lines, 'ext_mem') ] end |
.names ⇒ Array<String>
Note:
To be on the safe side you should create a new array at each call. If you always return a reference to the same array the array can be modified.
Return the field names for each of the elements returned by extract. Ex.:
['Time', 'Max Mem Use', 'opt', ... ]
10 11 12 |
# File 'lib/batch_experiment/sample_extractors.rb', line 10 def self.names ['first_line', 'ext_time', 'ext_mem'] end |