auto* q = static_cast<char*>(l->data);
while (*q != '\0') {
- if (*q == '%') {
- q++;
- do {
- switch (*q) {
- case '\0':
- fprintf(stderr, "Layout format (%s) ending with %%\n", (char*)l->data);
- xbt_abort();
- case '%':
- *p = '%';
- check_overflow(1);
- break;
- case 'n': /* platform-dependant line separator; LOG4J compliant */
- *p = '\n';
- check_overflow(1);
- break;
- case 'e': /* plain space; SimGrid extension */
- *p = ' ';
- check_overflow(1);
- break;
- case '.': /* precision specifier */
- precision = static_cast<int>(strtol(q + 1, &q, 10));
- continue; /* conversion specifier still not found, continue reading */
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- case '9': /* length modifier */
- length = static_cast<int>(strtol(q, &q, 10));
- continue; /* conversion specifier still not found, continue reading */
- case 'c': /* category name; LOG4J compliant
- should accept a precision postfix to show the hierarchy */
- show_string(ev->cat->name);
- break;
- case 'p': /* priority name; LOG4J compliant */
- show_string(xbt_log_priority_names[ev->priority]);
- break;
- case 'h': /* host name; SimGrid extension */
- show_string(sg_host_self_get_name());
- break;
- case 't': /* thread/process name; LOG4J compliant */
- case 'P': /* process name; SimGrid extension */
- show_string(xbt_procname());
- break;
- case 'i': /* process PID name; SimGrid extension */
- show_int(xbt_getpid());
- break;
- case 'F': /* file name; LOG4J compliant */
- show_string(ev->fileName);
- break;
- case 'l': { /* location; LOG4J compliant */
- int sz;
- set_sz_from_precision();
- int len = snprintf(p, sz, "%s:%d", ev->fileName, ev->lineNum);
- check_overflow(std::min(sz, len));
- break;
- }
- case 'L': /* line number; LOG4J compliant */
- show_int(ev->lineNum);
- break;
- case 'M': /* method (ie, function) name; LOG4J compliant */
- show_string(ev->functionName);
- break;
- case 'd': /* date; LOG4J compliant */
- case 'r': /* application age; LOG4J compliant */
- show_double(simgrid_get_clock());
- break;
- case 'm': { /* user-provided message; LOG4J compliant */
- int sz;
- set_sz_from_precision();
- va_list ap;
- va_copy(ap, ev->ap);
- int len = vsnprintf(p, sz, msg_fmt, ap);
- va_end(ap);
- check_overflow(std::min(sz, len));
- break;
- }
- default:
- fprintf(stderr, ERRMSG, *q, (char*)l->data);
- xbt_abort();
- }
- break; /* done, continue normally */
- } while (true);
- } else {
+ if (*q != '%') {
*p = *q;
check_overflow(1);
+ q++;
+ continue;
}
+
+ // *q == '%'
+ q++;
+ do {
+ switch (*q) {
+ case '\0':
+ fprintf(stderr, "Layout format (%s) ending with %%\n", (char*)l->data);
+ xbt_abort();
+ case '%':
+ *p = '%';
+ check_overflow(1);
+ break;
+ case 'n': /* platform-dependant line separator; LOG4J compliant */
+ *p = '\n';
+ check_overflow(1);
+ break;
+ case 'e': /* plain space; SimGrid extension */
+ *p = ' ';
+ check_overflow(1);
+ break;
+ case '.': /* precision specifier */
+ precision = static_cast<int>(strtol(q + 1, &q, 10));
+ continue; /* conversion specifier still not found, continue reading */
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
+ case '8':
+ case '9': /* length modifier */
+ length = static_cast<int>(strtol(q, &q, 10));
+ continue; /* conversion specifier still not found, continue reading */
+ case 'c': /* category name; LOG4J compliant
+ should accept a precision postfix to show the hierarchy */
+ show_string(ev->cat->name);
+ break;
+ case 'p': /* priority name; LOG4J compliant */
+ show_string(xbt_log_priority_names[ev->priority]);
+ break;
+ case 'h': /* host name; SimGrid extension */
+ show_string(sg_host_self_get_name());
+ break;
+ case 't': /* thread/process name; LOG4J compliant */
+ case 'P': /* process name; SimGrid extension */
+ show_string(xbt_procname());
+ break;
+ case 'i': /* process PID name; SimGrid extension */
+ show_int(xbt_getpid());
+ break;
+ case 'F': /* file name; LOG4J compliant */
+ show_string(ev->fileName);
+ break;
+ case 'l': { /* location; LOG4J compliant */
+ int sz;
+ set_sz_from_precision();
+ int len = snprintf(p, sz, "%s:%d", ev->fileName, ev->lineNum);
+ check_overflow(std::min(sz, len));
+ break;
+ }
+ case 'L': /* line number; LOG4J compliant */
+ show_int(ev->lineNum);
+ break;
+ case 'M': /* method (ie, function) name; LOG4J compliant */
+ show_string(ev->functionName);
+ break;
+ case 'd': /* date; LOG4J compliant */
+ case 'r': /* application age; LOG4J compliant */
+ show_double(simgrid_get_clock());
+ break;
+ case 'm': { /* user-provided message; LOG4J compliant */
+ int sz;
+ set_sz_from_precision();
+ va_list ap;
+ va_copy(ap, ev->ap);
+ int len = vsnprintf(p, sz, msg_fmt, ap);
+ va_end(ap);
+ check_overflow(std::min(sz, len));
+ break;
+ }
+ default:
+ fprintf(stderr, ERRMSG, *q, (char*)l->data);
+ xbt_abort();
+ }
+ break; /* done, continue normally */
+ } while (true);
q++;
}
*p = '\0';
// if it's for me, I'm done
std::string evtname = action->front();
- if (evtname.compare(name) == 0) {
+ if (evtname.compare(name) == 0)
return action;
- } else {
- // Else, I have to store it for the relevant colleague
- std::queue<ReplayAction*>* otherqueue = nullptr;
- auto act = action_queues.find(evtname);
- if (act != action_queues.end()) {
- otherqueue = act->second;
- } else { // Damn. Create the queue of that guy
- otherqueue = new std::queue<ReplayAction*>();
- action_queues.insert({evtname, otherqueue});
- }
- otherqueue->push(action);
+
+ // Else, I have to store it for the relevant colleague
+ std::queue<ReplayAction*>* otherqueue = nullptr;
+ auto act = action_queues.find(evtname);
+ if (act != action_queues.end()) {
+ otherqueue = act->second;
+ } else { // Damn. Create the queue of that guy
+ otherqueue = new std::queue<ReplayAction*>();
+ action_queues.insert({evtname, otherqueue});
}
+ otherqueue->push(action);
}
// end of file reached while searching in vain for more work
} else {
}
if (in_simple_quote || in_double_quote) {
end++;
- } else {
- if (*end == '\0')
- done = 1;
-
- *end = '\0';
- if (ctn) {
- /* Found a separator. Push the string if contains something */
- xbt_dynar_push(res, &beg);
- }
- ctn = 0;
-
- if (done)
- break;
-
- beg = ++end;
- /* trim within the string, manually to speed things up */
- while (*beg == ' ')
- beg++;
- end = beg;
+ break;
+ }
+ if (*end == '\0')
+ done = 1;
+
+ *end = '\0';
+ if (ctn) {
+ /* Found a separator. Push the string if contains something */
+ xbt_dynar_push(res, &beg);
}
+ ctn = 0;
+
+ if (done)
+ break;
+
+ beg = ++end;
+ /* trim within the string, manually to speed things up */
+ while (*beg == ' ')
+ beg++;
+ end = beg;
break;
default:
ctn = 1;
std::vector<simgrid::kernel::resource::LinkImpl*> route;
simgrid::kernel::routing::NetPoint* dst = host2->get_netpoint();
simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
- if (not route.empty()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), host2->get_cname());
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
+ if (route.empty())
+ continue;
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), host2->get_cname());
+ for (auto const& link : route)
+ std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
+ std::printf("\n </route>\n");
}
for (auto const& dst : netpoints) { // to router
- if (dst->is_router()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), dst->get_cname());
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
+ if (not dst->is_router())
+ continue;
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", host1->get_cname(), dst->get_cname());
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(src, dst, route, nullptr);
+ for (auto const& link : route)
+ std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
+ std::printf("\n </route>\n");
}
}
for (auto const& value1 : netpoints) { // Routes from router
- if (value1->is_router()) {
- for (auto const& value2 : netpoints) { // to router
- if (value2->is_router()) {
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), value2->get_cname());
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, value2, route, nullptr);
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
- }
- for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
- const simgrid::s4u::Host* host2 = hosts[it_dst];
- std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), host2->get_cname());
- std::vector<simgrid::kernel::resource::LinkImpl*> route;
- simgrid::kernel::routing::NetPoint* netcardDst = host2->get_netpoint();
- simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
- for (auto const& link : route)
- std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
- std::printf("\n </route>\n");
- }
+ if (not value1->is_router())
+ continue;
+ for (auto const& value2 : netpoints) { // to router
+ if (not value2->is_router())
+ continue;
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), value2->get_cname());
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, value2, route, nullptr);
+ for (auto const& link : route)
+ std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
+ std::printf("\n </route>\n");
+ }
+ for (unsigned int it_dst = 0; it_dst < totalHosts; it_dst++) { // Routes to host
+ const simgrid::s4u::Host* host2 = hosts[it_dst];
+ std::printf(" <route src=\"%s\" dst=\"%s\">\n ", value1->get_cname(), host2->get_cname());
+ std::vector<simgrid::kernel::resource::LinkImpl*> route;
+ simgrid::kernel::routing::NetPoint* netcardDst = host2->get_netpoint();
+ simgrid::kernel::routing::NetZoneImpl::get_global_route(value1, netcardDst, route, nullptr);
+ for (auto const& link : route)
+ std::printf("<link_ctn id=\"%s\"/>", link->get_cname());
+ std::printf("\n </route>\n");
}
}
xbt_free(hosts);