Module: Serialbench::Models
- Defined in:
- lib/serialbench/models.rb,
lib/serialbench/models/result.rb,
lib/serialbench/models/platform.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, ResultStore, RunMetadata, SerializerInformation
Class Method Summary collapse
- .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_run(platform_string, benchmark_data, metadata: {}) ⇒ Object
45 46 47 |
# File 'lib/serialbench/models.rb', line 45 def self.create_run(platform_string, benchmark_data, metadata: {}) Result.create(platform_string, benchmark_data, metadata: ) end |
.from_data(data) ⇒ Object
26 27 28 |
# File 'lib/serialbench/models.rb', line 26 def self.from_data(data) BenchmarkResult.new(data) end |
.from_file(file_path) ⇒ Object
Factory method to create appropriate model based on data structure
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/serialbench/models.rb', line 13 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
41 42 43 |
# File 'lib/serialbench/models.rb', line 41 def self.result_store ResultStore.default end |
.to_json_file(result, file_path) ⇒ Object
Convert any benchmark result to JSON format (for HTML templates)
36 37 38 |
# File 'lib/serialbench/models.rb', line 36 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
31 32 33 |
# File 'lib/serialbench/models.rb', line 31 def self.to_yaml_file(result, file_path) result.to_yaml_file(file_path) end |