Module: Serialbench::Models
- Defined in:
- lib/serialbench/models.rb,
lib/serialbench/models/result.rb,
lib/serialbench/models/platform.rb,
lib/serialbench/models/result_set.rb,
lib/serialbench/models/result_store.rb,
lib/serialbench/models/benchmark_config.rb,
lib/serialbench/models/benchmark_result.rb,
lib/serialbench/models/environment_config.rb
Defined Under Namespace
Classes: AdapterPerformance, AsdfEnvConfig, BenchmarkConfig, BenchmarkIteration, BenchmarkResult, DockerEnvConfig, EnvironmentConfig, IterationPerformance, MemoryPerformance, Platform, Result, ResultSet, ResultStore, RunMetadata, SerializerInformation
Class Method Summary collapse
- .create_resultset(name, run_paths_or_objects, metadata: {}) ⇒ Object
- .create_run(platform_string, benchmark_data, metadata: {}) ⇒ Object
- .from_data(data) ⇒ Object
-
.from_file(file_path) ⇒ Object
Factory method to create appropriate model based on data structure.
-
.result_store ⇒ Object
Convenience methods for the new OO architecture.
-
.to_json_file(result, file_path) ⇒ Object
Convert any benchmark result to JSON format (for HTML templates).
-
.to_yaml_file(result, file_path) ⇒ Object
Convert any benchmark result to YAML format.
Class Method Details
.create_resultset(name, run_paths_or_objects, metadata: {}) ⇒ Object
50 51 52 |
# File 'lib/serialbench/models.rb', line 50 def self.create_resultset(name, run_paths_or_objects, metadata: {}) ResultSet.create(name, run_paths_or_objects, metadata: ) end |
.create_run(platform_string, benchmark_data, metadata: {}) ⇒ Object
46 47 48 |
# File 'lib/serialbench/models.rb', line 46 def self.create_run(platform_string, benchmark_data, metadata: {}) Result.create(platform_string, benchmark_data, metadata: ) end |
.from_data(data) ⇒ Object
27 28 29 |
# File 'lib/serialbench/models.rb', line 27 def self.from_data(data) BenchmarkResult.new(data) end |
.from_file(file_path) ⇒ Object
Factory method to create appropriate model based on data structure
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/serialbench/models.rb', line 14 def self.from_file(file_path) case File.extname(file_path).downcase when '.yaml', '.yml' data = YAML.load_file(file_path) when '.json' data = JSON.parse(File.read(file_path)) else raise ArgumentError, "Unsupported file format: #{File.extname(file_path)}" end from_data(data) end |
.result_store ⇒ Object
Convenience methods for the new OO architecture
42 43 44 |
# File 'lib/serialbench/models.rb', line 42 def self.result_store ResultStore.default end |
.to_json_file(result, file_path) ⇒ Object
Convert any benchmark result to JSON format (for HTML templates)
37 38 39 |
# File 'lib/serialbench/models.rb', line 37 def self.to_json_file(result, file_path) result.to_json_file(file_path) end |
.to_yaml_file(result, file_path) ⇒ Object
Convert any benchmark result to YAML format
32 33 34 |
# File 'lib/serialbench/models.rb', line 32 def self.to_yaml_file(result, file_path) result.to_yaml_file(file_path) end |