Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
this should allow the tracing of resource usage with this model
[simgrid.git] / src / surf / surf_interface.hpp
1 /* Copyright (c) 2004-2018. The SimGrid Team. All rights reserved.          */
2
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. */
5
6 #ifndef SURF_MODEL_H_
7 #define SURF_MODEL_H_
8
9 #include "src/surf/surf_private.hpp"
10
11 #include <cmath>
12 #include <set>
13 #include <string>
14 #include <unordered_map>
15 #include <vector>
16
17 /*********
18  * Utils *
19  *********/
20
21 /* user-visible parameters */
22 XBT_PUBLIC_DATA double sg_maxmin_precision;
23 XBT_PUBLIC_DATA double sg_surf_precision;
24 XBT_PUBLIC_DATA int sg_concurrency_limit;
25
26 extern XBT_PRIVATE double sg_latency_factor;
27 extern XBT_PRIVATE double sg_bandwidth_factor;
28 extern XBT_PRIVATE double sg_weight_S_parameter;
29 extern XBT_PRIVATE std::vector<std::string> surf_path;
30 extern XBT_PRIVATE std::unordered_map<std::string, tmgr_trace_t> traces_set_list;
31 extern XBT_PRIVATE std::set<std::string> watched_hosts;
32
33 static inline void double_update(double* variable, double value, double precision)
34 {
35   // printf("Updating %g -= %g +- %g\n",*variable,value,precision);
36   // xbt_assert(value==0  || value>precision);
37   // Check that precision is higher than the machine-dependent size of the mantissa. If not, brutal rounding  may
38   // happen, and the precision mechanism is not active...
39   // xbt_assert(*variable< (2<<DBL_MANT_DIG)*precision && FLT_RADIX==2);
40   *variable -= value;
41   if (*variable < precision)
42     *variable = 0.0;
43 }
44
45 static inline int double_positive(double value, double precision)
46 {
47   return (value > precision);
48 }
49
50 static inline int double_equals(double value1, double value2, double precision)
51 {
52   return (fabs(value1 - value2) < precision);
53 }
54
55 /** \ingroup SURF_simulation
56  *  \brief List of hosts that have just restarted and whose autorestart process should be restarted.
57  */
58 XBT_PUBLIC_DATA std::vector<sg_host_t> host_that_restart;
59
60 int XBT_PRIVATE __surf_is_absolute_file_path(const char *file_path);
61
62 /**********
63  * Action *
64  **********/
65
66 /** \ingroup SURF_models
67  *  \brief List of initialized models
68  */
69 XBT_PUBLIC_DATA std::vector<simgrid::kernel::resource::Model*>* all_existing_models;
70
71 #endif /* SURF_MODEL_H_ */