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_RESOURCE_NETWORKMODELINTF_HPP
7 #define SIMGRID_KERNEL_RESOURCE_NETWORKMODELINTF_HPP
9 #include <simgrid/forward.h>
11 #include <unordered_set>
18 /** @ingroup SURF_interface
19 * @brief Network Model interface class
21 class XBT_PUBLIC NetworkModelIntf {
24 * @brief Callback to set the bandwidth and latency factors used in a communication
26 * This callback offers more flexibility when setting the network factors.
27 * It is an alternative to SimGrid's configs, such as network/latency-factors
28 * and network/bandwidth-factors.
30 * @param size Communication size in bytes
31 * @param src Source host
32 * @param dst Destination host
33 * @param links Vectors with the links used in this comm
34 * @param netzones Set with NetZones involved in the comm
35 * @return Multiply factor
37 using NetworkFactorCb = double(double size, const s4u::Host* src, const s4u::Host* dst,
38 const std::vector<s4u::Link*>& links,
39 const std::unordered_set<s4u::NetZone*>& netzones);
40 /** @brief Configure the latency factor callback */
41 virtual void set_lat_factor_cb(const std::function<NetworkFactorCb>& cb) = 0;
42 /** @brief Configure the bandwidth factor callback */
43 virtual void set_bw_factor_cb(const std::function<NetworkFactorCb>& cb) = 0;
46 } // namespace resource
48 } // namespace simgrid
50 #endif /* SIMGRID_KERNEL_RESOURCE_NETWORKMODELINTF_HPP */