mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-26 23:19:07 +00:00
chore: Make Calibration type a non singleton
This commit is contained in:
@@ -195,13 +195,6 @@ Calibration::Calibration()
|
||||
{
|
||||
}
|
||||
|
||||
Calibration const&
|
||||
Calibration::instance()
|
||||
{
|
||||
static Calibration const kValue;
|
||||
return kValue;
|
||||
}
|
||||
|
||||
double
|
||||
declaredGas(std::string_view wasmName)
|
||||
{
|
||||
@@ -217,10 +210,10 @@ report(
|
||||
std::string_view wasmName,
|
||||
bool throughVm)
|
||||
{
|
||||
auto const perGas = Calibration::instance().secondsPerGas();
|
||||
auto calibration = Calibration{};
|
||||
auto const perGas = calibration.secondsPerGas();
|
||||
auto const implied = perGas > 0.0 ? secondsPerCall / perGas : 0.0;
|
||||
auto const suggested =
|
||||
throughVm ? implied : implied + Calibration::instance().crossingFloorGas();
|
||||
auto const suggested = throughVm ? implied : implied + calibration.crossingFloorGas();
|
||||
|
||||
state.counters["implied_gas"] = implied;
|
||||
state.counters["ns_per_call"] = secondsPerCall * 1e9;
|
||||
|
||||
@@ -94,10 +94,7 @@ timeRun(HostFunctions& host, Bytes const& wasm);
|
||||
class Calibration
|
||||
{
|
||||
public:
|
||||
// The machine's calibration, measured on first use. Measuring runs a few hundred short
|
||||
// contracts, so the first case to ask pays for it and every later case reads this answer.
|
||||
static Calibration const&
|
||||
instance();
|
||||
Calibration();
|
||||
|
||||
// Seconds of wall time one unit of gas buys here.
|
||||
[[nodiscard]] double
|
||||
@@ -115,8 +112,6 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Calibration();
|
||||
|
||||
double secondsPerGas_{};
|
||||
double crossingFloorGas_{};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user