1 /* Copyright (c) 2004-2023. 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. */
9 #include "src/simgrid/module.hpp"
10 #include <xbt/asserts.h>
11 #include <xbt/function_types.h>
13 #include "src/internal_config.h"
14 #include "src/kernel/resource/profile/Profile.hpp"
21 #include <unordered_map>
28 /* user-visible parameters */
29 XBT_PUBLIC_DATA double sg_maxmin_precision;
30 XBT_PUBLIC_DATA double sg_surf_precision;
31 XBT_PUBLIC_DATA int sg_concurrency_limit;
33 extern XBT_PRIVATE std::unordered_map<std::string, simgrid::kernel::profile::Profile*> traces_set_list;
35 /** set of hosts for which one want to be notified if they ever restart */
36 inline auto& watched_hosts() // avoid static initialization order fiasco
38 static std::set<std::string, std::less<>> value;
42 static inline void double_update(double* variable, double value, double precision)
45 fprintf(stderr, "Updating %g -= %g +- %g\n", *variable, value, precision);
46 xbt_assert(value == 0.0 || value > precision);
47 // Check that precision is higher than the machine-dependent size of the mantissa. If not, brutal rounding may
48 // happen, and the precision mechanism is not active...
49 xbt_assert(FLT_RADIX == 2 && *variable < precision * exp2(DBL_MANT_DIG));
52 if (*variable < precision)
56 static inline int double_positive(double value, double precision)
58 return (value > precision);
61 static inline int double_equals(double value1, double value2, double precision)
63 return (fabs(value1 - value2) < precision);
66 XBT_PUBLIC void surf_vm_model_init_HL13();
68 #endif /* SURF_MODEL_H_ */