1 /* Copyright (c) 2004-2022. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
6 #ifndef SIMGRID_KERNEL_PROFILE_STOCHASTICDATEDVALUE
7 #define SIMGRID_KERNEL_PROFILE_STOCHASTICDATEDVALUE
9 #include "simgrid/forward.h"
10 #include "simgrid/kernel/ProfileBuilder.hpp"
13 namespace simgrid::kernel::profile {
15 enum class Distribution { EXP, NORM, UNIF, DET };
17 class XBT_PUBLIC StochasticDatedValue {
19 Distribution date_law = Distribution::DET;
20 std::vector<double> date_params;
21 Distribution value_law = Distribution::DET;
22 std::vector<double> value_params;
23 DatedValue get_datedvalue() const;
24 double get_date() const;
25 double get_value() const;
26 explicit StochasticDatedValue() = default;
27 explicit StochasticDatedValue(double d, double v) : date_params({d}), value_params({v}) {}
28 explicit StochasticDatedValue(Distribution dl, const std::vector<double>& dp, Distribution vl,
29 const std::vector<double>& vp)
30 : date_law(dl), date_params(dp), value_law(vl), value_params(vp)
33 bool operator==(StochasticDatedValue const& e2) const;
36 static double draw(Distribution law, std::vector<double> params);
39 } // namespace simgrid::kernel::profile