I used the following command: (the '**' means recursion in ZSH)
sed -i -e 's/\([^_]\s*\)NULL/\1nullptr/g' src/**/*.cpp
We check for the underscore to avoid replacing MPI_*_NULL
35 files changed:
int table_size = xbt_dynar_length(vertices_);
NetCard *src;
int table_size = xbt_dynar_length(vertices_);
NetCard *src;
- xbt_node_t current, previous, backboneNode = NULL, routerNode;
+ xbt_node_t current, previous, backboneNode = nullptr, routerNode;
s_surf_parsing_link_up_down_t info;
xbt_assert(router_,"Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph.");
s_surf_parsing_link_up_down_t info;
xbt_assert(router_,"Malformed cluster. This may be because your platform file is a hypergraph while it must be a graph.");
xbt_dynar_t dimensions = xbt_str_split(cluster->topo_parameters, ",");
if (!xbt_dynar_is_empty(dimensions)) {
xbt_dynar_t dimensions = xbt_str_split(cluster->topo_parameters, ",");
if (!xbt_dynar_is_empty(dimensions)) {
- dimensions_ = xbt_dynar_new(sizeof(int), NULL);
+ dimensions_ = xbt_dynar_new(sizeof(int), nullptr);
/* We are in a torus cluster
* Parse attribute dimensions="dim1,dim2,dim3,...,dimN"
* and safe it in a dynarray.
/* We are in a torus cluster
* Parse attribute dimensions="dim1,dim2,dim3,...,dimN"
* and safe it in a dynarray.
namespace surf {
void AsDijkstra::seal()
{
namespace surf {
void AsDijkstra::seal()
{
- xbt_node_t node = NULL;
+ xbt_node_t node = nullptr;
unsigned int cursor2, cursor;
/* Create the topology graph */
if(!routeGraph_)
unsigned int cursor2, cursor;
/* Create the topology graph */
if(!routeGraph_)
- routeGraph_ = xbt_graph_new_graph(1, NULL);
+ routeGraph_ = xbt_graph_new_graph(1, nullptr);
if(!graphNodeMap_)
graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
/* Add the loopback if needed */
if (routing_platf->loopback_ && hierarchy_ == RoutingMode::base) {
xbt_dynar_foreach(xbt_graph_get_nodes(routeGraph_), cursor, node) {
if(!graphNodeMap_)
graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
/* Add the loopback if needed */
if (routing_platf->loopback_ && hierarchy_ == RoutingMode::base) {
xbt_dynar_foreach(xbt_graph_get_nodes(routeGraph_), cursor, node) {
- xbt_edge_t edge = NULL;
+ xbt_edge_t edge = nullptr;
bool found = false;
xbt_dynar_foreach(xbt_graph_node_get_outedges(node), cursor2, edge) {
bool found = false;
xbt_dynar_foreach(xbt_graph_node_get_outedges(node), cursor2, edge) {
xbt_node_t AsDijkstra::routeGraphNewNode(int id, int graph_id)
{
xbt_node_t AsDijkstra::routeGraphNewNode(int id, int graph_id)
{
- xbt_node_t node = NULL;
- graph_node_data_t data = NULL;
- graph_node_map_element_t elm = NULL;
+ xbt_node_t node = nullptr;
+ graph_node_data_t data = nullptr;
+ graph_node_map_element_t elm = nullptr;
data = xbt_new0(struct graph_node_data, 1);
data->id = id;
data = xbt_new0(struct graph_node_data, 1);
data->id = id;
elm = xbt_new0(struct graph_node_map_element, 1);
elm->node = node;
elm = xbt_new0(struct graph_node_map_element, 1);
elm->node = node;
- xbt_dict_set_ext(graphNodeMap_, (char *) (&id), sizeof(int), (xbt_dictelm_t) elm, NULL);
+ xbt_dict_set_ext(graphNodeMap_, (char *) (&id), sizeof(int), (xbt_dictelm_t) elm, nullptr);
void AsDijkstra::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route)
{
XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
void AsDijkstra::newRoute(int src_id, int dst_id, sg_platf_route_cbarg_t e_route)
{
XBT_DEBUG("Load Route from \"%d\" to \"%d\"", src_id, dst_id);
- xbt_node_t src = NULL;
- xbt_node_t dst = NULL;
+ xbt_node_t src = nullptr;
+ xbt_node_t dst = nullptr;
graph_node_map_element_t src_elm = nodeMapSearch(src_id);
graph_node_map_element_t dst_elm = nodeMapSearch(dst_id);
graph_node_map_element_t src_elm = nodeMapSearch(src_id);
graph_node_map_element_t dst_elm = nodeMapSearch(dst_id);
dst = dst_elm->node;
/* add nodes if they don't exist in the graph */
dst = dst_elm->node;
/* add nodes if they don't exist in the graph */
- if (src_id == dst_id && src == NULL && dst == NULL) {
+ if (src_id == dst_id && src == nullptr && dst == nullptr) {
src = this->routeGraphNewNode(src_id, -1);
dst = src;
} else {
src = this->routeGraphNewNode(src_id, -1);
dst = src;
} else {
src = this->routeGraphNewNode(src_id, -1);
}
src = this->routeGraphNewNode(src_id, -1);
}
dst = this->routeGraphNewNode(dst_id, -1);
}
}
dst = this->routeGraphNewNode(dst_id, -1);
}
}
int src_id = src->id();
int dst_id = dst->id();
int src_id = src->id();
int dst_id = dst->id();
+ int *pred_arr = nullptr;
sg_platf_route_cbarg_t e_route;
int size = 0;
xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
sg_platf_route_cbarg_t e_route;
int size = 0;
xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
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(routeGraph_, node_s_v, node_e_v);
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(routeGraph_, node_s_v, node_e_v);
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name(), dst->name());
e_route = (sg_platf_route_cbarg_t) xbt_graph_edge_get_data(edge);
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name(), dst->name());
e_route = (sg_platf_route_cbarg_t) xbt_graph_edge_get_data(edge);
- route_cache_element_t elm = NULL;
+ route_cache_element_t elm = nullptr;
if (routeCache_) { /* cache mode */
elm = (route_cache_element_t) xbt_dict_get_or_null_ext(routeCache_, (char *) (&src_id), sizeof(int));
}
if (routeCache_) { /* cache mode */
elm = (route_cache_element_t) xbt_dict_get_or_null_ext(routeCache_, (char *) (&src_id), sizeof(int));
}
while (xbt_heap_size(pqueue) > 0) {
int *v_id = (int *) xbt_heap_pop(pqueue);
xbt_node_t v_node = xbt_dynar_get_as(nodes, *v_id, xbt_node_t);
while (xbt_heap_size(pqueue) > 0) {
int *v_id = (int *) xbt_heap_pop(pqueue);
xbt_node_t v_node = xbt_dynar_get_as(nodes, *v_id, xbt_node_t);
- xbt_edge_t edge = NULL;
+ xbt_edge_t edge = nullptr;
unsigned int cursor;
xbt_dynar_foreach(xbt_graph_node_get_outedges(v_node), cursor, edge) {
unsigned int cursor;
xbt_dynar_foreach(xbt_graph_node_get_outedges(v_node), cursor, edge) {
}
/* compose route path with links */
}
/* compose route path with links */
- NetCard *gw_src = NULL, *gw_dst, *prev_gw_src, *first_gw = NULL;
- NetCard *gw_dst_net_elm = NULL, *prev_gw_src_net_elm = NULL;
+ NetCard *gw_src = nullptr, *gw_dst, *prev_gw_src, *first_gw = nullptr;
+ NetCard *gw_dst_net_elm = nullptr, *prev_gw_src_net_elm = 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(routeGraph_, node_pred_v, node_v);
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(routeGraph_, node_pred_v, node_v);
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name(), dst->name());
prev_gw_src = gw_src;
THROWF(arg_error, 0, "No route from '%s' to '%s'", src->name(), dst->name());
prev_gw_src = gw_src;
if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && strcmp(gw_dst->name(), prev_gw_src->name())) {
std::vector<Link*> *e_route_as_to_as = new std::vector<Link*>();
if (hierarchy_ == RoutingMode::recursive && v != dst_node_id && strcmp(gw_dst->name(), prev_gw_src->name())) {
std::vector<Link*> *e_route_as_to_as = new std::vector<Link*>();
- routing_platf->getRouteAndLatency(gw_dst_net_elm, prev_gw_src_net_elm, e_route_as_to_as, NULL);
+ routing_platf->getRouteAndLatency(gw_dst_net_elm, prev_gw_src_net_elm, e_route_as_to_as, nullptr);
auto pos = route->link_list->begin();
for (auto link : *e_route_as_to_as) {
route->link_list->insert(pos, link);
auto pos = route->link_list->begin();
for (auto link : *e_route_as_to_as) {
route->link_list->insert(pos, link);
route->gw_dst = first_gw;
}
route->gw_dst = first_gw;
}
- if (routeCache_ && elm == NULL) {
+ if (routeCache_ && elm == nullptr) {
/* add to predecessor list of the current src-host to cache */
elm = xbt_new0(struct route_cache_element, 1);
elm->pred_arr = pred_arr;
elm->size = size;
/* add to predecessor list of the current src-host to cache */
elm = xbt_new0(struct route_cache_element, 1);
elm->pred_arr = pred_arr;
elm->size = size;
- xbt_dict_set_ext(routeCache_, (char *) (&src_id), sizeof(int), (xbt_dictelm_t) elm, NULL);
+ xbt_dict_set_ext(routeCache_, (char *) (&src_id), sizeof(int), (xbt_dictelm_t) elm, nullptr);
/* Create the topology graph */
if(!routeGraph_)
/* Create the topology graph */
if(!routeGraph_)
- routeGraph_ = xbt_graph_new_graph(1, NULL);
+ routeGraph_ = xbt_graph_new_graph(1, nullptr);
if(!graphNodeMap_)
graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
if(!graphNodeMap_)
graphNodeMap_ = xbt_dict_new_homogeneous(&graph_node_map_elem_free);
AsFloyd::AsFloyd(const char*name)
: AsRoutedGraph(name)
{
AsFloyd::AsFloyd(const char*name)
: AsRoutedGraph(name)
{
- predecessorTable_ = NULL;
- costTable_ = NULL;
- linkTable_ = NULL;
+ predecessorTable_ = nullptr;
+ costTable_ = nullptr;
+ linkTable_ = nullptr;
}
AsFloyd::~AsFloyd(){
int i, j;
int table_size = (int)xbt_dynar_length(vertices_);
}
AsFloyd::~AsFloyd(){
int i, j;
int table_size = (int)xbt_dynar_length(vertices_);
- if (linkTable_ == NULL) // Dealing with a parse error in the file?
+ if (linkTable_ == nullptr) // Dealing with a parse error in the file?
return;
/* Delete link_table */
for (i = 0; i < table_size; i++)
return;
/* Delete link_table */
for (i = 0; i < table_size; i++)
getRouteCheckParams(src, dst);
/* create a result route */
getRouteCheckParams(src, dst);
/* create a result route */
- xbt_dynar_t route_stack = xbt_dynar_new(sizeof(sg_platf_route_cbarg_t), NULL);
+ xbt_dynar_t route_stack = xbt_dynar_new(sizeof(sg_platf_route_cbarg_t), nullptr);
int pred;
int cur = dst->id();
do {
int pred;
int cur = dst->id();
do {
route->gw_dst = xbt_dynar_getfirst_as(route_stack, sg_platf_route_cbarg_t)->gw_dst;
}
route->gw_dst = xbt_dynar_getfirst_as(route_stack, sg_platf_route_cbarg_t)->gw_dst;
}
- sg_netcard_t prev_dst_gw = NULL;
+ sg_netcard_t prev_dst_gw = nullptr;
while (!xbt_dynar_is_empty(route_stack)) {
sg_platf_route_cbarg_t e_route = xbt_dynar_pop_as(route_stack, sg_platf_route_cbarg_t);
while (!xbt_dynar_is_empty(route_stack)) {
sg_platf_route_cbarg_t e_route = xbt_dynar_pop_as(route_stack, sg_platf_route_cbarg_t);
- if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != NULL && strcmp(prev_dst_gw->name(), e_route->gw_src->name())) {
+ if (hierarchy_ == RoutingMode::recursive && prev_dst_gw != nullptr && strcmp(prev_dst_gw->name(), e_route->gw_src->name())) {
routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src, route->link_list, lat);
}
routing_platf->getRouteAndLatency(prev_dst_gw, e_route->gw_src, route->link_list, lat);
}
for (int j = 0; j < table_size; j++) {
TO_FLOYD_COST(i, j) = DBL_MAX;
TO_FLOYD_PRED(i, j) = -1;
for (int j = 0; j < table_size; j++) {
TO_FLOYD_COST(i, j) = DBL_MAX;
TO_FLOYD_PRED(i, j) = -1;
- TO_FLOYD_LINK(i, j) = NULL;
+ TO_FLOYD_LINK(i, j) = nullptr;
for (unsigned int j = 0; j < table_size; j++) {
TO_FLOYD_COST(i, j) = DBL_MAX;
TO_FLOYD_PRED(i, j) = -1;
for (unsigned int j = 0; j < table_size; j++) {
TO_FLOYD_COST(i, j) = DBL_MAX;
TO_FLOYD_PRED(i, j) = -1;
- TO_FLOYD_LINK(i, j) = NULL;
+ TO_FLOYD_LINK(i, j) = nullptr;
sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i);
if (!e_route) {
e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
sg_platf_route_cbarg_t e_route = TO_FLOYD_LINK(i, i);
if (!e_route) {
e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
- e_route->gw_src = NULL;
- e_route->gw_dst = NULL;
+ e_route->gw_src = nullptr;
+ e_route->gw_dst = nullptr;
e_route->link_list = new std::vector<Link*>();
e_route->link_list->push_back(routing_platf->loopback_);
TO_FLOYD_LINK(i, i) = e_route;
e_route->link_list = new std::vector<Link*>();
e_route->link_list->push_back(routing_platf->loopback_);
TO_FLOYD_LINK(i, i) = e_route;
e_route = TO_ROUTE_FULL(i, i);
if (!e_route) {
e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
e_route = TO_ROUTE_FULL(i, i);
if (!e_route) {
e_route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
- e_route->gw_src = NULL;
- e_route->gw_dst = NULL;
+ e_route->gw_src = nullptr;
+ e_route->gw_dst = nullptr;
e_route->link_list = new std::vector<Link*>();
e_route->link_list->push_back(routing_platf->loopback_);
TO_ROUTE_FULL(i, i) = e_route;
e_route->link_list = new std::vector<Link*>();
e_route->link_list->push_back(routing_platf->loopback_);
TO_ROUTE_FULL(i, i) = e_route;
/* set utils vars */
size_t table_size = xbt_dynar_length(vertices_);
/* set utils vars */
size_t table_size = xbt_dynar_length(vertices_);
- sg_platf_route_cbarg_t e_route = NULL;
+ sg_platf_route_cbarg_t e_route = nullptr;
e_route = TO_ROUTE_FULL(src->id(), dst->id());
e_route = TO_ROUTE_FULL(src->id(), dst->id());
}
xbt_dynar_t AsImpl::getOneLinkRoutes() {
}
xbt_dynar_t AsImpl::getOneLinkRoutes() {
}
/** @brief Get the common ancestor and its first childs in each line leading to src and dst */
}
/** @brief Get the common ancestor and its first childs in each line leading to src and dst */
xbt_assert(dst_as, "Host %s must be in an AS", dst->name());
/* (2) find the path to the root routing component */
xbt_assert(dst_as, "Host %s must be in an AS", dst->name());
/* (2) find the path to the root routing component */
- for (AsImpl *current = src_as; current != NULL; current = static_cast<AsImpl*>(current->father())) {
+ for (AsImpl *current = src_as; current != nullptr; current = static_cast<AsImpl*>(current->father())) {
xbt_assert(index_src < ROUTING_HIERARCHY_MAXDEPTH, "ROUTING_HIERARCHY_MAXDEPTH should be increased for element %s", src->name());
path_src[index_src++] = current;
}
xbt_assert(index_src < ROUTING_HIERARCHY_MAXDEPTH, "ROUTING_HIERARCHY_MAXDEPTH should be increased for element %s", src->name());
path_src[index_src++] = current;
}
- for (AsImpl *current = dst_as; current != NULL; current = static_cast<AsImpl*>(current->father())) {
+ for (AsImpl *current = dst_as; current != nullptr; current = static_cast<AsImpl*>(current->father())) {
xbt_assert(index_dst < ROUTING_HIERARCHY_MAXDEPTH,"ROUTING_HIERARCHY_MAXDEPTH should be increased for path_dst");
path_dst[index_dst++] = current;
}
/* (3) find the common father.
xbt_assert(index_dst < ROUTING_HIERARCHY_MAXDEPTH,"ROUTING_HIERARCHY_MAXDEPTH should be increased for path_dst");
path_dst[index_dst++] = current;
}
/* (3) find the common father.
- * Before that, index_src and index_dst may be different, they both point to NULL in path_src/path_dst
+ * Before that, index_src and index_dst may be different, they both point to nullptr in path_src/path_dst
* So we move them down simultaneously as long as they point to the same content.
*/
do {
* So we move them down simultaneously as long as they point to the same content.
*/
do {
/* PRECONDITION: this is the common ancestor of src and dst */
std::vector<surf::Link*> *AsImpl::getBypassRoute(surf::NetCard *src, surf::NetCard *dst)
{
/* PRECONDITION: this is the common ancestor of src and dst */
std::vector<surf::Link*> *AsImpl::getBypassRoute(surf::NetCard *src, surf::NetCard *dst)
{
- // If never set a bypass route return NULL without any further computations
+ // If never set a bypass route return nullptr without any further computations
XBT_DEBUG("generic_get_bypassroute from %s to %s", src->name(), dst->name());
if (bypassRoutes_.empty())
return nullptr;
XBT_DEBUG("generic_get_bypassroute from %s to %s", src->name(), dst->name());
if (bypassRoutes_.empty())
return nullptr;
/* (2) find the path to the root routing component */
std::vector<As*> path_src;
As *current = src->containingAS();
/* (2) find the path to the root routing component */
std::vector<As*> path_src;
As *current = src->containingAS();
- while (current != NULL) {
+ while (current != nullptr) {
path_src.push_back(current);
current = current->father_;
}
std::vector<As*> path_dst;
current = dst->containingAS();
path_src.push_back(current);
current = current->father_;
}
std::vector<As*> path_dst;
current = dst->containingAS();
- while (current != NULL) {
+ while (current != nullptr) {
path_dst.push_back(current);
current = current->father_;
}
path_dst.push_back(current);
current = current->father_;
}
* \param src the source host
* \param dst the destination host
* \param links Where to store the links and the gw information
* \param src the source host
* \param dst the destination host
* \param links Where to store the links and the gw information
- * \param latency If not NULL, the latency of all links will be added in it
+ * \param latency If not nullptr, the latency of all links will be added in it
*/
void AsImpl::getRouteRecursive(surf::NetCard *src, surf::NetCard *dst,
/* OUT */ std::vector<surf::Link*> * links, double *latency)
*/
void AsImpl::getRouteRecursive(surf::NetCard *src, surf::NetCard *dst,
/* OUT */ std::vector<surf::Link*> * links, double *latency)
route.link_list = new std::vector<surf::Link*>();
common_ancestor->getRouteAndLatency(src_ancestor->netcard_, dst_ancestor->netcard_, &route, latency);
route.link_list = new std::vector<surf::Link*>();
common_ancestor->getRouteAndLatency(src_ancestor->netcard_, dst_ancestor->netcard_, &route, latency);
- xbt_assert((route.gw_src != NULL) && (route.gw_dst != NULL),
+ xbt_assert((route.gw_src != nullptr) && (route.gw_dst != nullptr),
"bad gateways for route from \"%s\" to \"%s\"", src->name(), dst->name());
/* If source gateway is not our source, we have to recursively find our way up to this point */
"bad gateways for route from \"%s\" to \"%s\"", src->name(), dst->name());
/* If source gateway is not our source, we have to recursively find our way up to this point */
return ret;
ret = xbt_graph_new_node(graph, xbt_strdup(name));
return ret;
ret = xbt_graph_new_node(graph, xbt_strdup(name));
- xbt_dict_set(nodes, name, ret, NULL);
+ xbt_dict_set(nodes, name, ret, nullptr);
snprintf(name, len, "%s%s", sn, dn);
xbt_edge_t ret = (xbt_edge_t) xbt_dict_get_or_null(edges, name);
snprintf(name, len, "%s%s", sn, dn);
xbt_edge_t ret = (xbt_edge_t) xbt_dict_get_or_null(edges, name);
snprintf(name, len, "%s%s", dn, sn);
ret = (xbt_edge_t) xbt_dict_get_or_null(edges, name);
}
snprintf(name, len, "%s%s", dn, sn);
ret = (xbt_edge_t) xbt_dict_get_or_null(edges, name);
}
- if (ret == NULL) {
- ret = xbt_graph_new_edge(graph, s, d, NULL);
- xbt_dict_set(edges, name, ret, NULL);
+ if (ret == nullptr) {
+ ret = xbt_graph_new_edge(graph, s, d, nullptr);
+ xbt_dict_set(edges, name, ret, nullptr);
}
free(name);
return ret;
}
free(name);
return ret;
route->link_list->clear();
NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*);
NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*);
route->link_list->clear();
NetCard *src_elm = xbt_dynar_get_as(vertices_, src, NetCard*);
NetCard *dst_elm = xbt_dynar_get_as(vertices_, dst, NetCard*);
- this->getRouteAndLatency(src_elm, dst_elm,route, NULL);
+ this->getRouteAndLatency(src_elm, dst_elm,route, nullptr);
if (route->link_list->size() == 1) {
Link *link = route->link_list->at(0);
if (route->link_list->size() == 1) {
Link *link = route->link_list->at(0);
else if (hierarchy_ == RoutingMode::recursive)
onelink = new Onelink(link, route->gw_src, route->gw_dst);
else
else if (hierarchy_ == RoutingMode::recursive)
onelink = new Onelink(link, route->gw_src, route->gw_dst);
else
- onelink = new Onelink(link, NULL, NULL);
+ onelink = new Onelink(link, nullptr, nullptr);
xbt_dynar_push(ret, &onelink);
}
}
xbt_dynar_push(ret, &onelink);
}
}
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = new std::vector<Link*>();
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = new std::vector<Link*>();
- getRouteAndLatency(my_src, my_dst, route, NULL);
+ getRouteAndLatency(my_src, my_dst, route, nullptr);
XBT_DEBUG ("get_route_and_latency %s -> %s", my_src->name(), my_dst->name());
XBT_DEBUG ("get_route_and_latency %s -> %s", my_src->name(), my_dst->name());
"The hierarchy of this AS is neither BASIC nor RECURSIVE, I'm lost here.");
if (hierarchy == RoutingMode::recursive) {
"The hierarchy of this AS is neither BASIC nor RECURSIVE, I'm lost here.");
if (hierarchy == RoutingMode::recursive) {
- xbt_assert(routearg->gw_src && routearg->gw_dst, "NULL is obviously a deficient gateway");
+ xbt_assert(routearg->gw_src && routearg->gw_dst, "nullptr is obviously a deficient gateway");
result->gw_src = routearg->gw_src;
result->gw_dst = routearg->gw_dst;
result->gw_src = routearg->gw_src;
result->gw_dst = routearg->gw_dst;
void AsRoutedGraph::getRouteCheckParams(NetCard *src, NetCard *dst)
{
void AsRoutedGraph::getRouteCheckParams(NetCard *src, NetCard *dst)
{
- xbt_assert(src,"Cannot find a route from NULL to %s", dst->name());
- xbt_assert(dst,"Cannot find a route from %s to NULL", src->name());
+ xbt_assert(src,"Cannot find a route from nullptr to %s", dst->name());
+ xbt_assert(dst,"Cannot find a route from %s to nullptr", src->name());
As *src_as = src->containingAS();
As *dst_as = dst->containingAS();
As *src_as = src->containingAS();
As *dst_as = dst->containingAS();
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_host, surf,
"Logging specific to the SURF host module");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_host, surf,
"Logging specific to the SURF host module");
-simgrid::surf::HostModel *surf_host_model = NULL;
+simgrid::surf::HostModel *surf_host_model = nullptr;
/*************
* Callbacks *
/*************
* Callbacks *
double *bytes_amount,
double rate){
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
double *bytes_amount,
double rate){
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
+ Action *action =nullptr;
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0)){
action = host_list[0]->pimpl_cpu->execution_start(flops_amount[0]);
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0)){
action = host_list[0]->pimpl_cpu->execution_start(flops_amount[0]);
simgrid::surf::Storage *HostImpl::findStorageOnMountList(const char* mount)
{
simgrid::surf::Storage *HostImpl::findStorageOnMountList(const char* mount)
{
- simgrid::surf::Storage *st = NULL;
+ simgrid::surf::Storage *st = nullptr;
s_mount_t mnt;
unsigned int cursor;
s_mount_t mnt;
unsigned int cursor;
{
s_mount_t mnt;
unsigned int i;
{
s_mount_t mnt;
unsigned int i;
- xbt_dict_t storage_list = xbt_dict_new_homogeneous(NULL);
- char *storage_name = NULL;
+ xbt_dict_t storage_list = xbt_dict_new_homogeneous(nullptr);
+ char *storage_name = nullptr;
xbt_dynar_foreach(p_storage,i,mnt){
storage_name = (char *)static_cast<simgrid::surf::Storage*>(mnt.storage)->getName();
xbt_dynar_foreach(p_storage,i,mnt){
storage_name = (char *)static_cast<simgrid::surf::Storage*>(mnt.storage)->getName();
- xbt_dict_set(storage_list,mnt.name,storage_name,NULL);
+ xbt_dict_set(storage_list,mnt.name,storage_name,nullptr);
xbt_lib_cursor_t cursor;
char *key;
void **data;
xbt_lib_cursor_t cursor;
char *key;
void **data;
- xbt_dynar_t result = xbt_dynar_new(sizeof(void*), NULL);
+ xbt_dynar_t result = xbt_dynar_new(sizeof(void*), nullptr);
xbt_lib_foreach(storage_lib, cursor, key, data) {
xbt_lib_foreach(storage_lib, cursor, key, data) {
- if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
+ if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
if(!strcmp((const char*)storage->p_attach,this->getName())){
xbt_dynar_push_as(result, void *, (void*)storage->getName());
simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
if(!strcmp((const char*)storage->p_attach,this->getName())){
xbt_dynar_push_as(result, void *, (void*)storage->getName());
Action *HostImpl::open(const char* fullpath) {
Action *HostImpl::open(const char* fullpath) {
- simgrid::surf::Storage *st = NULL;
+ simgrid::surf::Storage *st = nullptr;
s_mount_t mnt;
unsigned int cursor;
size_t longest_prefix_length = 0;
s_mount_t mnt;
unsigned int cursor;
size_t longest_prefix_length = 0;
- char *path = NULL;
- char *file_mount_name = NULL;
- char *mount_name = NULL;
+ char *path = nullptr;
+ char *file_mount_name = nullptr;
+ char *mount_name = nullptr;
XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, getName());
xbt_dynar_foreach(p_storage,cursor,mnt)
XBT_DEBUG("Search for storage name for '%s' on '%s'", fullpath, getName());
xbt_dynar_foreach(p_storage,cursor,mnt)
simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = fd->size;
simgrid::surf::Storage *st = findStorageOnMountList(fd->mount);
sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = fd->size;
- xbt_dynar_t info = xbt_dynar_new(sizeof(void*), NULL);
+ xbt_dynar_t info = xbt_dynar_new(sizeof(void*), nullptr);
xbt_dynar_push_as(info, sg_size_t *, psize);
xbt_dynar_push_as(info, void *, fd->mount);
xbt_dynar_push_as(info, void *, (void *)st->getName());
xbt_dynar_push_as(info, sg_size_t *, psize);
xbt_dynar_push_as(info, void *, fd->mount);
xbt_dynar_push_as(info, void *, (void *)st->getName());
strncpy(path, fullpath+strlen(fd->mount),
strlen(fullpath)-strlen(fd->mount)+1);
xbt_dict_set(findStorageOnMountList(fd->mount)->p_content, path,
strncpy(path, fullpath+strlen(fd->mount),
strlen(fullpath)-strlen(fd->mount)+1);
xbt_dict_set(findStorageOnMountList(fd->mount)->p_content, path,
XBT_DEBUG("Move file from %s to %s, size '%llu'",fd->name, fullpath, *psize);
free(path);
return 0;
XBT_DEBUG("Move file from %s to %s, size '%llu'",fd->name, fullpath, *psize);
free(path);
return 0;
xbt_dynar_t HostImpl::getVms()
{
xbt_dynar_t HostImpl::getVms()
{
- xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachine*), NULL);
+ xbt_dynar_t dyn = xbt_dynar_new(sizeof(simgrid::surf::VirtualMachine*), nullptr);
/* iterate for all virtual machines */
for (simgrid::surf::VMModel::vm_list_t::iterator iter =
/* iterate for all virtual machines */
for (simgrid::surf::VMModel::vm_list_t::iterator iter =
xbt_dict_free(&properties_);
}
xbt_dict_free(&properties_);
}
-/** @brief Return the property associated to the provided key (or NULL if not existing) */
+/** @brief Return the property associated to the provided key (or nullptr if not existing) */
const char *PropertyHolder::getProperty(const char*key) {
const char *PropertyHolder::getProperty(const char*key) {
- if (properties_ == NULL)
- return NULL;
+ if (properties_ == nullptr)
+ return nullptr;
return (const char*) xbt_dict_get_or_null(properties_,key);
}
return (const char*) xbt_dict_get_or_null(properties_,key);
}
maxminSystem_ = lmm_system_new(selectiveUpdate_);
if (getUpdateMechanism() == UM_LAZY) {
maxminSystem_ = lmm_system_new(selectiveUpdate_);
if (getUpdateMechanism() == UM_LAZY) {
- actionHeap_ = xbt_heap_new(8, NULL);
+ actionHeap_ = xbt_heap_new(8, nullptr);
xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
modifiedSet_ = new ActionLmmList();
maxminSystem_->keep_track = modifiedSet_;
xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
modifiedSet_ = new ActionLmmList();
maxminSystem_->keep_track = modifiedSet_;
CpuCas01Model::~CpuCas01Model()
{
lmm_system_free(maxminSystem_);
CpuCas01Model::~CpuCas01Model()
{
lmm_system_free(maxminSystem_);
+ maxminSystem_ = nullptr;
xbt_heap_free(actionHeap_);
delete modifiedSet_;
xbt_heap_free(actionHeap_);
delete modifiedSet_;
- surf_cpu_model_pm = NULL;
+ surf_cpu_model_pm = nullptr;
delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
}
delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
}
/** @brief take into account changes of speed (either load or max) */
void CpuCas01::onSpeedChange() {
/** @brief take into account changes of speed (either load or max) */
void CpuCas01::onSpeedChange() {
- lmm_variable_t var = NULL;
- lmm_element_t elem = NULL;
+ lmm_variable_t var = nullptr;
+ lmm_element_t elem = nullptr;
lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(),
coresAmount_ * speed_.scale * speed_.peak);
lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(),
coresAmount_ * speed_.scale * speed_.peak);
turnOn();
} else {
lmm_constraint_t cnst = getConstraint();
turnOn();
} else {
lmm_constraint_t cnst = getConstraint();
- lmm_variable_t var = NULL;
- lmm_element_t elem = NULL;
+ lmm_variable_t var = nullptr;
+ lmm_element_t elem = nullptr;
double date = surf_get_clock();
turnOff();
double date = surf_get_clock();
turnOff();
XBT_LOG_EXTERNAL_CATEGORY(surf_kernel);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf, "Logging specific to the SURF cpu module");
XBT_LOG_EXTERNAL_CATEGORY(surf_kernel);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_cpu, surf, "Logging specific to the SURF cpu module");
-void_f_void_t surf_cpu_model_init_preparse = NULL;
+void_f_void_t surf_cpu_model_init_preparse = nullptr;
simgrid::surf::CpuModel *surf_cpu_model_pm;
simgrid::surf::CpuModel *surf_cpu_model_vm;
simgrid::surf::CpuModel *surf_cpu_model_pm;
simgrid::surf::CpuModel *surf_cpu_model_vm;
void CpuModel::updateActionsStateFull(double now, double delta)
{
void CpuModel::updateActionsStateFull(double now, double delta)
{
- CpuAction *action = NULL;
+ CpuAction *action = nullptr;
ActionList *running_actions = getRunningActionSet();
for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
ActionList *running_actions = getRunningActionSet();
for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
* Resource *
************/
Cpu::Cpu(Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
* Resource *
************/
Cpu::Cpu(Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
- : Cpu(model, host, NULL/*constraint*/, speedPerPstate, core)
+ : Cpu(model, host, nullptr/*constraint*/, speedPerPstate, core)
void Cpu::setStateTrace(tmgr_trace_t trace)
{
void Cpu::setStateTrace(tmgr_trace_t trace)
{
- xbt_assert(stateEvent_==NULL,"Cannot set a second state trace to Host %s", host_->name().c_str());
+ xbt_assert(stateEvent_==nullptr,"Cannot set a second state trace to Host %s", host_->name().c_str());
stateEvent_ = future_evt_set->add_trace(trace, 0.0, this);
}
void Cpu::setSpeedTrace(tmgr_trace_t trace)
{
stateEvent_ = future_evt_set->add_trace(trace, 0.0, this);
}
void Cpu::setSpeedTrace(tmgr_trace_t trace)
{
- xbt_assert(speed_.event==NULL,"Cannot set a second speed trace to Host %s", host_->name().c_str());
+ xbt_assert(speed_.event==nullptr,"Cannot set a second speed trace to Host %s", host_->name().c_str());
speed_.event = future_evt_set->add_trace(trace, 0.0, this);
}
speed_.event = future_evt_set->add_trace(trace, 0.0, this);
}
modifiedCpu_ = new CpuTiList();
modifiedCpu_ = new CpuTiList();
- tiActionHeap_ = xbt_heap_new(8, NULL);
+ tiActionHeap_ = xbt_heap_new(8, nullptr);
xbt_heap_set_update_callback(tiActionHeap_,
cpu_ti_action_update_index_heap);
}
CpuTiModel::~CpuTiModel()
{
xbt_heap_set_update_callback(tiActionHeap_,
cpu_ti_action_update_index_heap);
}
CpuTiModel::~CpuTiModel()
{
- surf_cpu_model_pm = NULL;
+ surf_cpu_model_pm = nullptr;
delete runningActionSetThatDoesNotNeedBeingChecked_;
delete modifiedCpu_;
xbt_heap_free(tiActionHeap_);
delete runningActionSetThatDoesNotNeedBeingChecked_;
delete modifiedCpu_;
xbt_heap_free(tiActionHeap_);
xbt_dynar_get_cpy(speedPerPstate, 0, &speed_.peak);
XBT_DEBUG("CPU create: peak=%f", speed_.peak);
xbt_dynar_get_cpy(speedPerPstate, 0, &speed_.peak);
XBT_DEBUG("CPU create: peak=%f", speed_.peak);
- speedIntegratedTrace_ = new CpuTiTgmr(NULL, 1/*scale*/);
+ speedIntegratedTrace_ = new CpuTiTgmr(nullptr, 1/*scale*/);
void bottleneck_solve(lmm_system_t sys)
{
void *_var, *_var_next, *_cnst, *_cnst_next, *_elem;
void bottleneck_solve(lmm_system_t sys)
{
void *_var, *_var_next, *_cnst, *_cnst_next, *_elem;
- lmm_variable_t var = NULL;
- lmm_constraint_t cnst = NULL;
+ lmm_variable_t var = nullptr;
+ lmm_constraint_t cnst = nullptr;
s_lmm_constraint_t s_cnst;
s_lmm_constraint_t s_cnst;
- lmm_element_t elem = NULL;
- xbt_swag_t cnst_list = NULL;
- xbt_swag_t var_list = NULL;
- xbt_swag_t elem_list = NULL;
+ lmm_element_t elem = nullptr;
+ xbt_swag_t cnst_list = nullptr;
+ xbt_swag_t var_list = nullptr;
+ xbt_swag_t elem_list = nullptr;
int i;
static s_xbt_swag_t cnst_to_update;
int i;
static s_xbt_swag_t cnst_to_update;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
static int platform_created = 0; /* indicate whether the platform file has been traced */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_routing, instr, "Tracing platform hierarchy");
static int platform_created = 0; /* indicate whether the platform file has been traced */
-static xbt_dynar_t currentContainer = NULL; /* push and pop, used only in creation */
+static xbt_dynar_t currentContainer = nullptr; /* push and pop, used only in creation */
static const char *instr_node_name (xbt_node_t node)
{
static const char *instr_node_name (xbt_node_t node)
{
if (a1->father == a2->father) return a1->father;
//create an array with all ancestors of a1
if (a1->father == a2->father) return a1->father;
//create an array with all ancestors of a1
- xbt_dynar_t ancestors_a1 = xbt_dynar_new(sizeof(container_t), NULL);
+ xbt_dynar_t ancestors_a1 = xbt_dynar_new(sizeof(container_t), nullptr);
container_t p;
p = a1->father;
while (p){
container_t p;
p = a1->father;
while (p){
}
//create an array with all ancestors of a2
}
//create an array with all ancestors of a2
- xbt_dynar_t ancestors_a2 = xbt_dynar_new(sizeof(container_t), NULL);
+ xbt_dynar_t ancestors_a2 = xbt_dynar_new(sizeof(container_t), nullptr);
p = a2->father;
while (p){
xbt_dynar_push_as (ancestors_a2, container_t, p);
p = a2->father;
while (p){
xbt_dynar_push_as (ancestors_a2, container_t, p);
}
//find the lowest ancestor
}
//find the lowest ancestor
int i = xbt_dynar_length (ancestors_a1) - 1;
int j = xbt_dynar_length (ancestors_a2) - 1;
while (i >= 0 && j >= 0){
int i = xbt_dynar_length (ancestors_a1) - 1;
int j = xbt_dynar_length (ancestors_a2) - 1;
while (i >= 0 && j >= 0){
xbt_die ("common father unknown, this is a tracing problem");
}
xbt_die ("common father unknown, this is a tracing problem");
}
+ if (filter != nullptr){
//check if we already register this pair (we only need one direction)
char aux1[INSTR_DEFAULT_STR_SIZE], aux2[INSTR_DEFAULT_STR_SIZE];
snprintf (aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", src->name, dst->name);
//check if we already register this pair (we only need one direction)
char aux1[INSTR_DEFAULT_STR_SIZE], aux2[INSTR_DEFAULT_STR_SIZE];
snprintf (aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", src->name, dst->name);
}
//ok, not found, register it
}
//ok, not found, register it
- xbt_dict_set (filter, aux1, xbt_strdup ("1"), NULL);
- xbt_dict_set (filter, aux2, xbt_strdup ("1"), NULL);
+ xbt_dict_set (filter, aux1, xbt_strdup ("1"), nullptr);
+ xbt_dict_set (filter, aux2, xbt_strdup ("1"), nullptr);
src->type->name, src->type->id,
dst->type->name, dst->type->id);
type_t link_type = PJ_type_get_or_null (link_typename, father->type);
src->type->name, src->type->id,
dst->type->name, dst->type->id);
type_t link_type = PJ_type_get_or_null (link_typename, father->type);
- if (link_type == NULL){
+ if (link_type == nullptr){
link_type = PJ_type_link_new (link_typename, father->type, src->type, dst->type);
}
//register EDGE types for triva configuration
link_type = PJ_type_link_new (link_typename, father->type, src->type, dst->type);
}
//register EDGE types for triva configuration
- xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), NULL);
+ xbt_dict_set (trivaEdgeTypes, link_type->name, xbt_strdup("1"), nullptr);
//create the link
static long long counter = 0;
//create the link
static long long counter = 0;
}
XBT_DEBUG ("Graph extraction for routing_component = %s", as->name());
if (!xbt_dict_is_empty(as->children())){
}
XBT_DEBUG ("Graph extraction for routing_component = %s", as->name());
if (!xbt_dict_is_empty(as->children())){
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
AS_t rc_son;
char *child_name;
//bottom-up recursion
AS_t rc_son;
char *child_name;
//bottom-up recursion
- xbt_graph_t graph = xbt_graph_new_graph (0, NULL);
- xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL);
- xbt_dict_t edges = xbt_dict_new_homogeneous(NULL);
- xbt_edge_t edge = NULL;
+ xbt_graph_t graph = xbt_graph_new_graph (0, nullptr);
+ xbt_dict_t nodes = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_t edges = xbt_dict_new_homogeneous(nullptr);
+ xbt_edge_t edge = nullptr;
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
char *edge_name;
static_cast<simgrid::surf::AsImpl*>(as)->getGraph(graph, nodes, edges);
char *edge_name;
static_cast<simgrid::surf::AsImpl*>(as)->getGraph(graph, nodes, edges);
}
xbt_dict_free (&nodes);
xbt_dict_free (&edges);
}
xbt_dict_free (&nodes);
xbt_dict_free (&edges);
- xbt_graph_free_graph(graph, xbt_free_f, xbt_free_f, NULL);
+ xbt_graph_free_graph(graph, xbt_free_f, xbt_free_f, nullptr);
{
const char*id = AS->id;
{
const char*id = AS->id;
- if (PJ_container_get_root() == NULL){
+ if (PJ_container_get_root() == nullptr){
PJ_container_alloc ();
PJ_type_alloc();
PJ_container_alloc ();
PJ_type_alloc();
- container_t root = PJ_container_new (id, INSTR_AS, NULL);
+ container_t root = PJ_container_new (id, INSTR_AS, nullptr);
PJ_container_set_root (root);
if (TRACE_smpi_is_enabled()) {
if (!TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", root->type);
PJ_container_set_root (root);
if (TRACE_smpi_is_enabled()) {
if (!TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", root->type);
mpi = PJ_type_container_new("MPI", root->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
mpi = PJ_type_container_new("MPI", root->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
}
if (TRACE_needs_platform()){
}
if (TRACE_needs_platform()){
- currentContainer = xbt_dynar_new (sizeof(container_t), NULL);
+ currentContainer = xbt_dynar_new (sizeof(container_t), nullptr);
xbt_dynar_push (currentContainer, &root);
}
return;
xbt_dynar_push (currentContainer, &root);
}
return;
xbt_dynar_push_as (links_to_create, char*, strdup(link->id));
}
xbt_dynar_push_as (links_to_create, char*, strdup(link->id));
}
- char *link_name = NULL;
+ char *link_name = nullptr;
unsigned int i;
xbt_dynar_foreach (links_to_create, i, link_name){
unsigned int i;
xbt_dynar_foreach (links_to_create, i, link_name){
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_link())) {
type_t bandwidth = PJ_type_get_or_null ("bandwidth", container->type);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_link())) {
type_t bandwidth = PJ_type_get_or_null ("bandwidth", container->type);
- if (bandwidth == NULL){
- bandwidth = PJ_type_variable_new ("bandwidth", NULL, container->type);
+ if (bandwidth == nullptr){
+ bandwidth = PJ_type_variable_new ("bandwidth", nullptr, container->type);
}
type_t latency = PJ_type_get_or_null ("latency", container->type);
}
type_t latency = PJ_type_get_or_null ("latency", container->type);
- if (latency == NULL){
- latency = PJ_type_variable_new ("latency", NULL, container->type);
+ if (latency == nullptr){
+ latency = PJ_type_variable_new ("latency", nullptr, container->type);
}
new_pajeSetVariable (0, container, bandwidth, bandwidth_value);
new_pajeSetVariable (0, container, latency, latency_value);
}
if (TRACE_uncategorized()){
type_t bandwidth_used = PJ_type_get_or_null ("bandwidth_used", container->type);
}
new_pajeSetVariable (0, container, bandwidth, bandwidth_value);
new_pajeSetVariable (0, container, latency, latency_value);
}
if (TRACE_uncategorized()){
type_t bandwidth_used = PJ_type_get_or_null ("bandwidth_used", container->type);
- if (bandwidth_used == NULL){
+ if (bandwidth_used == nullptr){
PJ_type_variable_new ("bandwidth_used", "0.5 0.5 0.5", container->type);
}
}
PJ_type_variable_new ("bandwidth_used", "0.5 0.5 0.5", container->type);
}
}
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_speed())) {
type_t speed = PJ_type_get_or_null ("power", container->type);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (! TRACE_disable_speed())) {
type_t speed = PJ_type_get_or_null ("power", container->type);
- if (speed == NULL){
- speed = PJ_type_variable_new ("power", NULL, container->type);
+ if (speed == nullptr){
+ speed = PJ_type_variable_new ("power", nullptr, container->type);
}
double current_speed_state;
}
double current_speed_state;
}
if (TRACE_uncategorized()){
type_t speed_used = PJ_type_get_or_null ("power_used", container->type);
}
if (TRACE_uncategorized()){
type_t speed_used = PJ_type_get_or_null ("power_used", container->type);
- if (speed_used == NULL){
+ if (speed_used == nullptr){
PJ_type_variable_new ("power_used", "0.5 0.5 0.5", container->type);
}
}
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", container->type);
PJ_type_variable_new ("power_used", "0.5 0.5 0.5", container->type);
}
}
if (TRACE_smpi_is_enabled() && TRACE_smpi_is_grouped()){
type_t mpi = PJ_type_get_or_null ("MPI", container->type);
mpi = PJ_type_container_new("MPI", container->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
mpi = PJ_type_container_new("MPI", container->type);
PJ_type_state_new ("MPI_STATE", mpi);
PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
if (TRACE_msg_process_is_enabled()) {
type_t msg_process = PJ_type_get_or_null ("MSG_PROCESS", container->type);
if (TRACE_msg_process_is_enabled()) {
type_t msg_process = PJ_type_get_or_null ("MSG_PROCESS", container->type);
- if (msg_process == NULL){
+ if (msg_process == nullptr){
msg_process = PJ_type_container_new("MSG_PROCESS", container->type);
type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
PJ_value_new ("suspend", "1 0 1", state);
msg_process = PJ_type_container_new("MSG_PROCESS", container->type);
type_t state = PJ_type_state_new ("MSG_PROCESS_STATE", msg_process);
PJ_value_new ("suspend", "1 0 1", state);
if (TRACE_msg_vm_is_enabled()) {
type_t msg_vm = PJ_type_get_or_null ("MSG_VM", container->type);
if (TRACE_msg_vm_is_enabled()) {
type_t msg_vm = PJ_type_get_or_null ("MSG_VM", container->type);
+ if (msg_vm == nullptr){
msg_vm = PJ_type_container_new("MSG_VM", container->type);
type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm);
PJ_value_new ("suspend", "1 0 1", state);
msg_vm = PJ_type_container_new("MSG_VM", container->type);
type_t state = PJ_type_state_new ("MSG_VM_STATE", msg_vm);
PJ_value_new ("suspend", "1 0 1", state);
static void instr_routing_parse_end_platform ()
{
xbt_dynar_free(¤tContainer);
static void instr_routing_parse_end_platform ()
{
xbt_dynar_free(¤tContainer);
- currentContainer = NULL;
+ currentContainer = nullptr;
xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free_f);
XBT_DEBUG ("Starting graph extraction.");
recursiveGraphExtraction (simgrid::s4u::Engine::instance()->rootAs(), PJ_container_get_root(), filter);
xbt_dict_t filter = xbt_dict_new_homogeneous(xbt_free_f);
XBT_DEBUG ("Starting graph extraction.");
recursiveGraphExtraction (simgrid::s4u::Engine::instance()->rootAs(), PJ_container_get_root(), filter);
snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
PJ_type_variable_new (tnstr, color, root);
}
snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
PJ_type_variable_new (tnstr, color, root);
}
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
if (!strcmp (root->name, father_type)){
PJ_type_variable_new (new_typename, color, root);
}
if (!strcmp (root->name, father_type)){
PJ_type_variable_new (new_typename, color, root);
}
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
if (!strcmp (root->name, father_type)){
PJ_type_state_new (new_typename, root);
}
if (!strcmp (root->name, father_type)){
PJ_type_state_new (new_typename, root);
}
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
if (!strcmp (root->name, type_name)){
PJ_value_new (value, color, root);
}
if (!strcmp (root->name, type_name)){
PJ_value_new (value, color, root);
}
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
type_t child_type;
char *name;
xbt_dict_foreach(root->children, cursor, name, child_type) {
AS_t as, container_t container)
{
if (!xbt_dict_is_empty(as->children())){
AS_t as, container_t container)
{
if (!xbt_dict_is_empty(as->children())){
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
AS_t as_child;
char *child_name;
//bottom-up recursion
AS_t as_child;
char *child_name;
//bottom-up recursion
xbt_graph_t instr_routing_platform_graph (void)
{
xbt_graph_t instr_routing_platform_graph (void)
{
- xbt_graph_t ret = xbt_graph_new_graph (0, NULL);
- xbt_dict_t nodes = xbt_dict_new_homogeneous(NULL);
- xbt_dict_t edges = xbt_dict_new_homogeneous(NULL);
+ xbt_graph_t ret = xbt_graph_new_graph (0, nullptr);
+ xbt_dict_t nodes = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_t edges = xbt_dict_new_homogeneous(nullptr);
recursiveXBTGraphExtraction (ret, nodes, edges, simgrid::s4u::Engine::instance()->rootAs(), PJ_container_get_root());
xbt_dict_free (&nodes);
xbt_dict_free (&edges);
recursiveXBTGraphExtraction (ret, nodes, edges, simgrid::s4u::Engine::instance()->rootAs(), PJ_container_get_root());
xbt_dict_free (&nodes);
xbt_dict_free (&edges);
void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename)
{
unsigned int cursor = 0;
void instr_routing_platform_graph_export_graphviz (xbt_graph_t g, const char *filename)
{
unsigned int cursor = 0;
- xbt_node_t node = NULL;
- xbt_edge_t edge = NULL;
- FILE *file = NULL;
+ xbt_node_t node = nullptr;
+ xbt_edge_t edge = nullptr;
+ FILE *file = nullptr;
file = fopen(filename, "w");
xbt_assert(file, "Failed to open %s \n", filename);
file = fopen(filename, "w");
xbt_assert(file, "Failed to open %s \n", filename);
int warn)
{
void *_cnst, *_elem, *_var;
int warn)
{
void *_cnst, *_elem, *_var;
- xbt_swag_t elem_list = NULL;
- lmm_element_t elem = NULL;
- lmm_constraint_t cnst = NULL;
- lmm_variable_t var = NULL;
+ xbt_swag_t elem_list = nullptr;
+ lmm_element_t elem = nullptr;
+ lmm_constraint_t cnst = nullptr;
+ lmm_variable_t var = nullptr;
static double dual_objective(xbt_swag_t var_list, xbt_swag_t cnst_list)
{
void *_cnst, *_var;
static double dual_objective(xbt_swag_t var_list, xbt_swag_t cnst_list)
{
void *_cnst, *_var;
- lmm_constraint_t cnst = NULL;
- lmm_variable_t var = NULL;
+ lmm_constraint_t cnst = nullptr;
+ lmm_variable_t var = nullptr;
* Variables to manipulate the data structure proposed to model the maxmin
* fairness. See docummentation for more details.
*/
* Variables to manipulate the data structure proposed to model the maxmin
* fairness. See docummentation for more details.
*/
- xbt_swag_t cnst_list = NULL;
+ xbt_swag_t cnst_list = nullptr;
- lmm_constraint_t cnst = NULL;
+ lmm_constraint_t cnst = nullptr;
- xbt_swag_t var_list = NULL;
+ xbt_swag_t var_list = nullptr;
- lmm_variable_t var = NULL;
+ lmm_variable_t var = nullptr;
/*
* Auxiliary variables.
/*
* Auxiliary variables.
- xbt_swag_t elem_list = NULL;
- lmm_element_t elem = NULL;
- lmm_variable_t var = NULL;
+ xbt_swag_t elem_list = nullptr;
+ lmm_element_t elem = nullptr;
+ lmm_variable_t var = nullptr;
lmm_constraint_t cnst = (lmm_constraint_t) param_cnst;
double diff = 0.0;
double sigma_i = 0.0;
lmm_constraint_t cnst = (lmm_constraint_t) param_cnst;
double diff = 0.0;
double sigma_i = 0.0;
static void *lmm_variable_mallocator_new_f(void);
static void lmm_variable_mallocator_free_f(void *var);
static void *lmm_variable_mallocator_new_f(void);
static void lmm_variable_mallocator_free_f(void *var);
-#define lmm_variable_mallocator_reset_f ((void_f_pvoid_t)NULL)
+#define lmm_variable_mallocator_reset_f ((void_f_pvoid_t)nullptr)
static void lmm_update_modified_set(lmm_system_t sys, lmm_constraint_t cnst);
static void lmm_remove_all_modified_set(lmm_system_t sys);
static int Global_debug_id = 1;
static void lmm_update_modified_set(lmm_system_t sys, lmm_constraint_t cnst);
static void lmm_remove_all_modified_set(lmm_system_t sys);
static int Global_debug_id = 1;
lmm_system_t lmm_system_new(int selective_update)
{
lmm_system_t lmm_system_new(int selective_update)
{
+ lmm_system_t l = nullptr;
s_lmm_variable_t var;
s_lmm_constraint_t cnst;
s_lmm_variable_t var;
s_lmm_constraint_t cnst;
- lmm_element_t elem = NULL;
+ lmm_element_t elem = nullptr;
XBT_IN("(sys=%p, var=%p)", sys, var);
sys->modified = 1;
XBT_IN("(sys=%p, var=%p)", sys, var);
sys->modified = 1;
lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id, double bound_value)
{
lmm_constraint_t lmm_constraint_new(lmm_system_t sys, void *id, double bound_value)
{
- lmm_constraint_t cnst = NULL;
+ lmm_constraint_t cnst = nullptr;
s_lmm_element_t elem;
cnst = xbt_new0(s_lmm_constraint_t, 1);
s_lmm_element_t elem;
cnst = xbt_new0(s_lmm_constraint_t, 1);
static void *lmm_variable_mallocator_new_f(void)
{
lmm_variable_t var = xbt_new(s_lmm_variable_t, 1);
static void *lmm_variable_mallocator_new_f(void)
{
lmm_variable_t var = xbt_new(s_lmm_variable_t, 1);
- var->cnsts = NULL; /* will be created by realloc */
+ var->cnsts = nullptr; /* will be created by realloc */
lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id, double weight, double bound, int number_of_constraints)
{
lmm_variable_t lmm_variable_new(lmm_system_t sys, void *id, double weight, double bound, int number_of_constraints)
{
- lmm_variable_t var = NULL;
+ lmm_variable_t var = nullptr;
int i;
XBT_IN("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)", sys, id, weight, bound, number_of_constraints);
int i;
XBT_IN("(sys=%p, id=%p, weight=%f, bound=%f, num_cons =%d)", sys, id, weight, bound, number_of_constraints);
var->id_int = Global_debug_id++;
var->cnsts = (s_lmm_element_t *) xbt_realloc(var->cnsts, number_of_constraints * sizeof(s_lmm_element_t));
for (i = 0; i < number_of_constraints; i++) {
var->id_int = Global_debug_id++;
var->cnsts = (s_lmm_element_t *) xbt_realloc(var->cnsts, number_of_constraints * sizeof(s_lmm_element_t));
for (i = 0; i < number_of_constraints; i++) {
- var->cnsts[i].enabled_element_set_hookup.next = NULL;
- var->cnsts[i].enabled_element_set_hookup.prev = NULL;
- var->cnsts[i].disabled_element_set_hookup.next = NULL;
- var->cnsts[i].disabled_element_set_hookup.prev = NULL;
- var->cnsts[i].active_element_set_hookup.next = NULL;
- var->cnsts[i].active_element_set_hookup.prev = NULL;
- var->cnsts[i].constraint = NULL;
- var->cnsts[i].variable = NULL;
+ var->cnsts[i].enabled_element_set_hookup.next = nullptr;
+ var->cnsts[i].enabled_element_set_hookup.prev = nullptr;
+ var->cnsts[i].disabled_element_set_hookup.next = nullptr;
+ var->cnsts[i].disabled_element_set_hookup.prev = nullptr;
+ var->cnsts[i].active_element_set_hookup.next = nullptr;
+ var->cnsts[i].active_element_set_hookup.prev = nullptr;
+ var->cnsts[i].constraint = nullptr;
+ var->cnsts[i].variable = nullptr;
var->cnsts[i].value = 0.0;
}
var->cnsts_size = number_of_constraints;
var->cnsts[i].value = 0.0;
}
var->cnsts_size = number_of_constraints;
var->func_fp = func_fp_def;
var->func_fpi = func_fpi_def;
var->func_fp = func_fp_def;
var->func_fpi = func_fpi_def;
- var->variable_set_hookup.next = NULL;
- var->variable_set_hookup.prev = NULL;
- var->saturated_variable_set_hookup.next = NULL;
- var->saturated_variable_set_hookup.prev = NULL;
+ var->variable_set_hookup.next = nullptr;
+ var->variable_set_hookup.prev = nullptr;
+ var->saturated_variable_set_hookup.next = nullptr;
+ var->saturated_variable_set_hookup.prev = nullptr;
if (weight)
xbt_swag_insert_at_head(var, &(sys->variable_set));
if (weight)
xbt_swag_insert_at_head(var, &(sys->variable_set));
void lmm_shrink(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var)
{
void lmm_shrink(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var)
{
- lmm_element_t elem = NULL;
+ lmm_element_t elem = nullptr;
lmm_decrease_concurrency(elem);
xbt_swag_remove(elem, &(elem->constraint->active_element_set));
lmm_decrease_concurrency(elem);
xbt_swag_remove(elem, &(elem->constraint->active_element_set));
- elem->constraint = NULL;
- elem->variable = NULL;
+ elem->constraint = nullptr;
+ elem->variable = nullptr;
elem->value = 0;
var->cnsts_number -= 1;
elem->value = 0;
var->cnsts_number -= 1;
void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value)
{
void lmm_expand(lmm_system_t sys, lmm_constraint_t cnst, lmm_variable_t var, double value)
{
- lmm_element_t elem = NULL;
+ lmm_element_t elem = nullptr;
double weight;
int i,current_share;
double weight;
int i,current_share;
if (num < var->cnsts_number)
return (var->cnsts[num].constraint);
else
if (num < var->cnsts_number)
return (var->cnsts[num].constraint);
else
}
double lmm_get_cnst_weight_from_var(lmm_system_t /*sys*/, lmm_variable_t var, int num)
}
double lmm_get_cnst_weight_from_var(lmm_system_t /*sys*/, lmm_variable_t var, int num)
if (*elem)
return (*elem)->variable;
else
if (*elem)
return (*elem)->variable;
else
}
//if we modify the swag between calls, normal version may loop forever
}
//if we modify the swag between calls, normal version may loop forever
if(*numelem>0){
(*numelem) --;
}else
if(*numelem>0){
(*numelem) --;
}else
}
if (*elem){
//elem is not null, so we carry on
}
if (*elem){
//elem is not null, so we carry on
}
return (*elem)->variable;
}else
}
return (*elem)->variable;
}else
}
void *lmm_constraint_id(lmm_constraint_t cnst)
}
void *lmm_constraint_id(lmm_constraint_t cnst)
dyn_light_t saturated_constraint_set, lmm_system_t sys)
{
/* Add active variables (i.e. variables that need to be set) from the set of constraints to saturate (cnst_light_tab)*/
dyn_light_t saturated_constraint_set, lmm_system_t sys)
{
/* Add active variables (i.e. variables that need to be set) from the set of constraints to saturate (cnst_light_tab)*/
- lmm_constraint_light_t cnst = NULL;
+ lmm_constraint_light_t cnst = nullptr;
- lmm_element_t elem = NULL;
- xbt_swag_t elem_list = NULL;
+ lmm_element_t elem = nullptr;
+ xbt_swag_t elem_list = nullptr;
int i;
for(i = 0; i< saturated_constraint_set->pos; i++){
cnst = &cnst_light_tab[saturated_constraint_set->data[i]];
int i;
for(i = 0; i< saturated_constraint_set->pos; i++){
cnst = &cnst_light_tab[saturated_constraint_set->data[i]];
void lmm_print(lmm_system_t sys)
{
void *_cnst, *_elem, *_var;
void lmm_print(lmm_system_t sys)
{
void *_cnst, *_elem, *_var;
- lmm_constraint_t cnst = NULL;
- lmm_element_t elem = NULL;
- lmm_variable_t var = NULL;
- xbt_swag_t cnst_list = NULL;
- xbt_swag_t var_list = NULL;
- xbt_swag_t elem_list = NULL;
+ lmm_constraint_t cnst = nullptr;
+ lmm_element_t elem = nullptr;
+ lmm_variable_t var = nullptr;
+ xbt_swag_t cnst_list = nullptr;
+ xbt_swag_t var_list = nullptr;
+ xbt_swag_t elem_list = nullptr;
xbt_strbuff_t buf = xbt_strbuff_new();
double sum = 0.0;
xbt_strbuff_t buf = xbt_strbuff_new();
double sum = 0.0;
void lmm_solve(lmm_system_t sys)
{
void *_var, *_cnst, *_cnst_next, *_elem;
void lmm_solve(lmm_system_t sys)
{
void *_var, *_cnst, *_cnst_next, *_elem;
- lmm_variable_t var = NULL;
- lmm_constraint_t cnst = NULL;
- lmm_element_t elem = NULL;
- xbt_swag_t cnst_list = NULL;
- xbt_swag_t var_list = NULL;
- xbt_swag_t elem_list = NULL;
+ lmm_variable_t var = nullptr;
+ lmm_constraint_t cnst = nullptr;
+ lmm_element_t elem = nullptr;
+ xbt_swag_t cnst_list = nullptr;
+ xbt_swag_t var_list = nullptr;
+ xbt_swag_t elem_list = nullptr;
double min_usage = -1;
double min_bound = -1;
double min_usage = -1;
double min_bound = -1;
cnst_light_tab[index]=cnst_light_tab[cnst_light_num-1];
cnst_light_tab[index].cnst->cnst_light = &cnst_light_tab[index];
cnst_light_num--;
cnst_light_tab[index]=cnst_light_tab[cnst_light_num-1];
cnst_light_tab[index].cnst->cnst_light = &cnst_light_tab[index];
cnst_light_num--;
- cnst->cnst_light = NULL;
+ cnst->cnst_light = nullptr;
}
} else {
cnst->cnst_light->remaining_over_usage = cnst->remaining / cnst->usage;
}
} else {
cnst->cnst_light->remaining_over_usage = cnst->remaining / cnst->usage;
cnst_light_tab[index]=cnst_light_tab[cnst_light_num-1];
cnst_light_tab[index].cnst->cnst_light = &cnst_light_tab[index];
cnst_light_num--;
cnst_light_tab[index]=cnst_light_tab[cnst_light_num-1];
cnst_light_tab[index].cnst->cnst_light = &cnst_light_tab[index];
cnst_light_num--;
- cnst->cnst_light = NULL;
+ cnst->cnst_light = nullptr;
}
} else {
cnst->cnst_light->remaining_over_usage = cnst->remaining / cnst->usage;
}
} else {
cnst->cnst_light->remaining_over_usage = cnst->remaining / cnst->usage;
double usage = 0.0;
xbt_swag_t elem_list = &(cnst->enabled_element_set);
void *_elem;
double usage = 0.0;
xbt_swag_t elem_list = &(cnst->enabled_element_set);
void *_elem;
- lmm_element_t elem = NULL;
+ lmm_element_t elem = nullptr;
xbt_swag_foreach(_elem, elem_list) {
elem = (lmm_element_t)_elem;
xbt_swag_foreach(_elem, elem_list) {
elem = (lmm_element_t)_elem;
if (!maxminSystem_)
maxminSystem_ = lmm_system_new(selectiveUpdate_);
if (!maxminSystem_)
maxminSystem_ = lmm_system_new(selectiveUpdate_);
- routing_model_create(createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, NULL));
+ routing_model_create(createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, nullptr));
if (updateMechanism_ == UM_LAZY) {
if (updateMechanism_ == UM_LAZY) {
- actionHeap_ = xbt_heap_new(8, NULL);
+ actionHeap_ = xbt_heap_new(8, nullptr);
xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
modifiedSet_ = new ActionLmmList();
maxminSystem_->keep_track = modifiedSet_;
xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
modifiedSet_ = new ActionLmmList();
maxminSystem_->keep_track = modifiedSet_;
int failed = 0;
double bandwidth_bound;
double latency = 0.0;
int failed = 0;
double bandwidth_bound;
double latency = 0.0;
- std::vector<Link*> * back_route = NULL;
+ std::vector<Link*> * back_route = nullptr;
int constraints_per_variable = 0;
std::vector<Link*> *route = new std::vector<Link*>();
int constraints_per_variable = 0;
std::vector<Link*> *route = new std::vector<Link*>();
if (sg_network_crosstraffic == 1) {
back_route = new std::vector<Link*>();
if (sg_network_crosstraffic == 1) {
back_route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency(dst, src, back_route, NULL);
+ routing_platf->getRouteAndLatency(dst, src, back_route, nullptr);
for (auto link: *back_route)
if (link->isOff())
failed = 1;
for (auto link: *back_route)
if (link->isOff())
failed = 1;
}
constraints_per_variable = route->size();
}
constraints_per_variable = route->size();
- if (back_route != NULL)
+ if (back_route != nullptr)
constraints_per_variable += back_route->size();
if (action->latency_ > 0) {
constraints_per_variable += back_route->size();
if (action->latency_ > 0) {
if (value > 0)
turnOn();
else {
if (value > 0)
turnOn();
else {
- lmm_variable_t var = NULL;
- lmm_element_t elem = NULL;
+ lmm_variable_t var = nullptr;
+ lmm_element_t elem = nullptr;
double now = surf_get_clock();
turnOff();
double now = surf_get_clock();
turnOff();
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (m_bandwidth.peak * m_bandwidth.scale);
lmm_variable_t var;
double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (m_bandwidth.peak * m_bandwidth.scale);
lmm_variable_t var;
- lmm_element_t elem = NULL, nextelem = NULL;
+ lmm_element_t elem = nullptr, nextelem = nullptr;
int numelem = 0;
while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var);
int numelem = 0;
while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var);
void NetworkCm02Link::updateLatency(double value){
double delta = value - m_latency.peak;
void NetworkCm02Link::updateLatency(double value){
double delta = value - m_latency.peak;
- lmm_variable_t var = NULL;
- lmm_element_t elem = NULL;
- lmm_element_t nextelem = NULL;
+ lmm_variable_t var = nullptr;
+ lmm_element_t elem = nullptr;
+ lmm_element_t nextelem = nullptr;
int numelem = 0;
m_latency.peak = value;
int numelem = 0;
m_latency.peak = value;
*********/
void surf_network_model_init_Constant()
{
*********/
void surf_network_model_init_Constant()
{
- xbt_assert(surf_network_model == NULL);
+ xbt_assert(surf_network_model == nullptr);
surf_network_model = new simgrid::surf::NetworkConstantModel();
xbt_dynar_push(all_existing_models, &surf_network_model);
surf_network_model = new simgrid::surf::NetworkConstantModel();
xbt_dynar_push(all_existing_models, &surf_network_model);
- routing_model_create(NULL);
+ routing_model_create(nullptr);
double NetworkConstantModel::next_occuring_event(double /*now*/)
{
double NetworkConstantModel::next_occuring_event(double /*now*/)
{
- NetworkConstantAction *action = NULL;
+ NetworkConstantAction *action = nullptr;
double min = -1.0;
ActionList *actionSet = getRunningActionSet();
double min = -1.0;
ActionList *actionSet = getRunningActionSet();
void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
{
void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
{
- NetworkConstantAction *action = NULL;
+ NetworkConstantAction *action = nullptr;
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
static int id=0;
// pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives
static int id=0;
// pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives
- if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
+ if(((NetworkIBModel*)surf_network_model)->active_nodes==nullptr)
((NetworkIBModel*)surf_network_model)->active_nodes=xbt_dict_new();
IBNode* act = new IBNode(id);
id++;
xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes,
((NetworkIBModel*)surf_network_model)->active_nodes=xbt_dict_new();
IBNode* act = new IBNode(id);
id++;
xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes,
- host.name().c_str(), act, NULL);
+ host.name().c_str(), act, nullptr);
NetworkIBModel::NetworkIBModel()
: NetworkSmpiModel() {
haveGap_=false;
NetworkIBModel::NetworkIBModel()
: NetworkSmpiModel() {
haveGap_=false;
const char* IB_factors_string=xbt_cfg_get_string("smpi/IB-penalty-factors");
xbt_dynar_t radical_elements = xbt_str_split(IB_factors_string, ";");
const char* IB_factors_string=xbt_cfg_get_string("smpi/IB-penalty-factors");
xbt_dynar_t radical_elements = xbt_str_split(IB_factors_string, ";");
NetworkIBModel::~NetworkIBModel()
{
NetworkIBModel::~NetworkIBModel()
{
- xbt_dict_cursor_t cursor = NULL;
- IBNode* instance = NULL;
- char *name = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
+ IBNode* instance = nullptr;
+ char *name = nullptr;
xbt_dict_foreach(active_nodes, cursor, name, instance)
delete instance;
xbt_dict_free(&active_nodes);
xbt_dict_foreach(active_nodes, cursor, name, instance)
delete instance;
xbt_dict_free(&active_nodes);
return;
bool* updated=(bool*)xbt_malloc0(xbt_dict_size(active_nodes)*sizeof(bool));
return;
bool* updated=(bool*)xbt_malloc0(xbt_dict_size(active_nodes)*sizeof(bool));
+ ActiveComm* comm=nullptr;
if(remove){
if(to->ActiveCommsDown[from]==1)
to->ActiveCommsDown.erase(from);
if(remove){
if(to->ActiveCommsDown[from]==1)
to->ActiveCommsDown.erase(from);
boost::unordered_map<std::string,Link *> *Link::links = new boost::unordered_map<std::string,Link *>();
Link *Link::byName(const char* name) {
if (links->find(name) == links->end())
boost::unordered_map<std::string,Link *> *Link::links = new boost::unordered_map<std::string,Link *>();
Link *Link::byName(const char* name) {
if (links->find(name) == links->end())
return links->at(name);
}
/** @brief Returns the amount of links in the platform */
return links->at(name);
}
/** @brief Returns the amount of links in the platform */
-simgrid::surf::NetworkModel *surf_network_model = NULL;
+simgrid::surf::NetworkModel *surf_network_model = nullptr;
namespace simgrid {
namespace surf {
namespace simgrid {
namespace surf {
double NetworkModel::next_occuring_event_full(double now)
{
double NetworkModel::next_occuring_event_full(double now)
{
- NetworkAction *action = NULL;
+ NetworkAction *action = nullptr;
ActionList *runningActions = surf_network_model->getRunningActionSet();
double minRes;
ActionList *runningActions = surf_network_model->getRunningActionSet();
double minRes;
}
}
void Link::setStateTrace(tmgr_trace_t trace) {
}
}
void Link::setStateTrace(tmgr_trace_t trace) {
- xbt_assert(m_stateEvent==NULL,"Cannot set a second state trace to Link %s", getName());
+ xbt_assert(m_stateEvent==nullptr,"Cannot set a second state trace to Link %s", getName());
m_stateEvent = future_evt_set->add_trace(trace, 0.0, this);
}
void Link::setBandwidthTrace(tmgr_trace_t trace)
{
m_stateEvent = future_evt_set->add_trace(trace, 0.0, this);
}
void Link::setBandwidthTrace(tmgr_trace_t trace)
{
- xbt_assert(m_bandwidth.event==NULL,"Cannot set a second bandwidth trace to Link %s", getName());
+ xbt_assert(m_bandwidth.event==nullptr,"Cannot set a second bandwidth trace to Link %s", getName());
m_bandwidth.event = future_evt_set->add_trace(trace, 0.0, this);
}
void Link::setLatencyTrace(tmgr_trace_t trace)
{
m_bandwidth.event = future_evt_set->add_trace(trace, 0.0, this);
}
void Link::setLatencyTrace(tmgr_trace_t trace)
{
- xbt_assert(m_latency.event==NULL,"Cannot set a second latency trace to Link %s", getName());
+ xbt_assert(m_latency.event==nullptr,"Cannot set a second latency trace to Link %s", getName());
m_latency.event = future_evt_set->add_trace(trace, 0.0, this);
}
m_latency.event = future_evt_set->add_trace(trace, 0.0, this);
}
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
static void parse_ns3_add_cluster(sg_platf_cluster_cbarg_t cluster)
{
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
static void parse_ns3_add_cluster(sg_platf_cluster_cbarg_t cluster)
{
- const char *groups = NULL;
+ const char *groups = nullptr;
int start, end, i;
unsigned int iter;
int start, end, i;
unsigned int iter;
- xbt_dynar_t tab_elements_num = xbt_dynar_new(sizeof(int), NULL);
+ xbt_dynar_t tab_elements_num = xbt_dynar_new(sizeof(int), nullptr);
char *router_id,*host_id;
char *router_id,*host_id;
NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
ns3_initialize(ns3_tcp_model.get().c_str());
NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
ns3_initialize(ns3_tcp_model.get().c_str());
- routing_model_create(NULL);
+ routing_model_create(nullptr);
simgrid::s4u::Host::onCreation.connect(ns3_add_host);
simgrid::surf::netcardCreatedCallbacks.connect(ns3_add_netcard);
simgrid::surf::on_cluster.connect (&parse_ns3_add_cluster);
simgrid::s4u::Host::onCreation.connect(ns3_add_host);
simgrid::surf::netcardCreatedCallbacks.connect(ns3_add_netcard);
simgrid::surf::on_cluster.connect (&parse_ns3_add_cluster);
void NetworkNS3Model::updateActionsState(double now, double delta)
{
void NetworkNS3Model::updateActionsState(double now, double delta)
{
- static xbt_dynar_t socket_to_destroy = xbt_dynar_new(sizeof(char*),NULL);
+ static xbt_dynar_t socket_to_destroy = xbt_dynar_new(sizeof(char*),nullptr);
/* If there are no running flows, advance the NS3 simulator and return */
if (getRunningActionSet()->empty()) {
/* If there are no running flows, advance the NS3 simulator and return */
if (getRunningActionSet()->empty()) {
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
char *ns3Socket;
SgFlow *sgFlow;
xbt_dict_foreach(flowFromSock,cursor,ns3Socket,sgFlow){
char *ns3Socket;
SgFlow *sgFlow;
xbt_dict_foreach(flowFromSock,cursor,ns3Socket,sgFlow){
std::vector<Link*> *route = new std::vector<Link*>();
std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency (action->src_, action->dst_, route, NULL);
+ routing_platf->getRouteAndLatency (action->src_, action->dst_, route, nullptr);
for (auto link : *route)
TRACE_surf_link_set_utilization (link->getName(), action->getCategory(), (data_delta_sent)/delta, now-delta, delta);
delete route;
for (auto link : *route)
TRACE_surf_link_set_utilization (link->getName(), action->getCategory(), (data_delta_sent)/delta, now-delta, delta);
delete route;
ns3::Ptr<ns3::Socket> sock = ns3::Socket::CreateSocket (src_node, ns3::TcpSocketFactory::GetTypeId());
ns3::Ptr<ns3::Socket> sock = ns3::Socket::CreateSocket (src_node, ns3::TcpSocketFactory::GetTypeId());
- xbt_dict_set(flowFromSock, transformSocketPtr(sock), new SgFlow(TotalBytes, action), NULL);
+ xbt_dict_set(flowFromSock, transformSocketPtr(sock), new SgFlow(TotalBytes, action), nullptr);
sock->Bind(ns3::InetSocketAddress(port_number));
XBT_DEBUG("Create flow starting to %fs + %fs = %fs",
sock->Bind(ns3::InetSocketAddress(port_number));
XBT_DEBUG("Create flow starting to %fs + %fs = %fs",
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_network);
-xbt_dynar_t smpi_bw_factor = NULL;
-xbt_dynar_t smpi_lat_factor = NULL;
+xbt_dynar_t smpi_bw_factor = nullptr;
+xbt_dynar_t smpi_lat_factor = nullptr;
typedef struct s_smpi_factor *smpi_factor_t;
typedef struct s_smpi_factor { // FIXME: s_smpi_factor_multival (defined in smpi_base) should be used instead to dedupplicate this code
typedef struct s_smpi_factor *smpi_factor_t;
typedef struct s_smpi_factor { // FIXME: s_smpi_factor_multival (defined in smpi_base) should be used instead to dedupplicate this code
double value;
} s_smpi_factor_t;
double value;
} s_smpi_factor_t;
-xbt_dict_t gap_lookup = NULL;
+xbt_dict_t gap_lookup = nullptr;
static int factor_cmp(const void *pa, const void *pb)
{
static int factor_cmp(const void *pa, const void *pb)
{
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
static xbt_dynar_t parse_factor(const char *smpi_coef_string)
{
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
static xbt_dynar_t parse_factor(const char *smpi_coef_string)
{
unsigned int iter = 0;
s_smpi_factor_t fact;
unsigned int iter = 0;
s_smpi_factor_t fact;
- xbt_dynar_t smpi_factor, radical_elements, radical_elements2 = NULL;
+ xbt_dynar_t smpi_factor, radical_elements, radical_elements2 = nullptr;
- smpi_factor = xbt_dynar_new(sizeof(s_smpi_factor_t), NULL);
+ smpi_factor = xbt_dynar_new(sizeof(s_smpi_factor_t), nullptr);
radical_elements = xbt_str_split(smpi_coef_string, ";");
xbt_dynar_foreach(radical_elements, iter, value) {
radical_elements = xbt_str_split(smpi_coef_string, ";");
xbt_dynar_foreach(radical_elements, iter, value) {
if (sg_sender_gap > 0.0) {
if (!gap_lookup) {
if (sg_sender_gap > 0.0) {
if (!gap_lookup) {
- gap_lookup = xbt_dict_new_homogeneous(NULL);
+ gap_lookup = xbt_dict_new_homogeneous(nullptr);
}
fifo = (xbt_fifo_t) xbt_dict_get_or_null(gap_lookup, src);
action->senderGap_ = 0.0;
}
fifo = (xbt_fifo_t) xbt_dict_get_or_null(gap_lookup, src);
action->senderGap_ = 0.0;
action->sender.link_name);
if (!fifo) {
fifo = xbt_fifo_new();
action->sender.link_name);
if (!fifo) {
fifo = xbt_fifo_new();
- xbt_dict_set(gap_lookup, action->sender.link_name, fifo, NULL);
+ xbt_dict_set(gap_lookup, action->sender.link_name, fifo, nullptr);
}
action->sender.fifo_item = xbt_fifo_push(fifo, action);*/
action->senderSize_ = size;
}
action->sender.fifo_item = xbt_fifo_push(fifo, action);*/
action->senderSize_ = size;
- if (host->properties() != NULL) {
+ if (host->properties() != nullptr) {
char* off_power_str = (char*)xbt_dict_get_or_null(host->properties(), "watt_off");
char* off_power_str = (char*)xbt_dict_get_or_null(host->properties(), "watt_off");
- if (off_power_str != NULL) {
+ if (off_power_str != nullptr) {
char *msg = bprintf("Invalid value for property watt_off of host %s: %%s",host->name().c_str());
watts_off = xbt_str_parse_double(off_power_str, msg);
xbt_free(msg);
char *msg = bprintf("Invalid value for property watt_off of host %s: %%s",host->name().c_str());
watts_off = xbt_str_parse_double(off_power_str, msg);
xbt_free(msg);
void HostEnergy::initWattsRangeList()
{
void HostEnergy::initWattsRangeList()
{
- if (host->properties() == NULL)
+ if (host->properties() == nullptr)
return;
char* all_power_values_str =
(char*)xbt_dict_get_or_null(host->properties(), "watt_per_state");
return;
char* all_power_values_str =
(char*)xbt_dict_get_or_null(host->properties(), "watt_per_state");
- if (all_power_values_str == NULL)
+ if (all_power_values_str == nullptr)
return;
xbt_dynar_t all_power_values = xbt_str_split(all_power_values_str, ",");
return;
xbt_dynar_t all_power_values = xbt_str_split(all_power_values_str, ",");
for(simgrid::surf::Cpu* cpu : action->cpus()) {
const char *name = cpu->getName();
sg_host_t sghost = sg_host_by_name(name);
for(simgrid::surf::Cpu* cpu : action->cpus()) {
const char *name = cpu->getName();
sg_host_t sghost = sg_host_by_name(name);
continue;
simgrid::surf::HostImpl *host = sghost->extension<simgrid::surf::HostImpl>();
simgrid::surf::VirtualMachine *vm = dynamic_cast<simgrid::surf::VirtualMachine*>(host);
continue;
simgrid::surf::HostImpl *host = sghost->extension<simgrid::surf::HostImpl>();
simgrid::surf::VirtualMachine *vm = dynamic_cast<simgrid::surf::VirtualMachine*>(host);
surf_network_model = new NetworkL07Model(this,maxminSystem_);
surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
surf_network_model = new NetworkL07Model(this,maxminSystem_);
surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
- routing_model_create(surf_network_model->createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, NULL));
+ routing_model_create(surf_network_model->createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, nullptr));
}
HostL07Model::~HostL07Model() {
}
HostL07Model::~HostL07Model() {
maxminSystem_ = sys;
}
CpuL07Model::~CpuL07Model() {
maxminSystem_ = sys;
}
CpuL07Model::~CpuL07Model() {
- surf_cpu_model_pm = NULL;
+ surf_cpu_model_pm = nullptr;
lmm_system_free(maxminSystem_);
lmm_system_free(maxminSystem_);
+ maxminSystem_ = nullptr;
}
NetworkL07Model::NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys)
: NetworkModel()
}
NetworkL07Model::NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys)
: NetworkModel()
}
NetworkL07Model::~NetworkL07Model()
{
}
NetworkL07Model::~NetworkL07Model()
{
- surf_network_model = NULL;
- maxminSystem_ = NULL; // Avoid multi-free
+ surf_network_model = nullptr;
+ maxminSystem_ = nullptr; // Avoid multi-free
action->setState(Action::State::done);
} else {
/* Need to check that none of the model has failed */
action->setState(Action::State::done);
} else {
/* Need to check that none of the model has failed */
- lmm_constraint_t cnst = NULL;
+ lmm_constraint_t cnst = nullptr;
int i = 0;
while ((cnst = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i++))) {
int i = 0;
while ((cnst = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i++))) {
this->p_netcardList->push_back(host_list[i]->pimpl_netcard);
/* Compute the number of affected resources... */
this->p_netcardList->push_back(host_list[i]->pimpl_netcard);
/* Compute the number of affected resources... */
- if(bytes_amount != NULL) {
- xbt_dict_t ptask_parallel_task_link_set = xbt_dict_new_homogeneous(NULL);
+ if(bytes_amount != nullptr) {
+ xbt_dict_t ptask_parallel_task_link_set = xbt_dict_new_homogeneous(nullptr);
for (int i = 0; i < host_nb; i++) {
for (int j = 0; j < host_nb; j++) {
for (int i = 0; i < host_nb; i++) {
for (int j = 0; j < host_nb; j++) {
latency = MAX(latency, lat);
for (auto link : *route)
latency = MAX(latency, lat);
for (auto link : *route)
- xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
+ xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, nullptr);
lmm_expand(model->getMaxminSystem(), host_list[i]->pimpl_cpu->getConstraint(),
this->getVariable(), flops_amount[i]);
lmm_expand(model->getMaxminSystem(), host_list[i]->pimpl_cpu->getConstraint(),
this->getVariable(), flops_amount[i]);
- if(bytes_amount != NULL) {
+ if(bytes_amount != nullptr) {
for (int i = 0; i < host_nb; i++) {
for (int j = 0; j < host_nb; j++) {
for (int i = 0; i < host_nb; i++) {
for (int j = 0; j < host_nb; j++) {
continue;
std::vector<Link*> *route = new std::vector<Link*>();
continue;
std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], route, NULL);
+ routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], route, nullptr);
for (auto link : *route)
lmm_expand_add(model->getMaxminSystem(), link->getConstraint(), this->getVariable(), bytes_amount[i * host_nb + j]);
for (auto link : *route)
lmm_expand_add(model->getMaxminSystem(), link->getConstraint(), this->getVariable(), bytes_amount[i * host_nb + j]);
flops_amount[0] = size;
return static_cast<CpuL07Model*>(getModel())->p_hostModel
flops_amount[0] = size;
return static_cast<CpuL07Model*>(getModel())->p_hostModel
- ->executeParallelTask( 1, host_list, flops_amount, NULL, -1);
+ ->executeParallelTask( 1, host_list, flops_amount, nullptr, -1);
}
Action *CpuL07::sleep(double duration)
}
Action *CpuL07::sleep(double duration)
/** @brief take into account changes of speed (either load or max) */
void CpuL07::onSpeedChange() {
/** @brief take into account changes of speed (either load or max) */
void CpuL07::onSpeedChange() {
- lmm_variable_t var = NULL;
- lmm_element_t elem = NULL;
+ lmm_variable_t var = nullptr;
+ lmm_element_t elem = nullptr;
lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), speed_.peak * speed_.scale);
while ((var = lmm_get_var_from_cnst
lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), speed_.peak * speed_.scale);
while ((var = lmm_get_var_from_cnst
void LinkL07::updateLatency(double value)
{
void LinkL07::updateLatency(double value)
{
- lmm_variable_t var = NULL;
+ lmm_variable_t var = nullptr;
- lmm_element_t elem = NULL;
+ lmm_element_t elem = nullptr;
m_latency.peak = value;
while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
m_latency.peak = value;
while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
int hostNb = p_netcardList->size();
int hostNb = p_netcardList->size();
- if (p_communicationAmount != NULL) {
+ if (p_communicationAmount != nullptr) {
for (i = 0; i < hostNb; i++) {
for (j = 0; j < hostNb; j++) {
for (i = 0; i < hostNb; i++) {
for (j = 0; j < hostNb; j++) {
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_parse);
-XBT_PRIVATE xbt_dynar_t mount_list = NULL;
+XBT_PRIVATE xbt_dynar_t mount_list = nullptr;
namespace simgrid {
namespace surf {
namespace simgrid {
namespace surf {
/** The current AS in the parsing */
/** The current AS in the parsing */
-static simgrid::surf::AsImpl *current_routing = NULL;
+static simgrid::surf::AsImpl *current_routing = nullptr;
static simgrid::surf::AsImpl* routing_get_current()
{
return current_routing;
static simgrid::surf::AsImpl* routing_get_current()
{
return current_routing;
if(mount_list){
xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
if(mount_list){
xbt_lib_set(storage_lib, host->id, ROUTING_STORAGE_HOST_LEVEL, (void *) mount_list);
}
if (host->coord && strcmp(host->coord, "")) {
}
if (host->coord && strcmp(host->coord, "")) {
xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", host->id);
xbt_dynar_t ctn_str = xbt_str_split_str(host->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", host->id);
- xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),NULL);
+ xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),nullptr);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
surf_host_model->createHost(host->id, netcard, cpu)->attach(h);
if (host->properties) {
surf_host_model->createHost(host->id, netcard, cpu)->attach(h);
if (host->properties) {
- xbt_dict_cursor_t cursor=NULL;
+ xbt_dict_cursor_t cursor=nullptr;
char *key,*data;
xbt_dict_foreach(host->properties,cursor,key,data)
h->setProperty(key,data);
char *key,*data;
xbt_dict_foreach(host->properties,cursor,key,data)
h->setProperty(key,data);
/* Pre-parse the host coordinates */
xbt_dynar_t ctn_str = xbt_str_split_str(router->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", router->id);
/* Pre-parse the host coordinates */
xbt_dynar_t ctn_str = xbt_str_split_str(router->coord, " ");
xbt_assert(xbt_dynar_length(ctn_str)==3,"Coordinates of %s must have 3 dimensions", router->id);
- xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),NULL);
+ xbt_dynar_t ctn = xbt_dynar_new(sizeof(double),nullptr);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
xbt_dynar_foreach(ctn_str,cursor, str) {
double val = xbt_str_parse_double(str, "Invalid coordinate: %s");
xbt_dynar_push(ctn,&val);
s_sg_platf_host_cbarg_t host;
memset(&host, 0, sizeof(host));
host.id = host_id;
s_sg_platf_host_cbarg_t host;
memset(&host, 0, sizeof(host));
host.id = host_id;
- if ((cluster->properties != NULL) && (!xbt_dict_is_empty(cluster->properties))) {
- xbt_dict_cursor_t cursor=NULL;
+ if ((cluster->properties != nullptr) && (!xbt_dict_is_empty(cluster->properties))) {
+ xbt_dict_cursor_t cursor=nullptr;
char *key,*data;
host.properties = xbt_dict_new();
char *key,*data;
host.properties = xbt_dict_new();
- host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
+ host.speed_per_pstate = xbt_dynar_new(sizeof(double), nullptr);
xbt_dynar_push(host.speed_per_pstate,&cluster->speed);
host.pstate = 0;
host.core_amount = cluster->core_amount;
xbt_dynar_push(host.speed_per_pstate,&cluster->speed);
host.pstate = 0;
host.core_amount = cluster->core_amount;
// and it's very useful to connect clusters together
XBT_DEBUG(" ");
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
// and it's very useful to connect clusters together
XBT_DEBUG(" ");
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id);
s_sg_platf_router_cbarg_t router;
memset(&router, 0, sizeof(router));
router.id = cluster->router_id;
s_sg_platf_router_cbarg_t router;
memset(&router, 0, sizeof(router));
router.id = cluster->router_id;
host.pstate = 0;
host.core_amount = 1;
host.id = hostname;
host.pstate = 0;
host.core_amount = 1;
host.id = hostname;
- host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
+ host.speed_per_pstate = xbt_dynar_new(sizeof(double), nullptr);
xbt_dynar_push(host.speed_per_pstate,&cabinet->speed);
sg_platf_new_host(&host);
xbt_dynar_free(&host.speed_per_pstate);
xbt_dynar_push(host.speed_per_pstate,&cabinet->speed);
sg_platf_new_host(&host);
xbt_dynar_free(&host.speed_per_pstate);
std::function<void()> code = simgrid::xbt::wrapMain(parse_code, process->argc, process->argv);
std::function<void()> code = simgrid::xbt::wrapMain(parse_code, process->argc, process->argv);
- smx_process_arg_t arg = NULL;
- smx_process_t process_created = NULL;
+ smx_process_arg_t arg = nullptr;
+ smx_process_t process_created = nullptr;
arg = new simgrid::simix::ProcessArg();
arg->name = std::string(process->argv[0]);
arg->code = code;
arg = new simgrid::simix::ProcessArg();
arg->name = std::string(process->argv[0]);
arg->code = code;
arg->hostname = sg_host_get_name(host);
arg->kill_time = kill_time;
arg->properties = current_property_set;
arg->hostname = sg_host_get_name(host);
arg->kill_time = kill_time;
arg->properties = current_property_set;
arg = new simgrid::simix::ProcessArg();
arg->name = std::string(process->argv[0]);
arg->code = std::move(code);
arg = new simgrid::simix::ProcessArg();
arg->name = std::string(process->argv[0]);
arg->code = std::move(code);
arg->hostname = sg_host_get_name(host);
arg->kill_time = kill_time;
arg->properties = current_property_set;
arg->hostname = sg_host_get_name(host);
arg->kill_time = kill_time;
arg->properties = current_property_set;
arg->kill_time,
arg->properties,
arg->auto_restart,
arg->kill_time,
arg->properties,
arg->auto_restart,
delete arg;
});
} else { // start_time <= SIMIX_get_clock()
delete arg;
});
} else { // start_time <= SIMIX_get_clock()
if (simix_global->create_process_function)
process_created = simix_global->create_process_function(
if (simix_global->create_process_function)
process_created = simix_global->create_process_function(
- arg->name.c_str(), std::move(code), NULL,
+ arg->name.c_str(), std::move(code), nullptr,
sg_host_get_name(host), kill_time,
sg_host_get_name(host), kill_time,
- current_property_set, auto_restart, NULL);
+ current_property_set, auto_restart, nullptr);
else
process_created = simcall_process_create(
else
process_created = simcall_process_create(
- arg->name.c_str(), std::move(code), NULL, sg_host_get_name(host), kill_time,
+ arg->name.c_str(), std::move(code), nullptr, sg_host_get_name(host), kill_time,
current_property_set,auto_restart);
/* verify if process has been created (won't be the case if the host is currently dead, but that's fine) */
current_property_set,auto_restart);
/* verify if process has been created (won't be the case if the host is currently dead, but that's fine) */
- current_property_set = NULL;
+ current_property_set = nullptr;
}
void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
}
void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
memset(&host, 0, sizeof(host));
host.id = host_id;
memset(&host, 0, sizeof(host));
host.id = host_id;
- host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
+ host.speed_per_pstate = xbt_dynar_new(sizeof(double), nullptr);
xbt_dynar_push(host.speed_per_pstate,&peer->speed);
host.pstate = 0;
host.speed_trace = peer->availability_trace;
xbt_dynar_push(host.speed_per_pstate,&peer->speed);
host.pstate = 0;
host.speed_trace = peer->availability_trace;
const char *vm_model_name;
int host_id = -1;
int vm_id = -1;
const char *vm_model_name;
int host_id = -1;
int vm_id = -1;
- char *network_model_name = NULL;
- char *cpu_model_name = NULL;
+ char *network_model_name = nullptr;
+ char *cpu_model_name = nullptr;
- char *storage_model_name = NULL;
+ char *storage_model_name = nullptr;
host_model_name = xbt_cfg_get_string("host/model");
vm_model_name = xbt_cfg_get_string("vm/model");
host_model_name = xbt_cfg_get_string("host/model");
vm_model_name = xbt_cfg_get_string("vm/model");
/* search the routing model */
/* search the routing model */
- simgrid::surf::AsImpl *new_as = NULL;
+ simgrid::surf::AsImpl *new_as = nullptr;
switch(AS->routing){
case A_surfxml_AS_routing_Cluster: new_as = new simgrid::surf::AsCluster(AS->id); break;
case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::surf::AsClusterTorus(AS->id); break;
switch(AS->routing){
case A_surfxml_AS_routing_Cluster: new_as = new simgrid::surf::AsCluster(AS->id); break;
case A_surfxml_AS_routing_ClusterTorus: new_as = new simgrid::surf::AsClusterTorus(AS->id); break;
/* make a new routing component */
simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(new_as->name(), simgrid::surf::NetCard::Type::As, current_routing);
/* make a new routing component */
simgrid::surf::NetCard *netcard = new simgrid::surf::NetCardImpl(new_as->name(), simgrid::surf::NetCard::Type::As, current_routing);
- if (current_routing == NULL && routing_platf->root_ == NULL) { /* it is the first one */
+ if (current_routing == nullptr && routing_platf->root_ == nullptr) { /* it is the first one */
routing_platf->root_ = new_as;
routing_platf->root_ = new_as;
- } else if (current_routing != NULL && routing_platf->root_ != NULL) {
+ } else if (current_routing != nullptr && routing_platf->root_ != nullptr) {
xbt_assert(!xbt_dict_get_or_null(current_routing->children(), AS->id),
"The AS \"%s\" already exists", AS->id);
xbt_assert(!xbt_dict_get_or_null(current_routing->children(), AS->id),
"The AS \"%s\" already exists", AS->id);
if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::recursive;
/* add to the sons dictionary */
if (current_routing->hierarchy_ == simgrid::surf::AsImpl::RoutingMode::unset)
current_routing->hierarchy_ = simgrid::surf::AsImpl::RoutingMode::recursive;
/* add to the sons dictionary */
- xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, NULL);
+ xbt_dict_set(current_routing->children(), AS->id, (void *) new_as, nullptr);
} else {
THROWF(arg_error, 0, "All defined components must belong to a AS");
}
} else {
THROWF(arg_error, 0, "All defined components must belong to a AS");
}
int SURF_STORAGE_LEVEL = -1;
xbt_lib_t storage_type_lib;
int ROUTING_STORAGE_TYPE_LEVEL = -1; //Routing for storage_type level
int SURF_STORAGE_LEVEL = -1;
xbt_lib_t storage_type_lib;
int ROUTING_STORAGE_TYPE_LEVEL = -1; //Routing for storage_type level
-simgrid::surf::StorageModel *surf_storage_model = NULL;
+simgrid::surf::StorageModel *surf_storage_model = nullptr;
namespace simgrid {
namespace surf {
namespace simgrid {
namespace surf {
StorageModel::StorageModel()
: Model()
{
StorageModel::StorageModel()
: Model()
{
+ p_storageList = nullptr;
}
StorageModel::~StorageModel(){
lmm_system_free(maxminSystem_);
}
StorageModel::~StorageModel(){
lmm_system_free(maxminSystem_);
- surf_storage_model = NULL;
+ surf_storage_model = nullptr;
xbt_dynar_free(&p_storageList);
}
xbt_dynar_free(&p_storageList);
}
, p_contentType(xbt_strdup(content_type))
, m_size(size), m_usedSize(0)
, p_typeId(xbt_strdup(type_id))
, p_contentType(xbt_strdup(content_type))
, m_size(size), m_usedSize(0)
, p_typeId(xbt_strdup(type_id))
- , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL))
+ , p_writeActions(xbt_dynar_new(sizeof(Action*),nullptr))
{
p_content = parseContent(content_name);
turnOn();
{
p_content = parseContent(content_name);
turnOn();
, p_contentType(xbt_strdup(content_type))
, m_size(size), m_usedSize(0)
, p_typeId(xbt_strdup(type_id))
, p_contentType(xbt_strdup(content_type))
, m_size(size), m_usedSize(0)
, p_typeId(xbt_strdup(type_id))
- , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL))
+ , p_writeActions(xbt_dynar_new(sizeof(Action*),nullptr))
{
p_content = parseContent(content_name);
p_attach = xbt_strdup(attach);
{
p_content = parseContent(content_name);
p_attach = xbt_strdup(attach);
{
m_usedSize = 0;
if ((!filename) || (strcmp(filename, "") == 0))
{
m_usedSize = 0;
if ((!filename) || (strcmp(filename, "") == 0))
xbt_dict_t parse_content = xbt_dict_new_homogeneous(xbt_free_f);
FILE *file = surf_fopen(filename, "r");
xbt_assert(file, "Cannot open file '%s' (path=%s)", filename, xbt_str_join(surf_path, ":"));
xbt_dict_t parse_content = xbt_dict_new_homogeneous(xbt_free_f);
FILE *file = surf_fopen(filename, "r");
xbt_assert(file, "Cannot open file '%s' (path=%s)", filename, xbt_str_join(surf_path, ":"));
size_t len = 0;
ssize_t read;
char path[1024];
size_t len = 0;
ssize_t read;
char path[1024];
m_usedSize += size;
sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = size;
m_usedSize += size;
sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = size;
- xbt_dict_set(parse_content,path,psize,NULL);
+ xbt_dict_set(parse_content,path,psize,nullptr);
{
/* For the moment this action has no cost, but in the future we could take in account access latency of the disk */
{
/* For the moment this action has no cost, but in the future we could take in account access latency of the disk */
- xbt_dict_t content_dict = xbt_dict_new_homogeneous(NULL);
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_t content_dict = xbt_dict_new_homogeneous(nullptr);
+ xbt_dict_cursor_t cursor = nullptr;
char *file;
sg_size_t *psize;
xbt_dict_foreach(p_content, cursor, file, psize){
char *file;
sg_size_t *psize;
xbt_dict_foreach(p_content, cursor, file, psize){
- xbt_dict_set(content_dict,file,psize,NULL);
+ xbt_dict_set(content_dict,file,psize,nullptr);
StorageAction::StorageAction(Model *model, double cost, bool failed,
Storage *storage, e_surf_action_storage_type_t type)
: Action(model, cost, failed)
StorageAction::StorageAction(Model *model, double cost, bool failed,
Storage *storage, e_surf_action_storage_type_t type)
: Action(model, cost, failed)
-, m_type(type), p_storage(storage), p_file(NULL){
+, m_type(type), p_storage(storage), p_file(nullptr){
progress = 0;
};
StorageAction::StorageAction(Model *model, double cost, bool failed, lmm_variable_t var,
Storage *storage, e_surf_action_storage_type_t type)
: Action(model, cost, failed, var)
progress = 0;
};
StorageAction::StorageAction(Model *model, double cost, bool failed, lmm_variable_t var,
Storage *storage, e_surf_action_storage_type_t type)
: Action(model, cost, failed, var)
- , m_type(type), p_storage(storage), p_file(NULL){
+ , m_type(type), p_storage(storage), p_file(nullptr){
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_storage);
static int storage_selective_update = 0;
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_storage);
static int storage_selective_update = 0;
-static xbt_swag_t storage_running_action_set_that_does_not_need_being_checked = NULL;
+static xbt_swag_t storage_running_action_set_that_does_not_need_being_checked = nullptr;
/*************
* CallBacks *
/*************
* CallBacks *
namespace surf {
StorageN11Model::StorageN11Model() : StorageModel() {
namespace surf {
StorageN11Model::StorageN11Model() : StorageModel() {
+ Action *action = nullptr;
XBT_DEBUG("surf_storage_model_init_internal");
XBT_DEBUG("surf_storage_model_init_internal");
StorageN11Model::~StorageN11Model(){
xbt_swag_free(storage_running_action_set_that_does_not_need_being_checked);
StorageN11Model::~StorageN11Model(){
xbt_swag_free(storage_running_action_set_that_does_not_need_being_checked);
- storage_running_action_set_that_does_not_need_being_checked = NULL;
+ storage_running_action_set_that_does_not_need_being_checked = nullptr;
}
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
}
#include "src/surf/xml/platf.hpp" // FIXME: move that back to the parsing area
Bread);
if(!p_storageList)
Bread);
if(!p_storageList)
- p_storageList = xbt_dynar_new(sizeof(char *),NULL);
+ p_storageList = xbt_dynar_new(sizeof(char *),nullptr);
xbt_dynar_push(p_storageList, &storage);
return storage;
xbt_dynar_push(p_storageList, &storage);
return storage;
void StorageN11Model::updateActionsState(double /*now*/, double delta)
{
void StorageN11Model::updateActionsState(double /*now*/, double delta)
{
- StorageAction *action = NULL;
+ StorageAction *action = nullptr;
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
sg_size_t *psize = xbt_new(sg_size_t,1);
*psize = action->p_file->size;
xbt_dict_t content_dict = action->p_storage->p_content;
sg_size_t *psize = xbt_new(sg_size_t,1);
*psize = action->p_file->size;
xbt_dict_t content_dict = action->p_storage->p_content;
- xbt_dict_set(content_dict, action->p_file->name, psize, NULL);
+ xbt_dict_set(content_dict, action->p_file->name, psize, nullptr);
}
action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
}
action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
psize = xbt_new(sg_size_t,1);
size = 0;
*psize = size;
psize = xbt_new(sg_size_t,1);
size = 0;
*psize = size;
- xbt_dict_set(p_content, path, psize, NULL);
+ xbt_dict_set(p_content, path, psize, nullptr);
XBT_DEBUG("File '%s' was not found, file created.",path);
}
surf_file_t file = xbt_new0(s_surf_file_t,1);
XBT_DEBUG("File '%s' was not found, file created.",path);
}
surf_file_t file = xbt_new0(s_surf_file_t,1);
void surf_presolve(void)
{
double next_event_date = -1.0;
void surf_presolve(void)
{
double next_event_date = -1.0;
- tmgr_trace_iterator_t event = NULL;
+ tmgr_trace_iterator_t event = nullptr;
- simgrid::surf::Resource *resource = NULL;
- simgrid::surf::Model *model = NULL;
+ simgrid::surf::Resource *resource = nullptr;
+ simgrid::surf::Model *model = nullptr;
unsigned int iter;
XBT_DEBUG ("Consume all trace events occurring before the starting time.");
unsigned int iter;
XBT_DEBUG ("Consume all trace events occurring before the starting time.");
double next_event_date = -1.0;
double model_next_action_end = -1.0;
double value = -1.0;
double next_event_date = -1.0;
double model_next_action_end = -1.0;
double value = -1.0;
- simgrid::surf::Resource *resource = NULL;
- simgrid::surf::Model *model = NULL;
- tmgr_trace_iterator_t event = NULL;
+ simgrid::surf::Resource *resource = nullptr;
+ simgrid::surf::Model *model = nullptr;
+ tmgr_trace_iterator_t event = nullptr;
unsigned int iter;
if (max_date > 0.0) {
unsigned int iter;
if (max_date > 0.0) {
if ((time_delta < 0.0 || next_event_phy < time_delta) && next_event_phy >= 0.0) {
time_delta = next_event_phy;
}
if ((time_delta < 0.0 || next_event_phy < time_delta) && next_event_phy >= 0.0) {
time_delta = next_event_phy;
}
- if (surf_vm_model != NULL) {
+ if (surf_vm_model != nullptr) {
XBT_DEBUG("Looking for next event in virtual models");
double next_event_virt = surf_vm_model->next_occuring_event(NOW);
if ((time_delta < 0.0 || next_event_virt < time_delta) && next_event_virt >= 0.0)
XBT_DEBUG("Looking for next event in virtual models");
double next_event_virt = surf_vm_model->next_occuring_event(NOW);
if ((time_delta < 0.0 || next_event_virt < time_delta) && next_event_virt >= 0.0)
surf_action_t surf_model_extract_done_action_set(surf_model_t model){
if (model->getDoneActionSet()->empty())
surf_action_t surf_model_extract_done_action_set(surf_model_t model){
if (model->getDoneActionSet()->empty())
surf_action_t res = &model->getDoneActionSet()->front();
model->getDoneActionSet()->pop_front();
return res;
surf_action_t res = &model->getDoneActionSet()->front();
model->getDoneActionSet()->pop_front();
return res;
surf_action_t surf_model_extract_failed_action_set(surf_model_t model){
if (model->getFailedActionSet()->empty())
surf_action_t surf_model_extract_failed_action_set(surf_model_t model){
if (model->getFailedActionSet()->empty())
surf_action_t res = &model->getFailedActionSet()->front();
model->getFailedActionSet()->pop_front();
return res;
surf_action_t res = &model->getFailedActionSet()->front();
model->getFailedActionSet()->pop_front();
return res;
/* model_list_invoke contains only surf_host and surf_vm.
* The callback functions of cpu_model and network_model will be called from those of these host models. */
/* model_list_invoke contains only surf_host and surf_vm.
* The callback functions of cpu_model and network_model will be called from those of these host models. */
-xbt_dynar_t all_existing_models = NULL; /* to destroy models correctly */
-xbt_dynar_t model_list_invoke = NULL; /* to invoke callbacks */
+xbt_dynar_t all_existing_models = nullptr; /* to destroy models correctly */
+xbt_dynar_t model_list_invoke = nullptr; /* to invoke callbacks */
simgrid::trace_mgr::future_evt_set *future_evt_set = nullptr;
simgrid::trace_mgr::future_evt_set *future_evt_set = nullptr;
-xbt_dynar_t surf_path = NULL;
-xbt_dynar_t host_that_restart = xbt_dynar_new(sizeof(char*), NULL);
+xbt_dynar_t surf_path = nullptr;
+xbt_dynar_t host_that_restart = xbt_dynar_new(sizeof(char*), nullptr);
xbt_dict_t watched_hosts_lib;
namespace simgrid {
xbt_dict_t watched_hosts_lib;
namespace simgrid {
s_surf_model_description_t surf_plugin_description[] = {
{"Energy", "Cpu energy consumption.", sg_energy_plugin_init},
s_surf_model_description_t surf_plugin_description[] = {
{"Energy", "Cpu energy consumption.", sg_energy_plugin_init},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
/* Don't forget to update the option description in smx_config when you change this */
};
/* Don't forget to update the option description in smx_config when you change this */
surf_network_model_init_Reno2},
{"Vegas", "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info).",
surf_network_model_init_Vegas},
surf_network_model_init_Reno2},
{"Vegas", "Model from Steven H. Low using lagrange_solve instead of lmm_solve (experts only; check the code for more info).",
surf_network_model_init_Vegas},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_surf_model_description_t surf_cpu_model_description[] = {
{"Cas01", "Simplistic CPU model (time=size/power).", surf_cpu_model_init_Cas01},
};
s_surf_model_description_t surf_cpu_model_description[] = {
{"Cas01", "Simplistic CPU model (time=size/power).", surf_cpu_model_init_Cas01},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_surf_model_description_t surf_host_model_description[] = {
{"default", "Default host model. Currently, CPU:Cas01 and network:LV08 (with cross traffic enabled)", surf_host_model_init_current_default},
{"compound", "Host model that is automatically chosen if you change the network and CPU models", surf_host_model_init_compound},
{"ptask_L07", "Host model somehow similar to Cas01+CM02 but allowing parallel tasks", surf_host_model_init_ptask_L07},
};
s_surf_model_description_t surf_host_model_description[] = {
{"default", "Default host model. Currently, CPU:Cas01 and network:LV08 (with cross traffic enabled)", surf_host_model_init_current_default},
{"compound", "Host model that is automatically chosen if you change the network and CPU models", surf_host_model_init_compound},
{"ptask_L07", "Host model somehow similar to Cas01+CM02 but allowing parallel tasks", surf_host_model_init_ptask_L07},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_surf_model_description_t surf_vm_model_description[] = {
{"default", "Default vm model.", surf_vm_model_init_HL13},
};
s_surf_model_description_t surf_vm_model_description[] = {
{"default", "Default vm model.", surf_vm_model_init_HL13},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_surf_model_description_t surf_optimization_mode_description[] = {
};
s_surf_model_description_t surf_optimization_mode_description[] = {
- {"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", NULL},
- {"TI", "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU model for now).", NULL},
- {"Full", "Full update of remaining and variables. Slow but may be useful when debugging.", NULL},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {"Lazy", "Lazy action management (partial invalidation in lmm + heap in action remaining).", nullptr},
+ {"TI", "Trace integration. Highly optimized mode when using availability traces (only available for the Cas01 CPU model for now).", nullptr},
+ {"Full", "Full update of remaining and variables. Slow but may be useful when debugging.", nullptr},
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
s_surf_model_description_t surf_storage_model_description[] = {
{"default", "Simplistic storage model.", surf_storage_model_init_default},
};
s_surf_model_description_t surf_storage_model_description[] = {
{"default", "Simplistic storage model.", surf_storage_model_init_default},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {nullptr, nullptr, nullptr} /* this array must be nullptr terminated */
};
#if HAVE_THREAD_CONTEXTS
};
#if HAVE_THREAD_CONTEXTS
-static xbt_parmap_t surf_parmap = NULL; /* parallel map on models */
+static xbt_parmap_t surf_parmap = nullptr; /* parallel map on models */
FILE *surf_fopen(const char *name, const char *mode)
{
unsigned int cpt;
FILE *surf_fopen(const char *name, const char *mode)
{
unsigned int cpt;
+ char *path_elm = nullptr;
char root[4] = { 0 };
if (!len)
char root[4] = { 0 };
if (!len)
strncpy(root, current_directory, 3);
strncpy(root, current_directory, 3);
return disk_drives_letter_table[i];
}
return disk_drives_letter_table[i];
}
#else
return "./";
#endif
#else
return "./";
#endif
const char *name)
{
int i;
const char *name)
{
int i;
- char *name_list = NULL;
+ char *name_list = nullptr;
for (i = 0; table[i].name; i++)
if (!strcmp(name, table[i].name)) {
for (i = 0; table[i].name; i++)
if (!strcmp(name, table[i].name)) {
simgrid::s4u::Host::onDestruction(*host);
delete host;
});
simgrid::s4u::Host::onDestruction(*host);
delete host;
});
- USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(NULL);
+ USER_HOST_LEVEL = simgrid::s4u::Host::extension_create(nullptr);
as_router_lib = xbt_lib_new();
storage_lib = xbt_lib_new();
storage_type_lib = xbt_lib_new();
file_lib = xbt_lib_new();
as_router_lib = xbt_lib_new();
storage_lib = xbt_lib_new();
storage_type_lib = xbt_lib_new();
file_lib = xbt_lib_new();
- watched_hosts_lib = xbt_dict_new_homogeneous(NULL);
+ watched_hosts_lib = xbt_dict_new_homogeneous(nullptr);
XBT_DEBUG("Add routing levels");
XBT_DEBUG("Add routing levels");
- ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, NULL);
+ ROUTING_PROP_ASR_LEVEL = xbt_lib_add_level(as_router_lib, nullptr);
ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) {
delete static_cast<simgrid::surf::NetCard*>(p);
});
ROUTING_ASR_LEVEL = xbt_lib_add_level(as_router_lib, [](void* p) {
delete static_cast<simgrid::surf::NetCard*>(p);
});
xbt_init(argc, argv);
if (!all_existing_models)
xbt_init(argc, argv);
if (!all_existing_models)
- all_existing_models = xbt_dynar_new(sizeof(simgrid::surf::Model*), NULL);
+ all_existing_models = xbt_dynar_new(sizeof(simgrid::surf::Model*), nullptr);
- model_list_invoke = xbt_dynar_new(sizeof(simgrid::surf::Model*), NULL);
+ model_list_invoke = xbt_dynar_new(sizeof(simgrid::surf::Model*), nullptr);
if (!future_evt_set)
future_evt_set = new simgrid::trace_mgr::future_evt_set();
if (!future_evt_set)
future_evt_set = new simgrid::trace_mgr::future_evt_set();
void surf_exit(void)
{
unsigned int iter;
void surf_exit(void)
{
unsigned int iter;
- simgrid::surf::Model *model = NULL;
+ simgrid::surf::Model *model = nullptr;
TRACE_end(); /* Just in case it was not called by the upper
* layer (or there is no upper layer) */
TRACE_end(); /* Just in case it was not called by the upper
* layer (or there is no upper layer) */
namespace surf {
Model::Model()
namespace surf {
Model::Model()
+ : maxminSystem_(nullptr)
{
readyActionSet_ = new ActionList();
runningActionSet_ = new ActionList();
failedActionSet_ = new ActionList();
doneActionSet_ = new ActionList();
{
readyActionSet_ = new ActionList();
runningActionSet_ = new ActionList();
failedActionSet_ = new ActionList();
doneActionSet_ = new ActionList();
- modifiedSet_ = NULL;
- actionHeap_ = NULL;
+ modifiedSet_ = nullptr;
+ actionHeap_ = nullptr;
updateMechanism_ = UM_UNDEFINED;
selectiveUpdate_ = 0;
}
updateMechanism_ = UM_UNDEFINED;
selectiveUpdate_ = 0;
}
double Model::next_occuring_event_lazy(double now)
{
double Model::next_occuring_event_lazy(double now)
{
+ Action *action = nullptr;
double min = -1;
double share;
double min = -1;
double share;
lmm_system_t sys,
void (*solve) (lmm_system_t))
{
lmm_system_t sys,
void (*solve) (lmm_system_t))
{
+ Action *action = nullptr;
double min = -1;
double value = -1;
double min = -1;
double value = -1;
stateSet_ = getModel()->getDoneActionSet();
break;
default:
stateSet_ = getModel()->getDoneActionSet();
break;
default:
simgrid::surf::NetCard *sg_netcard_by_name_or_null(const char *name)
{
sg_host_t h = sg_host_by_name(name);
simgrid::surf::NetCard *sg_netcard_by_name_or_null(const char *name)
{
sg_host_t h = sg_host_by_name(name);
- simgrid::surf::NetCard *netcard = h==NULL ? NULL: h->pimpl_netcard;
+ simgrid::surf::NetCard *netcard = h==nullptr ? nullptr: h->pimpl_netcard;
if (!netcard)
netcard = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
return netcard;
}
/* Global vars */
if (!netcard)
netcard = (simgrid::surf::NetCard*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
return netcard;
}
/* Global vars */
-simgrid::surf::RoutingPlatf *routing_platf = NULL;
+simgrid::surf::RoutingPlatf *routing_platf = nullptr;
void sg_platf_new_trace(sg_platf_trace_cbarg_t trace)
void sg_platf_new_trace(sg_platf_trace_cbarg_t trace)
"Trace '%s' must have either a content, or point to a file on disk.",trace->id);
tmgr_trace = tmgr_trace_new_from_string(trace->id, trace->pc_data, trace->periodicity);
}
"Trace '%s' must have either a content, or point to a file on disk.",trace->id);
tmgr_trace = tmgr_trace_new_from_string(trace->id, trace->pc_data, trace->periodicity);
}
- xbt_dict_set(traces_set_list, trace->id, (void *) tmgr_trace, NULL);
+ xbt_dict_set(traces_set_list, trace->id, (void *) tmgr_trace, nullptr);
* \param src the network_element_t for src host
* \param dst the network_element_t for dst host
* \param route where to store the list of links.
* \param src the network_element_t for src host
* \param dst the network_element_t for dst host
* \param route where to store the list of links.
- * If *route=NULL, create a short lived dynar. Else, fill the provided dynar
- * \param latency where to store the latency experienced on the path (or NULL if not interested)
+ * If *route=nullptr, create a short lived dynar. Else, fill the provided dynar
+ * \param latency where to store the latency experienced on the path (or nullptr if not interested)
* It is the caller responsability to initialize latency to 0 (we add to provided route)
* It is the caller responsability to initialize latency to 0 (we add to provided route)
*
* walk through the routing components tree and find a route between hosts
* by calling each "get_route" function in each routing component.
*
* walk through the routing components tree and find a route between hosts
* by calling each "get_route" function in each routing component.
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
AsImpl *rc_child;
xbt_dict_foreach(as->children(), cursor, key, rc_child) {
xbt_dynar_t onelink_child = _recursiveGetOneLinkRoutes(rc_child);
AsImpl *rc_child;
xbt_dict_foreach(as->children(), cursor, key, rc_child) {
xbt_dynar_t onelink_child = _recursiveGetOneLinkRoutes(rc_child);
void **data;
simgrid::surf::NetCard *host_elm;
xbt_lib_foreach(storage_lib, cursor, key, data) {
void **data;
simgrid::surf::NetCard *host_elm;
xbt_lib_foreach(storage_lib, cursor, key, data) {
- if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
+ if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != nullptr) {
simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
host_elm = sg_netcard_by_name_or_null(storage->p_attach);
if(!host_elm)
simgrid::surf::Storage *storage = static_cast<simgrid::surf::Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
host_elm = sg_netcard_by_name_or_null(storage->p_attach);
if(!host_elm)
simgrid::trace_mgr::trace::trace()
{
simgrid::trace_mgr::trace::trace()
{
- event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), NULL);
+ event_list = xbt_dynar_new(sizeof(s_tmgr_event_t), nullptr);
}
simgrid::trace_mgr::trace::~trace()
}
simgrid::trace_mgr::trace::~trace()
tmgr_trace_t tmgr_trace_new_from_string(const char *name, const char *input, double periodicity)
{
int linecount = 0;
tmgr_trace_t tmgr_trace_new_from_string(const char *name, const char *input, double periodicity)
{
int linecount = 0;
- tmgr_event_t last_event = NULL;
+ tmgr_event_t last_event = nullptr;
unsigned int cpt;
char *val;
unsigned int cpt;
char *val;
xbt_assert(trace_list.find(filename) == trace_list.end(), "Refusing to define trace %s twice", filename);
FILE *f = surf_fopen(filename, "r");
xbt_assert(trace_list.find(filename) == trace_list.end(), "Refusing to define trace %s twice", filename);
FILE *f = surf_fopen(filename, "r");
+ xbt_assert(f != nullptr,
"Cannot open file '%s' (path=%s)", filename, xbt_str_join(surf_path, ":"));
char *tstr = xbt_str_from_file(f);
"Cannot open file '%s' (path=%s)", filename, xbt_str_join(surf_path, ":"));
char *tstr = xbt_str_from_file(f);
/** @brief Registers a new trace into the future event set, and get an iterator over the integrated trace */
tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::add_trace(tmgr_trace_t trace, double start_time, surf::Resource *resource)
{
/** @brief Registers a new trace into the future event set, and get an iterator over the integrated trace */
tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::add_trace(tmgr_trace_t trace, double start_time, surf::Resource *resource)
{
- tmgr_trace_iterator_t trace_iterator = NULL;
+ tmgr_trace_iterator_t trace_iterator = nullptr;
trace_iterator = xbt_new0(s_tmgr_trace_event_t, 1);
trace_iterator->trace = trace;
trace_iterator = xbt_new0(s_tmgr_trace_event_t, 1);
trace_iterator->trace = trace;
-/** @brief Retrieves the next occurring event, or NULL if none happens before #date */
+/** @brief Retrieves the next occurring event, or nullptr if none happens before #date */
tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::pop_leq(
double date, double *value, simgrid::surf::Resource **resource)
{
double event_date = next_date();
if (event_date > date)
tmgr_trace_iterator_t simgrid::trace_mgr::future_evt_set::pop_leq(
double date, double *value, simgrid::surf::Resource **resource)
{
double event_date = next_date();
if (event_date > date)
tmgr_trace_iterator_t trace_iterator = (tmgr_trace_iterator_t)xbt_heap_pop(p_heap);
tmgr_trace_iterator_t trace_iterator = (tmgr_trace_iterator_t)xbt_heap_pop(p_heap);
- if (trace_iterator == NULL)
- return NULL;
+ if (trace_iterator == nullptr)
+ return nullptr;
tmgr_trace_t trace = trace_iterator->trace;
*resource = trace_iterator->resource;
tmgr_trace_t trace = trace_iterator->trace;
*resource = trace_iterator->resource;
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf, "Logging specific to the SURF VM module");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf, "Logging specific to the SURF VM module");
-simgrid::surf::VMModel *surf_vm_model = NULL;
+simgrid::surf::VMModel *surf_vm_model = nullptr;
namespace simgrid {
namespace surf {
namespace simgrid {
namespace surf {
************/
VirtualMachine::VirtualMachine(HostModel *model, const char *name, simgrid::s4u::Host *hostPM)
************/
VirtualMachine::VirtualMachine(HostModel *model, const char *name, simgrid::s4u::Host *hostPM)
-: HostImpl(model, name, NULL, NULL, NULL)
+: HostImpl(model, name, nullptr, nullptr, nullptr)
, hostPM_(hostPM)
{
VMModel::ws_vms.push_back(*this);
, hostPM_(hostPM)
{
VMModel::ws_vms.push_back(*this);
: VirtualMachine(model, name, host_PM)
{
/* Currently, we assume a VM has no storage. */
: VirtualMachine(model, name, host_PM)
{
/* Currently, we assume a VM has no storage. */
/* Currently, a VM uses the network resource of its physical host. In
* host_lib, this network resource object is referred from two different keys.
/* Currently, a VM uses the network resource of its physical host. In
* host_lib, this network resource object is referred from two different keys.
*/
/* This buffer is used to store the original buffer before substituting it by out own buffer. Useful for the cluster tag */
*/
/* This buffer is used to store the original buffer before substituting it by out own buffer. Useful for the cluster tag */
-static xbt_dynar_t surfxml_bufferstack_stack = NULL;
+static xbt_dynar_t surfxml_bufferstack_stack = nullptr;
int surfxml_bufferstack_size = 2048;
int surfxml_bufferstack_size = 2048;
-static char *old_buff = NULL;
+static char *old_buff = nullptr;
XBT_IMPORT_NO_EXPORT(unsigned int) surfxml_buffer_stack_stack_ptr;
XBT_IMPORT_NO_EXPORT(unsigned int) surfxml_buffer_stack_stack[1024];
XBT_IMPORT_NO_EXPORT(unsigned int) surfxml_buffer_stack_stack_ptr;
XBT_IMPORT_NO_EXPORT(unsigned int) surfxml_buffer_stack_stack[1024];
-xbt_dict_t traces_set_list = NULL;
-XBT_PRIVATE xbt_dict_t trace_connect_list_host_avail = NULL;
-XBT_PRIVATE xbt_dict_t trace_connect_list_host_speed = NULL;
-XBT_PRIVATE xbt_dict_t trace_connect_list_link_avail = NULL;
-XBT_PRIVATE xbt_dict_t trace_connect_list_link_bw = NULL;
-XBT_PRIVATE xbt_dict_t trace_connect_list_link_lat = NULL;
+xbt_dict_t traces_set_list = nullptr;
+XBT_PRIVATE xbt_dict_t trace_connect_list_host_avail = nullptr;
+XBT_PRIVATE xbt_dict_t trace_connect_list_host_speed = nullptr;
+XBT_PRIVATE xbt_dict_t trace_connect_list_link_avail = nullptr;
+XBT_PRIVATE xbt_dict_t trace_connect_list_link_bw = nullptr;
+XBT_PRIVATE xbt_dict_t trace_connect_list_link_lat = nullptr;
void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect)
{
void sg_platf_trace_connect(sg_platf_trace_connect_cbarg_t trace_connect)
{
case SURF_TRACE_CONNECT_KIND_HOST_AVAIL:
xbt_dict_set(trace_connect_list_host_avail,
trace_connect->trace,
case SURF_TRACE_CONNECT_KIND_HOST_AVAIL:
xbt_dict_set(trace_connect_list_host_avail,
trace_connect->trace,
- xbt_strdup(trace_connect->element), NULL);
+ xbt_strdup(trace_connect->element), nullptr);
break;
case SURF_TRACE_CONNECT_KIND_SPEED:
xbt_dict_set(trace_connect_list_host_speed, trace_connect->trace,
break;
case SURF_TRACE_CONNECT_KIND_SPEED:
xbt_dict_set(trace_connect_list_host_speed, trace_connect->trace,
- xbt_strdup(trace_connect->element), NULL);
+ xbt_strdup(trace_connect->element), nullptr);
break;
case SURF_TRACE_CONNECT_KIND_LINK_AVAIL:
xbt_dict_set(trace_connect_list_link_avail,
trace_connect->trace,
break;
case SURF_TRACE_CONNECT_KIND_LINK_AVAIL:
xbt_dict_set(trace_connect_list_link_avail,
trace_connect->trace,
- xbt_strdup(trace_connect->element), NULL);
+ xbt_strdup(trace_connect->element), nullptr);
break;
case SURF_TRACE_CONNECT_KIND_BANDWIDTH:
xbt_dict_set(trace_connect_list_link_bw,
trace_connect->trace,
break;
case SURF_TRACE_CONNECT_KIND_BANDWIDTH:
xbt_dict_set(trace_connect_list_link_bw,
trace_connect->trace,
- xbt_strdup(trace_connect->element), NULL);
+ xbt_strdup(trace_connect->element), nullptr);
break;
case SURF_TRACE_CONNECT_KIND_LATENCY:
xbt_dict_set(trace_connect_list_link_lat, trace_connect->trace,
break;
case SURF_TRACE_CONNECT_KIND_LATENCY:
xbt_dict_set(trace_connect_list_link_lat, trace_connect->trace,
- xbt_strdup(trace_connect->element), NULL);
+ xbt_strdup(trace_connect->element), nullptr);
break;
default:
surf_parse_error("Cannot connect trace %s to %s: kind of trace unknown",
break;
default:
surf_parse_error("Cannot connect trace %s to %s: kind of trace unknown",
void parse_platform_file(const char *file)
{
#if HAVE_LUA
void parse_platform_file(const char *file)
{
#if HAVE_LUA
- int is_lua = (file != NULL && strlen(file) > 3 && file[strlen(file)-3] == 'l' && file[strlen(file)-2] == 'u'
+ int is_lua = (file != nullptr && strlen(file) > 3 && file[strlen(file)-3] == 'l' && file[strlen(file)-2] == 'u'
&& file[strlen(file)-1] == 'a');
#endif
&& file[strlen(file)-1] == 'a');
#endif
after_config_done = 0;
surf_parse_open(file);
after_config_done = 0;
surf_parse_open(file);
- traces_set_list = xbt_dict_new_homogeneous(NULL);
+ traces_set_list = xbt_dict_new_homogeneous(nullptr);
trace_connect_list_host_avail = xbt_dict_new_homogeneous(free);
trace_connect_list_host_speed = xbt_dict_new_homogeneous(free);
trace_connect_list_link_avail = xbt_dict_new_homogeneous(free);
trace_connect_list_host_avail = xbt_dict_new_homogeneous(free);
trace_connect_list_host_speed = xbt_dict_new_homogeneous(free);
trace_connect_list_link_avail = xbt_dict_new_homogeneous(free);
/* Init my data */
if (!surfxml_bufferstack_stack)
/* Init my data */
if (!surfxml_bufferstack_stack)
- surfxml_bufferstack_stack = xbt_dynar_new(sizeof(char *), NULL);
+ surfxml_bufferstack_stack = xbt_dynar_new(sizeof(char *), nullptr);
/* Do the actual parsing */
parse_status = surf_parse();
/* connect all traces relative to hosts */
/* Do the actual parsing */
parse_status = surf_parse();
/* connect all traces relative to hosts */
- xbt_dict_cursor_t cursor = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
char *trace_name, *elm;
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
char *trace_name, *elm;
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
XBT_DEBUG("pstate: %s", A_surfxml_host_pstate);
host.core_amount = surf_parse_get_int(A_surfxml_host_core);
XBT_DEBUG("pstate: %s", A_surfxml_host_pstate);
host.core_amount = surf_parse_get_int(A_surfxml_host_core);
- host.speed_trace = A_surfxml_host_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_availability___file) : NULL;
- host.state_trace = A_surfxml_host_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_state___file) : NULL;
+ host.speed_trace = A_surfxml_host_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_availability___file) : nullptr;
+ host.state_trace = A_surfxml_host_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_host_state___file) : nullptr;
host.pstate = surf_parse_get_int(A_surfxml_host_pstate);
host.coord = A_surfxml_host_coordinates;
host.pstate = surf_parse_get_int(A_surfxml_host_pstate);
host.coord = A_surfxml_host_coordinates;
peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id);
peer.lat = surf_parse_get_time(A_surfxml_peer_lat, "lat of peer", peer.id);
peer.coord = A_surfxml_peer_coordinates;
peer.bw_out = surf_parse_get_bandwidth(A_surfxml_peer_bw___out, "bw_out of peer", peer.id);
peer.lat = surf_parse_get_time(A_surfxml_peer_lat, "lat of peer", peer.id);
peer.coord = A_surfxml_peer_coordinates;
- peer.availability_trace = A_surfxml_peer_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_availability___file) : NULL;
- peer.state_trace = A_surfxml_peer_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_state___file) : NULL;
+ peer.availability_trace = A_surfxml_peer_availability___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_availability___file) : nullptr;
+ peer.state_trace = A_surfxml_peer_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_peer_state___file) : nullptr;
sg_platf_new_peer(&peer);
}
sg_platf_new_peer(&peer);
}
link.properties = current_property_set;
link.id = A_surfxml_link_id;
link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth, "bandwidth of link", link.id);
link.properties = current_property_set;
link.id = A_surfxml_link_id;
link.bandwidth = surf_parse_get_bandwidth(A_surfxml_link_bandwidth, "bandwidth of link", link.id);
- link.bandwidth_trace = A_surfxml_link_bandwidth___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_bandwidth___file) : NULL;
+ link.bandwidth_trace = A_surfxml_link_bandwidth___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_bandwidth___file) : nullptr;
link.latency = surf_parse_get_time(A_surfxml_link_latency, "latency of link", link.id);
link.latency = surf_parse_get_time(A_surfxml_link_latency, "latency of link", link.id);
- link.latency_trace = A_surfxml_link_latency___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_latency___file) : NULL;
- link.state_trace = A_surfxml_link_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_state___file):NULL;
+ link.latency_trace = A_surfxml_link_latency___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_latency___file) : nullptr;
+ link.state_trace = A_surfxml_link_state___file[0] ? tmgr_trace_new_from_file(A_surfxml_link_state___file):nullptr;
switch (A_surfxml_link_sharing___policy) {
case A_surfxml_link_sharing___policy_SHARED:
switch (A_surfxml_link_sharing___policy) {
case A_surfxml_link_sharing___policy_SHARED:
void surf_parse_open(const char *file)
{
void surf_parse_open(const char *file)
{
- xbt_assert(file, "Cannot parse the NULL file. Bypassing the parser is strongly deprecated nowadays.");
+ xbt_assert(file, "Cannot parse the nullptr file. Bypassing the parser is strongly deprecated nowadays.");
if (!surf_input_buffer_stack)
surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), nullptr);
if (!surf_input_buffer_stack)
surf_input_buffer_stack = xbt_dynar_new(sizeof(YY_BUFFER_STATE), nullptr);