XBT_INFO("== Try to get a host property that does exist");
value = thehost->get_property(exist);
xbt_assert(value, "\tProperty %s is undefined (where it should)", exist);
- xbt_assert(!strcmp(value, "180"), "\tValue of property %s is defined to %s (where it should be 180)", exist, value);
+ xbt_assert(strcmp(value, "180") == 0, "\tValue of property %s is defined to %s (where it should be 180)", exist,
+ value);
XBT_INFO(" Property: %s old value: %s", exist, value);
XBT_INFO("== Trying to modify a host property");
/* Test if we have changed the value */
value = thehost->get_property(exist);
xbt_assert(value, "Property %s is undefined (where it should)", exist);
- xbt_assert(!strcmp(value, "250"), "Value of property %s is defined to %s (where it should be 250)", exist, value);
+ xbt_assert(strcmp(value, "250") == 0, "Value of property %s is defined to %s (where it should be 250)", exist, value);
XBT_INFO(" Property: %s old value: %s", exist, value);
/* Restore the value for the next test */
{
XBT_INFO("Entering the race...");
std::unique_lock<simgrid::s4u::Mutex> lck(*mtx);
- while (!ready) {
+ while (not ready) {
auto now = simgrid::s4u::Engine::get_clock();
if (cv->wait_until(lck, now + (id+1)*0.25) == std::cv_status::timeout) {
XBT_INFO("Out of wait_until (timeout)");
// Let's read the filename
std::ifstream traces_file(job->filename);
- if (!traces_file.is_open())
+ if (not traces_file.is_open())
throw std::invalid_argument("Cannot open file " + job->filename);
std::string traces_line;
#define _lua_ensure_ARG1(cond) _lua_ensure_ARGN((cond), "Assertion " _XBT_STRINGIFY(cond) " failed")
#define _lua_ensure_ARGN(cond, ...) \
do { \
- if (!(cond)) { \
+ if (not(cond)) { \
luaL_error(L, __VA_ARGS__); \
return -1; \
} \
void EvtSetTools::pushBack(EventSet& events, UnfoldingEvent* e)
{
- if (!EvtSetTools::contains(events, e))
+ if (not EvtSetTools::contains(events, e))
events.push_back(e);
}
void LinkEnergy::update()
{
- if (!inited_)
+ if (not inited_)
init_watts_range_list();
double power = get_power();
double LinkEnergy::get_power() const
{
- if (!inited_)
+ if (not inited_)
return 0.0;
double power_slope = busy_ - idle_;
void LinkLoad::track()
{
- xbt_assert(!is_tracked_, "Trying to track load of link '%s' while it is already tracked, aborting.",
+ xbt_assert(not is_tracked_, "Trying to track load of link '%s' while it is already tracked, aborting.",
link_->get_cname());
XBT_DEBUG("Tracking load of link '%s'", link_->get_cname());
void sg_link_load_plugin_init()
{
xbt_assert(sg_host_count() == 0, "Please call sg_link_load_plugin_init() BEFORE initializing the platform.");
- xbt_assert(!LinkLoad::EXTENSION_ID.valid(), "Double call to sg_link_load_plugin_init. Aborting.");
+ xbt_assert(not LinkLoad::EXTENSION_ID.valid(), "Double call to sg_link_load_plugin_init. Aborting.");
LinkLoad::EXTENSION_ID = simgrid::s4u::Link::extension_create<LinkLoad>();
// Attach new LinkLoad links created in the future.
}\
}
-#define CHECK_INIT\
- {\
- int init_flag=0;\
- PMPI_Initialized(&init_flag);\
- CHECK_ARGS((!init_flag), MPI_ERR_OTHER, "%s: MPI_Init was not called !", __func__)\
- PMPI_Finalized(&init_flag);\
- CHECK_ARGS((init_flag), MPI_ERR_OTHER, "%s: MPI_Finalize was already called !", __func__)\
+#define CHECK_INIT \
+ { \
+ int init_flag = 0; \
+ PMPI_Initialized(&init_flag); \
+ CHECK_ARGS(not init_flag, MPI_ERR_OTHER, "%s: MPI_Init was not called !", __func__) \
+ PMPI_Finalized(&init_flag); \
+ CHECK_ARGS(init_flag, MPI_ERR_OTHER, "%s: MPI_Finalize was already called !", __func__) \
}
#define CHECK_MPI_NULL(num, val, err, ptr)\
elem->refcount++;
int flag=0;
auto p = attributes()->insert({keyval, attr_value});
- if (!p.second) {
+ if (not p.second) {
int ret = call_deleter<T>((T*)this, elem, keyval,p.first->second,&flag);
// overwrite previous value
p.first->second = attr_value;
return ret;
}
}
- if (((*request)->flags_ & MPI_REQ_GENERALIZED) && !((*request)->flags_ & MPI_REQ_COMPLETE))
+ if (((*request)->flags_ & MPI_REQ_GENERALIZED) && not((*request)->flags_ & MPI_REQ_COMPLETE))
*flag=0;
if (*flag) {
finish_wait(request, status); // may invalidate *request
if (i != -1) { // -1 is not MPI_UNDEFINED but a SIMIX return code. (nothing matches)
*index = map[i];
- if (requests[*index] != MPI_REQUEST_NULL &&
- (requests[*index]->flags_ & MPI_REQ_GENERALIZED)
- && !(requests[*index]->flags_ & MPI_REQ_COMPLETE)) {
+ if (requests[*index] != MPI_REQUEST_NULL && (requests[*index]->flags_ & MPI_REQ_GENERALIZED) &&
+ not(requests[*index]->flags_ & MPI_REQ_COMPLETE)) {
*flag=0;
} else {
finish_wait(&requests[*index],status);
}
if ((*request)->flags_ & MPI_REQ_GENERALIZED) {
- if(!((*request)->flags_ & MPI_REQ_COMPLETE)){
+ if (not((*request)->flags_ & MPI_REQ_COMPLETE)) {
((*request)->generalized_funcs)->mutex->lock();
((*request)->generalized_funcs)->cond->wait(((*request)->generalized_funcs)->mutex);
((*request)->generalized_funcs)->mutex->unlock();
if(*flag)
return MPI_SUCCESS;
}
- if (req != MPI_REQUEST_NULL &&
- (req->flags_ & MPI_REQ_GENERALIZED)
- && !(req->flags_ & MPI_REQ_COMPLETE)) {
- *flag=0;
+ if (req != MPI_REQUEST_NULL && (req->flags_ & MPI_REQ_GENERALIZED) && not(req->flags_ & MPI_REQ_COMPLETE)) {
+ *flag = 0;
return MPI_SUCCESS;
}
int Request::grequest_complete(MPI_Request request)
{
- if ((!(request->flags_ & MPI_REQ_GENERALIZED)) || request->generalized_funcs->mutex == nullptr)
+ if ((not(request->flags_ & MPI_REQ_GENERALIZED)) || request->generalized_funcs->mutex == nullptr)
return MPI_ERR_REQUEST;
request->generalized_funcs->mutex->lock();
request->flags_ |= MPI_REQ_COMPLETE; // in case wait would be called after complete
// TI tracing uses states as events, and does not support printing events.
// So, we need a different code than for replay in order to be able to
// generate ti_traces for the migration calls.
- if (!TRACE_smpi_is_enabled()) {
+ if (not TRACE_smpi_is_enabled()) {
delete extra;
return;
}
}
bool NetworkWifiLink::toggle_decay_model(){
- use_decay_model_=!use_decay_model_;
+ use_decay_model_ = not use_decay_model_;
return use_decay_model_;
}
}
}
- if (!cat->additivity)
+ if (not cat->additivity)
break;
cat = cat->parent;
}
}
if (setting.appender) {
xbt_log_appender_set(category, setting.appender);
- if (!category->layout)
+ if (not category->layout)
xbt_log_layout_set(category, xbt_log_layout_simple_new(nullptr));
category->additivity = 0;
XBT_DEBUG("Set %p as appender of category '%s'", setting.appender, category->name);
category->appender = xbt_log_default_appender;
category->layout = xbt_log_default_layout;
} else {
- if (!category->parent)
+ if (not category->parent)
category->parent = &_XBT_LOGV(XBT_LOG_ROOT_CAT);
XBT_DEBUG("Set %s (%s) as father of %s ", category->parent->name,
parent->firstChild = cat;
- if (!parent->initialized)
+ if (not parent->initialized)
_xbt_log_cat_init(parent, xbt_log_priority_uninitialized /* ignored */ );
cat->threshold = parent->threshold;
const char *orig_control_string = control_string;
xbt_log_setting_t set;
- if (!*control_string)
+ if (not*control_string)
return set;
XBT_DEBUG("Parse log setting '%s'", control_string);
void xbt_log_control_set(const char *control_string)
{
- if (!control_string)
+ if (not control_string)
return;
XBT_DEBUG("Parse log settings '%s'", control_string);
void xbt_log_layout_set(xbt_log_category_t cat, xbt_log_layout_t lay)
{
DISABLE_XBT_LOG_CAT_INIT();
- if (!cat->appender) {
+ if (not cat->appender) {
XBT_VERB ("No appender to category %s. Setting the file appender as default", cat->name);
xbt_log_appender_set(cat, xbt_log_appender_file_new(nullptr));
}
static void xbt_log_help_categories_rec(xbt_log_category_t category, const std::string& prefix)
{
- if (!category)
+ if (not category)
return;
std::string this_prefix(prefix);
static void open_append2_file(xbt_log_append2_file_t data){
if(data->count<0) {
//Roll
- if (!data->file) {
+ if (not data->file) {
data->file= fopen(data->filename, "w");
xbt_assert(data->file != nullptr, "Cannot open file: %s: %s", data->filename, strerror(errno));
} else {
fclose(data->file);
char* pre=xbt_strdup(data->filename);
char* sep=strchr(pre,'%');
- if(!sep)
+ if (not sep)
sep=pre+strlen(pre);
const char* post = sep + 1;
*sep = '\0';
if (procname && strcmp(procname,"maestro")) {
len = snprintf(p, rem_size, "%s:%s:(%d) ", sg_host_self_get_name(), procname, xbt_getpid());
check_overflow(len);
- }
- else if (!procname) {
+ } else if (not procname) {
len = snprintf(p, rem_size, "%s::(%d) ", sg_host_self_get_name(), xbt_getpid());
check_overflow(len);
}
check_overflow(len);
/* Display file position if not INFO */
- if (ev->priority != xbt_log_priority_info && !xbt_log_no_loc) {
+ if (ev->priority != xbt_log_priority_info && not xbt_log_no_loc) {
len = snprintf(p, rem_size, "%s:%d: ", ev->fileName, ev->lineNum);
check_overflow(len);
}
"any. Please use xbt_replay_set_tracefile().");
while (true) {
simgrid::xbt::ReplayAction* evt = simgrid::xbt::get_action(actor_name);
- if (!evt)
+ if (not evt)
break;
simgrid::xbt::handle_action(*evt);
delete evt;
double end = simgrid::s4u::Engine::get_clock();
if (0.1 - (end - begin) > 0.001) {
- xbt_assert(!FAIL_ON_ERROR, "%s with %.4g load (%dflops) took %.4fs instead of 0.1s",
+ xbt_assert(not FAIL_ON_ERROR, "%s with %.4g load (%dflops) took %.4fs instead of 0.1s",
simgrid::s4u::this_actor::get_name().c_str(), ((double)size / flop_amount), size, (end - begin));
XBT_INFO("FAILED TEST: %s with %.4g load (%dflops) took %.4fs instead of 0.1s",
simgrid::s4u::this_actor::get_name().c_str(), ((double)size / flop_amount), size, (end - begin));
double new_energy = 0;
for (simgrid::s4u::Host* pm : simgrid::s4u::Engine::get_instance()->get_all_hosts()) {
- if (!dynamic_cast<simgrid::s4u::VirtualMachine*>(pm))
+ if (not dynamic_cast<simgrid::s4u::VirtualMachine*>(pm))
new_energy += sg_host_get_consumed_energy(pm);
}
simgrid::s4u::Actor::create("receiver", simgrid::s4u::Host::by_name(dest),
[mailbox]() { mailbox->get<std::string>(); });
auto* l = (simgrid::kernel::resource::NetworkWifiLink*)simgrid::s4u::Link::by_name("AP1")->get_impl();
- if (!l->toggle_decay_model())
+ if (not l->toggle_decay_model())
l->toggle_decay_model();
l->set_host_rate(simgrid::s4u::Host::by_name("Station 1"), 0);
l->set_host_rate(simgrid::s4u::Host::by_name("Station 2"), 0);
std::vector<sg4::Host*> hosts = e.get_all_hosts();
if (argc >= 3) {
- if (!strcmp(argv[2], "ONE_LINK"))
+ if (strcmp(argv[2], "ONE_LINK") == 0)
test_one_link(hosts);
- if (!strcmp(argv[2], "FULL_LINK"))
+ if (strcmp(argv[2], "FULL_LINK") == 0)
test_full_link(hosts);
- if (!strcmp(argv[2], "PROP"))
+ if (strcmp(argv[2], "PROP") == 0)
XBT_INFO("SG_TEST_mem: %s", sg4::Host::by_name("host1")->get_property("SG_TEST_mem"));
}
XBT_INFO("All comms have started");
std::vector<simgrid::s4u::CommPtr> comms = {put1, put2, get1, get2};
- while (!comms.empty()) {
+ while (not comms.empty()) {
int index = simgrid::s4u::Comm::wait_any_for(&comms, 0.5);
if (index < 0)
XBT_INFO("wait_any_for: Timeout reached");