Allow changing parameters during replay (#22071)

* replay: add scheduled parameter changes

* replay: store scheduled parameter change events as structs
This commit is contained in:
Daniel Mesham
2023-09-18 18:38:09 +02:00
committed by GitHub
parent 6bd13c5514
commit 15036c1761
2 changed files with 115 additions and 29 deletions
+20
View File
@@ -33,6 +33,7 @@
#pragma once
#include <algorithm>
#include <fstream>
#include <map>
#include <vector>
@@ -220,6 +221,23 @@ protected:
private:
std::set<std::string> _overridden_params;
struct ParameterChangeEvent {
uint64_t timestamp;
std::string parameter_name;
double parameter_value;
// Comparison operator such that sorting is done by timestamp
bool operator<(const ParameterChangeEvent &other) const
{
return timestamp < other.timestamp;
}
};
std::set<std::string> _dynamic_parameters;
std::vector<ParameterChangeEvent> _dynamic_parameter_schedule;
size_t _next_param_change;
std::map<std::string, std::string> _file_formats; ///< all formats we read from the file
uint64_t _file_start_time;
@@ -275,7 +293,9 @@ private:
/** get the size of a type that can be an array */
static size_t sizeOfFullType(const std::string &type_name_full);
void setParameter(const std::string &parameter_name, const double parameter_value);
void setUserParams(const char *filename);
void readDynamicParams(const char *filename);
std::string parseOrbFields(const std::string &fields);