msg_vm_t vm;
unsigned int i;
- xbt_dynar_t worker_pms = MSG_process_get_data(MSG_process_self());
+ const_xbt_dynar_t worker_pms = MSG_process_get_data(MSG_process_self());
int nb_workers = xbt_dynar_length(worker_pms);
xbt_dynar_t vms = xbt_dynar_new(sizeof(msg_vm_t), NULL);
explicit ClusterZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
void get_local_route(NetPoint* src, NetPoint* dst, RouteCreationArgs* into, double* latency) override;
- void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
+ void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
virtual void create_links_for_node(ClusterCreationArgs* cluster, int id, int rank, unsigned int position);
/* There can't be route in an Empty zone */
}
- void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* /*nodes*/,
+ void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* /*nodes*/,
std::map<std::string, xbt_edge_t>* /*edges*/) override;
};
} // namespace routing
static void get_global_route(routing::NetPoint* src, routing::NetPoint* dst,
/* OUT */ std::vector<resource::LinkImpl*>& links, double* latency);
- virtual void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
+ virtual void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) = 0;
enum class RoutingMode {
unset = 0, /**< Undefined type */
public:
explicit RoutedZone(NetZoneImpl* father, const std::string& name, resource::NetworkModel* netmodel);
- void get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
+ void get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges) override;
protected:
} // namespace kernel
} // namespace simgrid
-XBT_PRIVATE xbt_node_t new_xbt_graph_node(xbt_graph_t graph, const char* name,
+XBT_PRIVATE xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name,
std::map<std::string, xbt_node_t>* nodes);
-XBT_PRIVATE xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d,
+XBT_PRIVATE xbt_edge_t new_xbt_graph_edge(const s_xbt_graph_t* graph, xbt_node_t s, xbt_node_t d,
std::map<std::string, xbt_edge_t>* edges);
#endif /* SIMGRID_ROUTING_GENERIC_HPP_ */
XBT_PUBLIC msg_comm_t MSG_task_irecv(msg_task_t* task, const char* alias);
XBT_PUBLIC msg_comm_t MSG_task_irecv_bounded(msg_task_t* task, const char* alias, double rate);
XBT_PUBLIC int MSG_comm_test(msg_comm_t comm);
-XBT_PUBLIC int MSG_comm_testany(xbt_dynar_t comms);
+XBT_PUBLIC int MSG_comm_testany(const_xbt_dynar_t comms);
XBT_PUBLIC void MSG_comm_destroy(const_msg_comm_t comm);
XBT_PUBLIC msg_error_t MSG_comm_wait(msg_comm_t comm, double timeout);
XBT_PUBLIC void MSG_comm_waitall(msg_comm_t* comm, int nb_elem, double timeout);
-XBT_PUBLIC int MSG_comm_waitany(xbt_dynar_t comms);
+XBT_PUBLIC int MSG_comm_waitany(const_xbt_dynar_t comms);
XBT_PUBLIC msg_task_t MSG_comm_get_task(const_msg_comm_t comm);
XBT_PUBLIC msg_error_t MSG_comm_get_status(const_msg_comm_t comm);
XBT_PUBLIC xbt_automaton_state_t xbt_automaton_get_current_state(const_xbt_automaton_t a);
XBT_PUBLIC int xbt_automaton_state_compare(const_xbt_automaton_state_t s1, const_xbt_automaton_state_t s2);
-XBT_PUBLIC int xbt_automaton_propositional_symbols_compare_value(xbt_dynar_t s1, xbt_dynar_t s2);
+XBT_PUBLIC int xbt_automaton_propositional_symbols_compare_value(const_xbt_dynar_t s1, const_xbt_dynar_t s2);
XBT_PUBLIC int xbt_automaton_transition_compare(const_xbt_automaton_transition_t t1,
const_xbt_automaton_transition_t t2);
XBT_PUBLIC int xbt_automaton_exp_label_compare(const_xbt_automaton_exp_label_t l1, const_xbt_automaton_exp_label_t l2);
XBT_PUBLIC void xbt_os_sleep(double sec);
typedef struct s_xbt_os_timer *xbt_os_timer_t;
+typedef const struct s_xbt_os_timer* const_xbt_os_timer_t;
XBT_PUBLIC xbt_os_timer_t xbt_os_timer_new(void);
XBT_PUBLIC void xbt_os_timer_free(xbt_os_timer_t timer);
-XBT_PUBLIC double xbt_os_timer_elapsed(xbt_os_timer_t timer);
+XBT_PUBLIC double xbt_os_timer_elapsed(const_xbt_os_timer_t timer);
XBT_PUBLIC size_t xbt_os_timer_size(void);
XBT_PUBLIC void xbt_os_walltimer_start(xbt_os_timer_t timer);
static std::vector<simgrid::instr::NetZoneContainer*> currentContainer; /* push and pop, used only in creation */
-static const char* instr_node_name(xbt_node_t node)
+static const char* instr_node_name(const s_xbt_node_t* node)
{
return static_cast<char*>(xbt_graph_node_get_data(node));
}
#define GRAPHICATOR_SUPPORT_FUNCTIONS
-static void recursiveXBTGraphExtraction(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
+static void recursiveXBTGraphExtraction(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges, const_sg_netzone_t netzone,
container_t container)
{
}
}
-void ClusterZone::get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
+void ClusterZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges)
{
xbt_assert(router_,
int src_id = src->id();
int dst_id = dst->id();
- xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_);
+ const_xbt_dynar_t nodes = xbt_graph_get_nodes(route_graph_);
/* Use the graph_node id mapping set to quickly find the nodes */
- xbt_node_t src_elm = node_map_search(src_id);
- xbt_node_t dst_elm = node_map_search(dst_id);
+ const s_xbt_node_t* src_elm = node_map_search(src_id);
+ const s_xbt_node_t* dst_elm = node_map_search(dst_id);
int src_node_id = static_cast<GraphNodeData*>(xbt_graph_node_get_data(src_elm))->graph_id_;
int dst_node_id = static_cast<GraphNodeData*>(xbt_graph_node_get_data(dst_elm))->graph_id_;
/* if the src and dst are the same */
if (src_node_id == dst_node_id) {
- xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src_node_id, xbt_node_t);
- xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst_node_id, xbt_node_t);
- xbt_edge_t edge = xbt_graph_get_edge(route_graph_, node_s_v, node_e_v);
+ const s_xbt_node_t* node_s_v = xbt_dynar_get_as(nodes, src_node_id, xbt_node_t);
+ const s_xbt_node_t* node_e_v = xbt_dynar_get_as(nodes, dst_node_id, xbt_node_t);
+ const s_xbt_edge_t* edge = xbt_graph_get_edge(route_graph_, node_s_v, node_e_v);
if (edge == nullptr)
throw std::invalid_argument(xbt::string_printf("No route from '%s' to '%s'", src->get_cname(), dst->get_cname()));
while (not pqueue.empty()) {
int v_id = pqueue.top().second;
pqueue.pop();
- xbt_node_t v_node = xbt_dynar_get_as(nodes, v_id, xbt_node_t);
+ const s_xbt_node_t* v_node = xbt_dynar_get_as(nodes, v_id, xbt_node_t);
xbt_edge_t edge = nullptr;
unsigned int cursor;
xbt_dynar_foreach (xbt_graph_node_get_outedges(v_node), cursor, edge) {
- xbt_node_t u_node = xbt_graph_edge_get_target(edge);
+ const s_xbt_node_t* u_node = xbt_graph_edge_get_target(edge);
const GraphNodeData* data = static_cast<GraphNodeData*>(xbt_graph_node_get_data(u_node));
int u_id = data->graph_id_;
const RouteCreationArgs* tmp_e_route = static_cast<RouteCreationArgs*>(xbt_graph_edge_get_data(edge));
NetPoint* first_gw = nullptr;
for (int v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
- xbt_node_t node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
- xbt_node_t node_v = xbt_dynar_get_as(nodes, v, xbt_node_t);
- xbt_edge_t edge = xbt_graph_get_edge(route_graph_, node_pred_v, node_v);
+ const s_xbt_node_t* node_pred_v = xbt_dynar_get_as(nodes, pred_arr[v], xbt_node_t);
+ const s_xbt_node_t* node_v = xbt_dynar_get_as(nodes, v, xbt_node_t);
+ const s_xbt_edge_t* edge = xbt_graph_get_edge(route_graph_, node_pred_v, node_v);
if (edge == nullptr)
throw std::invalid_argument(xbt::string_printf("No route from '%s' to '%s'", src->get_cname(), dst->get_cname()));
EmptyZone::~EmptyZone() = default;
-void EmptyZone::get_graph(xbt_graph_t /*graph*/, std::map<std::string, xbt_node_t>* /*nodes*/,
+void EmptyZone::get_graph(const s_xbt_graph_t* /*graph*/, std::map<std::string, xbt_node_t>* /*nodes*/,
std::map<std::string, xbt_edge_t>* /*edges*/)
{
XBT_ERROR("No routing no graph");
/* ***************************************************************** */
/* *********************** GENERIC METHODS ************************* */
-static const char* instr_node_name(xbt_node_t node)
+static const char* instr_node_name(const s_xbt_node_t* node)
{
const void* data = xbt_graph_node_get_data(node);
return static_cast<const char*>(data);
}
-xbt_node_t new_xbt_graph_node(xbt_graph_t graph, const char* name, std::map<std::string, xbt_node_t>* nodes)
+xbt_node_t new_xbt_graph_node(const s_xbt_graph_t* graph, const char* name, std::map<std::string, xbt_node_t>* nodes)
{
auto elm = nodes->find(name);
if (elm == nodes->end()) {
return elm->second;
}
-xbt_edge_t new_xbt_graph_edge(xbt_graph_t graph, xbt_node_t s, xbt_node_t d, std::map<std::string, xbt_edge_t>* edges)
+xbt_edge_t new_xbt_graph_edge(const s_xbt_graph_t* graph, xbt_node_t s, xbt_node_t d,
+ std::map<std::string, xbt_edge_t>* edges)
{
const char* sn = instr_node_name(s);
const char* dn = instr_node_name(d);
{
}
-void RoutedZone::get_graph(xbt_graph_t graph, std::map<std::string, xbt_node_t>* nodes,
+void RoutedZone::get_graph(const s_xbt_graph_t* graph, std::map<std::string, xbt_node_t>* nodes,
std::map<std::string, xbt_edge_t>* edges)
{
std::vector<NetPoint*> vertices = get_vertices();
* @return the position of the finished communication if any
* (but it may have failed, use MSG_comm_get_status() to know its status), or -1 if none is finished
*/
-int MSG_comm_testany(xbt_dynar_t comms)
+int MSG_comm_testany(const_xbt_dynar_t comms)
{
int finished_index = -1;
* @return the position of the first finished communication
* (but it may have failed, use MSG_comm_get_status() to know its status)
*/
-int MSG_comm_waitany(xbt_dynar_t comms)
+int MSG_comm_waitany(const_xbt_dynar_t comms)
{
int finished_index = -1;
return res;
}
-int xbt_automaton_propositional_symbols_compare_value(xbt_dynar_t s1, xbt_dynar_t s2){
+int xbt_automaton_propositional_symbols_compare_value(const_xbt_dynar_t s1, const_xbt_dynar_t s2)
+{
unsigned int nb_elem = xbt_dynar_length(s1);
for (unsigned int cursor = 0; cursor < nb_elem; cursor++) {
static xbt_automaton_t parsed_automaton;
char* state_id_src;
-static void new_state(char* id, int src){
+static void new_state(const char* id, int src)
+{
char* saveptr = NULL; // for strtok_r()
char* id_copy = xbt_strdup(id);
const char* first_part = strtok_r(id_copy, "_", &saveptr);
}
}
-static void new_transition(char* id, xbt_automaton_exp_label_t label)
+static void new_transition(const char* id, xbt_automaton_exp_label_t label)
{
new_state(id, 0);
xbt_automaton_state_t state_dst = xbt_automaton_state_exists(parsed_automaton, id);
void yyerror(const char *s);
-static void new_state(char* id, int src);
-static void new_transition(char* id, xbt_automaton_exp_label_t label);
+static void new_state(const char* id, int src);
+static void new_transition(const char* id, xbt_automaton_exp_label_t label);
#line 94 "parserPromela.tab.cacc"
void yyerror(const char *s);
-static void new_state(char* id, int src);
-static void new_transition(char* id, xbt_automaton_exp_label_t label);
+static void new_state(const char* id, int src);
+static void new_transition(const char* id, xbt_automaton_exp_label_t label);
%}
static void log_cat_exit(const s_xbt_log_category_t* cat)
{
- xbt_log_category_t child;
-
if (cat->appender) {
if (cat->appender->free_)
cat->appender->free_(cat->appender);
xbt_free(cat->layout);
}
- for (child = cat->firstChild; child != nullptr; child = child->nextSibling)
+ for (auto const* child = cat->firstChild; child != nullptr; child = child->nextSibling)
log_cat_exit(child);
}
"Priority %d is greater than the biggest allowed value", ev->priority);
while (1) {
- xbt_log_appender_t appender = cat->appender;
+ const s_xbt_log_appender_t* appender = cat->appender;
if (appender != nullptr) {
xbt_assert(cat->layout, "No valid layout for the appender of category %s", cat->name);
/** Initialize heapinfo about the heapinfo pages :)
*
*/
-static void initialize_heapinfo_heapinfo(xbt_mheap_t mdp)
+static void initialize_heapinfo_heapinfo(const s_xbt_mheap_t* mdp)
{
// Update heapinfo about the heapinfo pages (!):
xbt_assert((uintptr_t) mdp->heapinfo % BLOCKSIZE == 0);
return (result);
}
-void *__mmalloc_remap_core(xbt_mheap_t mdp)
+void* __mmalloc_remap_core(const s_xbt_mheap_t* mdp)
{
/* FIXME: Quick hack, needs error checking and other attention. */
/* Remap a mmalloc region that was previously mapped. */
-XBT_PUBLIC void* __mmalloc_remap_core(xbt_mheap_t mdp);
+XBT_PUBLIC void* __mmalloc_remap_core(const s_xbt_mheap_t* mdp);
XBT_PUBLIC void* mmorecore(struct mdesc* mdp, ssize_t size);
free(timer);
}
-double xbt_os_timer_elapsed(xbt_os_timer_t timer)
+double xbt_os_timer_elapsed(const_xbt_os_timer_t timer)
{
#if HAVE_POSIX_GETTIME && defined (_POSIX_THREAD_CPUTIME)
return ((double) timer->stop.tv_sec) - ((double) timer->start.tv_sec) + ((double) timer->elapse.tv_sec ) +
return nullptr;
}
-static void test_local_variable(simgrid::mc::ObjectInformation* info, const char* function, const char* variable, void* address, unw_cursor_t* cursor) {
+static void test_local_variable(simgrid::mc::ObjectInformation* info, const char* function, const char* variable,
+ const void* address, unw_cursor_t* cursor)
+{
simgrid::mc::Frame* subprogram = find_function_by_name(info, function);
assert(subprogram);
// TODO, Lookup frame by IP and test against name instead
xbt_assert(location.address() == address, "Bad resolution of local variable %s of %s", variable, function);
}
-static const simgrid::mc::Variable* test_global_variable(simgrid::mc::RemoteClient& process,
- simgrid::mc::ObjectInformation* info, const char* name,
+static const simgrid::mc::Variable* test_global_variable(const simgrid::mc::RemoteClient& process,
+ const simgrid::mc::ObjectInformation* info, const char* name,
void* address, long byte_size)
{
const simgrid::mc::Variable* variable = info->find_variable(name);
int i;
};
-static void test_type_by_name(simgrid::mc::RemoteClient& process, s_foo /*my_foo*/)
+static void test_type_by_name(const simgrid::mc::RemoteClient& process, s_foo /*my_foo*/)
{
assert(process.binary_info->full_types_by_name.find("struct s_foo") != process.binary_info->full_types_by_name.end());
}