mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-17 22:14:28 +01:00
Added a new Dart class called `RunDetails` to represent specific details related to a benchmark run. The class includes fields for: - The unique run identifier (`runId`) - The command used to initiate the benchmark (`command`) - The time the benchmark was completed (`completionTime`) - The time the benchmark started (`benchmarkStartTime`) - The name of the test being run (`testName`) Serialization and deserialization methods are also provided for JSON compatibility.
60 lines
2.1 KiB
Dart
60 lines
2.1 KiB
Dart
/// `RunDetails` encapsulates specific details about a benchmark run.
|
|
///
|
|
/// This class holds attributes such as the unique run identifier, the command used to initiate the run,
|
|
/// the time of completion, the time when the benchmark started, and the name of the test.
|
|
class RunDetails {
|
|
/// The unique identifier for the benchmark run, typically a UUID.
|
|
final String runId;
|
|
|
|
/// The command used to initiate the benchmark run.
|
|
final String command;
|
|
|
|
/// The completion time of the benchmark run as a `DateTime` object.
|
|
final DateTime completionTime;
|
|
|
|
/// The start time of the benchmark run as a `DateTime` object.
|
|
final DateTime benchmarkStartTime;
|
|
|
|
/// The name of the test associated with this benchmark run.
|
|
final String testName;
|
|
|
|
/// Constructs a new `RunDetails` instance.
|
|
///
|
|
/// [runId]: The unique identifier for the benchmark run.
|
|
/// [command]: The command used to initiate the run.
|
|
/// [completionTime]: The completion time of the run.
|
|
/// [benchmarkStartTime]: The start time of the run.
|
|
/// [testName]: The name of the test.
|
|
RunDetails({
|
|
required this.runId,
|
|
required this.command,
|
|
required this.completionTime,
|
|
required this.benchmarkStartTime,
|
|
required this.testName,
|
|
});
|
|
|
|
/// Creates a `RunDetails` instance from a map.
|
|
///
|
|
/// [json]: A map containing key-value pairs corresponding to `RunDetails` fields.
|
|
///
|
|
/// Returns a new `RunDetails` populated with values from the map.
|
|
factory RunDetails.fromJson(Map<String, dynamic> json) => RunDetails(
|
|
runId: json['run_id'],
|
|
command: json['command'],
|
|
completionTime: DateTime.parse(json['completion_time']),
|
|
benchmarkStartTime: DateTime.parse(json['benchmark_start_time']),
|
|
testName: json['test_name'],
|
|
);
|
|
|
|
/// Converts the `RunDetails` instance to a map.
|
|
///
|
|
/// Returns a map containing key-value pairs corresponding to `RunDetails` fields.
|
|
Map<String, dynamic> toJson() => {
|
|
'run_id': runId,
|
|
'command': command,
|
|
'completion_time': completionTime.toIso8601String(),
|
|
'benchmark_start_time': benchmarkStartTime.toIso8601String(),
|
|
'test_name': testName,
|
|
};
|
|
}
|