Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' into 'python_bindings_host_load_plugin'
[simgrid.git] / include / simgrid / instr.h
1 /* Copyright (c) 2010-2023. 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 INSTR_H_
7 #define INSTR_H_
8
9 #include <simgrid/engine.h>
10
11 #ifdef __cplusplus
12 #include <set>
13 #include <string>
14
15 namespace simgrid::instr {
16 /* User-variables related functions*/
17 /* for host variables */
18 XBT_PUBLIC void declare_host_variable(const std::string& variable, const std::string& color = "");
19 XBT_PUBLIC void set_host_variable(const std::string& host, const std::string& variable, double value,
20                                   double time = simgrid_get_clock());
21 XBT_PUBLIC void add_host_variable(const std::string& host, const std::string& variable, double value,
22                                   double time = simgrid_get_clock());
23 XBT_PUBLIC void sub_host_variable(const std::string& host, const std::string& variable, double value,
24                                   double time = simgrid_get_clock());
25 XBT_PUBLIC const std::set<std::string, std::less<>>& get_host_variables();
26
27 /* for link variables */
28 XBT_PUBLIC void declare_link_variable(const std::string& variable, const std::string& color = "");
29 XBT_PUBLIC void set_link_variable(const std::string& link, const std::string& variable, double value,
30                                   double time = simgrid_get_clock());
31 XBT_PUBLIC void add_link_variable(const std::string& link, const std::string& variable, double value,
32                                   double time = simgrid_get_clock());
33 XBT_PUBLIC void sub_link_variable(const std::string& link, const std::string& variable, double value,
34                                   double time = simgrid_get_clock());
35 /* for link variables, but with src and dst used for get_route */
36 XBT_PUBLIC void set_link_variable(const std::string& src, const std::string& dst, const std::string& variable,
37                                   double value, double time = simgrid_get_clock());
38 XBT_PUBLIC void add_link_variable(const std::string& src, const std::string& dst, const std::string& variable,
39                                   double value, double time = simgrid_get_clock());
40 XBT_PUBLIC void sub_link_variable(const std::string& src, const std::string& dst, const std::string& variable,
41                                   double value, double time = simgrid_get_clock());
42 XBT_PUBLIC const std::set<std::string, std::less<>>& get_link_variables();
43
44 /* for VM variables */
45 XBT_PUBLIC void declare_vm_variable(const std::string& variable, const std::string& color = "");
46 XBT_PUBLIC void set_vm_variable(const std::string& vm, const std::string& variable, double value,
47                                 double time = simgrid_get_clock());
48 XBT_PUBLIC void add_vm_variable(const std::string& vm, const std::string& variable, double value,
49                                 double time = simgrid_get_clock());
50 XBT_PUBLIC void sub_vm_variable(const std::string& vm, const std::string& variable, double value,
51                                 double time = simgrid_get_clock());
52 XBT_PUBLIC const std::set<std::string, std::less<>>& get_vm_variables();
53
54 /*  Functions to manage tracing marks (used for trace comparison experiments) */
55 XBT_PUBLIC void declare_mark(const std::string& mark_type);
56 XBT_PUBLIC void declare_mark_value(const std::string& mark_type, const std::string& mark_value,
57                                    const std::string& mark_color = "1 1 1");
58 XBT_PUBLIC void mark(const std::string& mark_type, const std::string& mark_value);
59 XBT_PUBLIC const std::set<std::string, std::less<>>& get_marks();
60
61 XBT_PUBLIC void declare_tracing_category(const std::string& name, const std::string& color = "");
62 XBT_PUBLIC const std::set<std::string, std::less<>>& get_tracing_categories();
63
64 /* Function used by graphicator (transform a SimGrid platform file in a graphviz dot file with the network topology) */
65 XBT_PUBLIC void platform_graph_export_graphviz(const std::string& output_filename);
66 /* Function used by graphicator (transform a SimGrid platform file in a CSV file with the network topology) */
67 XBT_PUBLIC void platform_graph_export_csv(const std::string& output_filename);
68 } // namespace simgrid::instr
69
70 #endif
71 SG_BEGIN_DECL
72
73 /* Functions to manage tracing categories */
74 XBT_PUBLIC void TRACE_smpi_set_category(const char* category);
75
76 XBT_PUBLIC void TRACE_host_state_declare(const char* state);
77 XBT_PUBLIC void TRACE_host_state_declare_value(const char* state, const char* value, const char* color);
78 XBT_PUBLIC void TRACE_host_set_state(const char* host, const char* state, const char* value);
79 XBT_PUBLIC void TRACE_host_push_state(const char* host, const char* state, const char* value);
80 XBT_PUBLIC void TRACE_host_pop_state(const char* host, const char* state);
81
82 SG_END_DECL
83
84 #endif /* INSTR_H_ */