deprecate the MSG and SimDag APIs. Everything that you can do in
SimGrid will be possible in S4U.
-@warning <b>S4U is not ready for public use yet</b>. You should not go
- that path unless you know what you are doing. If unsure,
- proceed to @ref MSG_API instead.
+@warning <b>S4U is not as rock stable as the rest of SimGrid yet</b>.
+ You are really welcome to test it, but be warned that the API
+ may change without notice between releases. This is however
+ the way to go if you want to create a new long-term project.
+ If you want to play safe, proceed to @ref MSG_API instead.
Unsurprisingly, the S4U interface matches the concepts presented in
@ref starting_components "the introduction". You should read this page
\subsubsection options_model_network_gamma Maximal TCP window size
The analytical models need to know the maximal TCP window size to take
-the TCP congestion mechanism into account. This is set to 20000 by
+the TCP congestion mechanism into account. This is set to 4194304 by
default, but can be changed using the \b network/TCP-gamma item.
On linux, this value can be retrieved using the following
S4U (Simgrid for you) is the next interface of SimGrid, expected to be released with SimGrid 4.0.
-Even if it's in a very preliminary state so far, you are welcome to
-try it and report any interface glitches that you see. Be however
-warned that the interface will be modified until its final release.
-You will have to adapt your code on the way.
+Even if it is not completely rock stable yet, it may well already fit
+your needs. You are welcome to try it and report any interface
+glitches that you see. Be however warned that the interface may change
+until its final release. You will have to adapt your code on the way.
This file follows the Doxygen syntax to be included in the
documentation, but it should remain readable directly.
void Tracker::operator()()
{
simgrid::s4u::CommPtr comm = nullptr;
+ void* received;
while (simgrid::s4u::Engine::getClock() < deadline) {
- void* received;
if (comm == nullptr)
comm = mailbox->get_async(&received);
if (comm->test()) {
-/* Copyright (c) 2010-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
try {
comm->wait(timeout);
XBT_DEBUG("Received the answer to my 'Predecessor Alive': my predecessor %d is alive", pred_id_);
+ delete static_cast<ChordMessage*>(data);
} catch (xbt_ex& e) {
if (e.category == timeout_error) {
XBT_DEBUG("Failed to receive the answer to my 'Predecessor Alive' request");
pred_id_ = -1;
}
}
- delete message;
}
/* Asks its predecessor to a remote node
AttachNode(dg,nd);
}
totComparators=0;
- numPrevLayerNodes=numLayerNodes;
while(numLayerNodes>maxInDeg){
numLayerNodes=numLayerNodes/maxInDeg;
if(numLayerNodes*maxInDeg<numPrevLayerNodes)
}
if(rmsm1<rms0) k=-1;
if(k==0){
- j=i+fielddim;
a->val[i]=weight*b->val[i];
a->val[i+1]=weight*b->val[i+1];
a->val[i+2]=weight*b->val[i+2];
dg=buildBH(class);
}else if(strncmp(argv[3],"WH",2)==0){
dg=buildWH(class);
- }else if(strncmp(argv[3],"SH",2)==0){
+ }else /* (strncmp(argv[3],"SH",2)==0) */ {
dg=buildSH(class);
}
if(my_rank==0)
fprintf(stderr,"Not enough timers. Node timeing is off. \n");
}
- if(dg->numNodes>comm_size){
+ if(dg->numNodes && dg->numNodes>comm_size){
if(my_rank==0){
fprintf(stderr,"** The number of MPI processes should not be less than \n");
fprintf(stderr,"** the number of nodes in the graph\n");
fprintf(stdout," Number of random numbers generated: %s\n",size);
fprintf(stdout," Number of active processes: %d\n",no_nodes);
}
- verified = FALSE;
/* Compute the number of "batches" of random number pairs generated per processor. Adjust if the number of processors
* does not evenly divide the total number */
for (i=0;i<2*nk;i++) {
x[i] = -1e99;
}
- Mops = log(sqrt(abs(1)));
/* Synchronize before placing time stamp */
MPI_Barrier( MPI_COMM_WORLD );
for (i=1;i<=100 && !stop;i++) {
ik = kk / 2;
if (2 * ik != kk) {
- t3 = randlc(&t1, &t2);
+ randlc(&t1, &t2);
}
if (ik==0)
stop = TRUE;
else {
- t3 = randlc(&t2, &t2);
+ randlc(&t2, &t2);
kk = ik;
}
}
double a ) /* Ran num gen mult, try 1220703125.00 */
{
long i;
- double t1,t2,t3,an;
+ double t1,t2,an;
long mq,nq,kk,ik;
nq = nn / np;
for( i=1; i<=100; i++ ){
ik = kk / 2;
if( 2 * ik != kk )
- t3 = randlc( &t1, &t2 );
+ randlc( &t1, &t2 );
if( ik == 0 )
break;
- t3 = randlc( &t2, &t2 );
+ randlc( &t2, &t2 );
kk = ik;
}
- an=t3;//added to silence paranoid compilers
return t1;
}
-/* Copyright (c) 2005-2015. The SimGrid Team.
+/* Copyright (c) 2005-2017. The SimGrid Team.
* All rights reserved. */
/* Copyright (c) 2002-2004 Ralf S. Engelschall <rse@engelschall.com> */
simgrid::xbt::WithContextException(throwpoint, simgrid::xbt::backtrace())
{}
- ~xbt_ex() = default;
+ ~xbt_ex();
/** Category (what went wrong) */
xbt_errcat_t category = unknown_error;
typedef simgrid::surf::Model surf_Model;
typedef simgrid::surf::CpuModel surf_CpuModel;
-typedef simgrid::surf::Cpu surf_Cpu;
typedef simgrid::surf::HostModel surf_HostModel;
typedef simgrid::surf::NetworkModel surf_NetworkModel;
typedef simgrid::surf::StorageModel surf_StorageModel;
typedef struct surf_Model surf_Model;
typedef struct surf_CpuModel surf_CpuModel;
-typedef struct surf_Cpu surf_Cpu;
typedef struct surf_HostModel surf_HostModel;
typedef struct surf_NetworkModel surf_NetworkModel;
typedef struct surf_StorageModel surf_StorageModel;
typedef struct surf_Resource surf_Resource;
-typedef struct surf_Host surf_Host;
typedef struct surf_Action surf_Action;
#endif
*/
virtual void worker_wait(unsigned) = 0;
- protected:
Parmap<T>& parmap;
};
*/
template <typename T> boost::optional<T> Parmap<T>::next()
{
- unsigned index = this->index++;
+ unsigned index = this->index.fetch_add(1, std::memory_order_relaxed);
if (index < this->data->size())
return (*this->data)[index];
else
*/
template <typename T> void Parmap<T>::work()
{
- unsigned index = this->index++;
unsigned length = this->data->size();
+ unsigned index = this->index.fetch_add(1, std::memory_order_relaxed);
while (index < length) {
this->fun((*this->data)[index]);
- index = this->index++;
+ index = this->index.fetch_add(1, std::memory_order_relaxed);
}
}
static bool trace_configured = false;
static bool trace_active = false;
-static type_t rootType = nullptr; /* the root type */
+static simgrid::instr::Type* rootType = nullptr; /* the root type */
instr_fmt_type_t instr_fmt_type = instr_fmt_paje;
}
XBT_DEBUG("MARK,declare %s", mark_type);
- PJ_type_event_new(mark_type, PJ_type_get_root());
+ simgrid::instr::Type::eventNew(mark_type, PJ_type_get_root());
declared_marks.insert(mark_type);
}
if (not mark_value)
THROWF (tracing_error, 1, "mark_value is nullptr");
- type_t type = PJ_type_get (mark_type, PJ_type_get_root());
+ simgrid::instr::Type* type = PJ_type_get(mark_type, PJ_type_get_root());
if (not type) {
THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
}
mark_color = white;
XBT_DEBUG("MARK,declare_value %s %s %s", mark_type, mark_value, mark_color);
- value rett(mark_value, mark_color, type);
+ simgrid::instr::Value rett(mark_value, mark_color, type);
}
/** \ingroup TRACE_mark
THROWF (tracing_error, 1, "mark_value is nullptr");
//check if mark_type is already declared
- type_t type = PJ_type_get (mark_type, PJ_type_get_root());
+ simgrid::instr::Type* type = PJ_type_get(mark_type, PJ_type_get_root());
if (not type) {
THROWF (tracing_error, 1, "mark_type with name (%s) is not declared", mark_type);
}
XBT_DEBUG("MARK %s %s", mark_type, mark_value);
- new NewEvent(MSG_get_clock(), PJ_container_get_root(), type, value::get(mark_value, type));
+ new simgrid::instr::NewEvent(MSG_get_clock(), PJ_container_get_root(), type,
+ simgrid::instr::Value::get(mark_value, type));
}
/** \ingroup TRACE_mark
char valuestr[100];
snprintf(valuestr, 100, "%g", value);
container_t container = PJ_container_get(resource);
- type_t type = PJ_type_get (variable, container->type);
+ simgrid::instr::Type* type = PJ_type_get(variable, container->type_);
switch (what){
case INSTR_US_SET:
- new SetVariableEvent(time, container, type, value);
+ new simgrid::instr::SetVariableEvent(time, container, type, value);
break;
case INSTR_US_ADD:
- new AddVariableEvent(time, container, type, value);
+ new simgrid::instr::AddVariableEvent(time, container, type, value);
break;
case INSTR_US_SUB:
- new SubVariableEvent(time, container, type, value);
+ new simgrid::instr::SubVariableEvent(time, container, type, value);
break;
default:
THROW_IMPOSSIBLE;
void TRACE_host_set_state(const char* host, const char* state, const char* value_str)
{
container_t container = PJ_container_get(host);
- type_t type = PJ_type_get (state, container->type);
- value* val =
- value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
- new SetStateEvent(MSG_get_clock(), container, type, val);
+ simgrid::instr::Type* type = PJ_type_get(state, container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new(
+ value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+ new simgrid::instr::SetStateEvent(MSG_get_clock(), container, type, val);
}
/** \ingroup TRACE_user_variables
void TRACE_host_push_state(const char* host, const char* state, const char* value_str)
{
container_t container = PJ_container_get(host);
- type_t type = PJ_type_get (state, container->type);
- value* val =
- value::get_or_new(value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
- new PushStateEvent(MSG_get_clock(), container, type, val);
+ simgrid::instr::Type* type = PJ_type_get(state, container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new(
+ value_str, nullptr, type); /* if user didn't declare a value with a color, use nullptr color */
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), container, type, val);
}
/** \ingroup TRACE_user_variables
void TRACE_host_pop_state (const char *host, const char *state)
{
container_t container = PJ_container_get(host);
- type_t type = PJ_type_get (state, container->type);
- new PopStateEvent(MSG_get_clock(), container, type);
+ simgrid::instr::Type* type = PJ_type_get(state, container->type_);
+ new simgrid::instr::PopStateEvent(MSG_get_clock(), container, type);
}
/** \ingroup TRACE_API
rootContainer = root;
}
-container_t PJ_container_new (const char *name, e_container_types kind, container_t father)
+simgrid::instr::Container::Container(const char* name, simgrid::instr::e_container_types kind, Container* father)
+ : name_(xbt_strdup(name)), father_(father)
{
- if (name == nullptr){
- THROWF (tracing_error, 0, "can't create a container with a nullptr name");
- }
+ xbt_assert(name != nullptr, "Container name cannot be nullptr");
static long long int container_id = 0;
- char id_str[INSTR_DEFAULT_STR_SIZE];
- snprintf (id_str, INSTR_DEFAULT_STR_SIZE, "%lld", container_id);
+ id_ = bprintf("%lld", container_id); // id (or alias) of the container
container_id++;
- container_t newContainer = xbt_new0(s_container, 1);
- newContainer->name = xbt_strdup (name); // name of the container
- newContainer->id = xbt_strdup (id_str); // id (or alias) of the container
- newContainer->father = father;
- sg_host_t sg_host = sg_host_by_name(name);
-
//Search for network_element_t
switch (kind){
- case INSTR_HOST:
- newContainer->netpoint = sg_host->pimpl_netpoint;
- xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
+ case simgrid::instr::INSTR_HOST:
+ this->netpoint_ = sg_host_by_name(name)->pimpl_netpoint;
+ xbt_assert(this->netpoint_, "Element '%s' not found", name);
break;
- case INSTR_ROUTER:
- newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
- xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
+ case simgrid::instr::INSTR_ROUTER:
+ this->netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ xbt_assert(this->netpoint_, "Element '%s' not found", name);
break;
- case INSTR_AS:
- newContainer->netpoint = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
- xbt_assert(newContainer->netpoint, "Element '%s' not found", name);
+ case simgrid::instr::INSTR_AS:
+ this->netpoint_ = simgrid::s4u::Engine::getInstance()->getNetpointByNameOrNull(name);
+ xbt_assert(this->netpoint_, "Element '%s' not found", name);
break;
default:
- newContainer->netpoint = nullptr;
+ this->netpoint_ = nullptr;
break;
}
- // level depends on level of father
- if (newContainer->father){
- newContainer->level = newContainer->father->level+1;
- XBT_DEBUG("new container %s, child of %s", name, father->name);
- }else{
- newContainer->level = 0;
+ if (father_) {
+ this->level_ = father_->level_ + 1;
+ XBT_DEBUG("new container %s, child of %s", name, father->name_);
}
+
// type definition (method depends on kind of this new container)
- newContainer->kind = kind;
- if (newContainer->kind == INSTR_AS){
+ this->kind_ = kind;
+ if (this->kind_ == simgrid::instr::INSTR_AS) {
//if this container is of an AS, its type name depends on its level
char as_typename[INSTR_DEFAULT_STR_SIZE];
- snprintf (as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", newContainer->level);
- if (newContainer->father){
- newContainer->type = PJ_type_get_or_null (as_typename, newContainer->father->type);
- if (newContainer->type == nullptr){
- newContainer->type = PJ_type_container_new (as_typename, newContainer->father->type);
+ snprintf(as_typename, INSTR_DEFAULT_STR_SIZE, "L%d", this->level_);
+ if (this->father_) {
+ this->type_ = simgrid::instr::Type::getOrNull(as_typename, this->father_->type_);
+ if (this->type_ == nullptr) {
+ this->type_ = simgrid::instr::Type::containerNew(as_typename, this->father_->type_);
}
}else{
- newContainer->type = PJ_type_container_new ("0", nullptr);
+ this->type_ = simgrid::instr::Type::containerNew("0", nullptr);
}
}else{
//otherwise, the name is its kind
char typeNameBuff[INSTR_DEFAULT_STR_SIZE];
- switch (newContainer->kind){
- case INSTR_HOST:
+ switch (this->kind_) {
+ case simgrid::instr::INSTR_HOST:
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "HOST");
break;
- case INSTR_LINK:
+ case simgrid::instr::INSTR_LINK:
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "LINK");
break;
- case INSTR_ROUTER:
+ case simgrid::instr::INSTR_ROUTER:
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "ROUTER");
break;
- case INSTR_SMPI:
+ case simgrid::instr::INSTR_SMPI:
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MPI");
break;
- case INSTR_MSG_PROCESS:
+ case simgrid::instr::INSTR_MSG_PROCESS:
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_PROCESS");
break;
- case INSTR_MSG_VM:
+ case simgrid::instr::INSTR_MSG_VM:
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_VM");
break;
- case INSTR_MSG_TASK:
+ case simgrid::instr::INSTR_MSG_TASK:
snprintf (typeNameBuff, INSTR_DEFAULT_STR_SIZE, "MSG_TASK");
break;
default:
THROWF (tracing_error, 0, "new container kind is unknown.");
break;
}
- type_t type = PJ_type_get_or_null (typeNameBuff, newContainer->father->type);
+ simgrid::instr::Type* type = simgrid::instr::Type::getOrNull(typeNameBuff, this->father_->type_);
if (type == nullptr){
- newContainer->type = PJ_type_container_new (typeNameBuff, newContainer->father->type);
+ this->type_ = simgrid::instr::Type::containerNew(typeNameBuff, this->father_->type_);
}else{
- newContainer->type = type;
+ this->type_ = type;
}
}
- newContainer->children = xbt_dict_new_homogeneous(nullptr);
- if (newContainer->father){
- xbt_dict_set(newContainer->father->children, newContainer->name, newContainer, nullptr);
- LogContainerCreation(newContainer);
+ this->children_ = xbt_dict_new_homogeneous(nullptr);
+ if (this->father_) {
+ xbt_dict_set(this->father_->children_, this->name_, this, nullptr);
+ LogContainerCreation(this);
}
//register all kinds by name
- if (xbt_dict_get_or_null(allContainers, newContainer->name) != nullptr){
- THROWF(tracing_error, 1, "container %s already present in allContainers data structure", newContainer->name);
+ if (xbt_dict_get_or_null(allContainers, this->name_) != nullptr) {
+ THROWF(tracing_error, 1, "container %s already present in allContainers data structure", this->name_);
}
- xbt_dict_set (allContainers, newContainer->name, newContainer, nullptr);
- XBT_DEBUG("Add container name '%s'",newContainer->name);
+ xbt_dict_set(allContainers, this->name_, this, nullptr);
+ XBT_DEBUG("Add container name '%s'", this->name_);
//register NODE types for triva configuration
- if (newContainer->kind == INSTR_HOST || newContainer->kind == INSTR_LINK || newContainer->kind == INSTR_ROUTER) {
- trivaNodeTypes.insert(newContainer->type->name);
+ if (this->kind_ == simgrid::instr::INSTR_HOST || this->kind_ == simgrid::instr::INSTR_LINK ||
+ this->kind_ == simgrid::instr::INSTR_ROUTER) {
+ trivaNodeTypes.insert(this->type_->name_);
}
- return newContainer;
+}
+simgrid::instr::Container::~Container()
+{
+ XBT_DEBUG("destroy container %s", name_);
+
+ // obligation to dump previous events because they might
+ // reference the container that is about to be destroyed
+ TRACE_last_timestamp_to_dump = surf_get_clock();
+ TRACE_paje_dump_buffer(1);
+
+ // trace my destruction
+ if (not TRACE_disable_destroy() && this != PJ_container_get_root()) {
+ // do not trace the container destruction if user requests
+ // or if the container is root
+ LogContainerDestruction(this);
+ }
+
+ // remove it from allContainers data structure
+ xbt_dict_remove(allContainers, name_);
+
+ // free
+ xbt_free(name_);
+ xbt_free(id_);
+ xbt_dict_free(&children_);
}
container_t PJ_container_get (const char *name)
THROWF (tracing_error, 0, "can't remove from parent with a nullptr child");
}
- container_t parent = child->father;
+ container_t parent = child->father_;
if (parent){
- XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ",
- child->name,
- parent->name);
- xbt_dict_remove (parent->children, child->name);
+ XBT_DEBUG("removeChildContainer (%s) FromContainer (%s) ", child->name_, parent->name_);
+ xbt_dict_remove(parent->children_, child->name_);
}
}
-void PJ_container_free (container_t container)
-{
- if (container == nullptr){
- THROWF (tracing_error, 0, "trying to free a nullptr container");
- }
- XBT_DEBUG("destroy container %s", container->name);
-
- //obligation to dump previous events because they might
- //reference the container that is about to be destroyed
- TRACE_last_timestamp_to_dump = surf_get_clock();
- TRACE_paje_dump_buffer(1);
-
- //trace my destruction
- if (not TRACE_disable_destroy() && container != PJ_container_get_root()) {
- //do not trace the container destruction if user requests
- //or if the container is root
- LogContainerDestruction(container);
- }
-
- //remove it from allContainers data structure
- xbt_dict_remove (allContainers, container->name);
-
- //free
- xbt_free (container->name);
- xbt_free (container->id);
- xbt_dict_free (&container->children);
- xbt_free (container);
- container = nullptr;
-}
-
static void recursiveDestroyContainer (container_t container)
{
if (container == nullptr){
THROWF (tracing_error, 0, "trying to recursively destroy a nullptr container");
}
- XBT_DEBUG("recursiveDestroyContainer %s", container->name);
+ XBT_DEBUG("recursiveDestroyContainer %s", container->name_);
xbt_dict_cursor_t cursor = nullptr;
container_t child;
char *child_name;
- xbt_dict_foreach(container->children, cursor, child_name, child) {
+ xbt_dict_foreach (container->children_, cursor, child_name, child) {
recursiveDestroyContainer (child);
}
- PJ_container_free (container);
+ delete container;
}
void PJ_container_free_all ()
static void TRACE_header_PajeDefineContainerType (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeDefineContainerType %d\n", PAJE_DefineContainerType);
+ fprintf(tracing_file, "%%EventDef PajeDefineContainerType %d\n", simgrid::instr::PAJE_DefineContainerType);
fprintf(tracing_file, "%% Alias string\n");
if (basic){
fprintf(tracing_file, "%% ContainerType string\n");
static void TRACE_header_PajeDefineVariableType (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeDefineVariableType %d\n", PAJE_DefineVariableType);
+ fprintf(tracing_file, "%%EventDef PajeDefineVariableType %d\n", simgrid::instr::PAJE_DefineVariableType);
fprintf(tracing_file, "%% Alias string\n");
if (basic){
fprintf(tracing_file, "%% ContainerType string\n");
static void TRACE_header_PajeDefineStateType (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeDefineStateType %d\n", PAJE_DefineStateType);
+ fprintf(tracing_file, "%%EventDef PajeDefineStateType %d\n", simgrid::instr::PAJE_DefineStateType);
fprintf(tracing_file, "%% Alias string\n");
if (basic){
fprintf(tracing_file, "%% ContainerType string\n");
static void TRACE_header_PajeDefineEventType (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeDefineEventType %d\n", PAJE_DefineEventType);
+ fprintf(tracing_file, "%%EventDef PajeDefineEventType %d\n", simgrid::instr::PAJE_DefineEventType);
fprintf(tracing_file, "%% Alias string\n");
if (basic){
fprintf(tracing_file, "%% ContainerType string\n");
static void TRACE_header_PajeDefineLinkType (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeDefineLinkType %d\n", PAJE_DefineLinkType);
+ fprintf(tracing_file, "%%EventDef PajeDefineLinkType %d\n", simgrid::instr::PAJE_DefineLinkType);
fprintf(tracing_file, "%% Alias string\n");
if (basic){
fprintf(tracing_file, "%% ContainerType string\n");
static void TRACE_header_PajeDefineEntityValue (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeDefineEntityValue %d\n", PAJE_DefineEntityValue);
+ fprintf(tracing_file, "%%EventDef PajeDefineEntityValue %d\n", simgrid::instr::PAJE_DefineEntityValue);
fprintf(tracing_file, "%% Alias string\n");
if (basic){
fprintf(tracing_file, "%% EntityType string\n");
static void TRACE_header_PajeCreateContainer (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeCreateContainer %d\n", PAJE_CreateContainer);
+ fprintf(tracing_file, "%%EventDef PajeCreateContainer %d\n", simgrid::instr::PAJE_CreateContainer);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Alias string\n");
fprintf(tracing_file, "%% Type string\n");
static void TRACE_header_PajeDestroyContainer (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeDestroyContainer %d\n", PAJE_DestroyContainer);
+ fprintf(tracing_file, "%%EventDef PajeDestroyContainer %d\n", simgrid::instr::PAJE_DestroyContainer);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Name string\n");
static void TRACE_header_PajeSetVariable (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeSetVariable %d\n", PAJE_SetVariable);
+ fprintf(tracing_file, "%%EventDef PajeSetVariable %d\n", simgrid::instr::PAJE_SetVariable);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajeAddVariable (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeAddVariable %d\n", PAJE_AddVariable);
+ fprintf(tracing_file, "%%EventDef PajeAddVariable %d\n", simgrid::instr::PAJE_AddVariable);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajeSubVariable (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeSubVariable %d\n", PAJE_SubVariable);
+ fprintf(tracing_file, "%%EventDef PajeSubVariable %d\n", simgrid::instr::PAJE_SubVariable);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajeSetState (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeSetState %d\n", PAJE_SetState);
+ fprintf(tracing_file, "%%EventDef PajeSetState %d\n", simgrid::instr::PAJE_SetState);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajePushState (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajePushState %d\n", PAJE_PushState);
+ fprintf(tracing_file, "%%EventDef PajePushState %d\n", simgrid::instr::PAJE_PushState);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajePopState (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajePopState %d\n", PAJE_PopState);
+ fprintf(tracing_file, "%%EventDef PajePopState %d\n", simgrid::instr::PAJE_PopState);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
{
if (basic) return;
- fprintf(tracing_file, "%%EventDef PajeResetState %d\n", PAJE_ResetState);
+ fprintf(tracing_file, "%%EventDef PajeResetState %d\n", simgrid::instr::PAJE_ResetState);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajeStartLink (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", PAJE_StartLink);
+ fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", simgrid::instr::PAJE_StartLink);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajeEndLink (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", PAJE_EndLink);
+ fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", simgrid::instr::PAJE_EndLink);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static void TRACE_header_PajeNewEvent (int basic, int size)
{
- fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", PAJE_NewEvent);
+ fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", simgrid::instr::PAJE_NewEvent);
fprintf(tracing_file, "%% Time date\n");
fprintf(tracing_file, "%% Type string\n");
fprintf(tracing_file, "%% Container string\n");
static xbt_dict_t tracing_files = nullptr; // TI specific
static double prefix=0.0; // TI specific
-std::vector<PajeEvent*> buffer;
-void buffer_debug(std::vector<PajeEvent*> *buf);
+std::vector<simgrid::instr::PajeEvent*> buffer;
+void buffer_debug(std::vector<simgrid::instr::PajeEvent*>* buf);
void dump_comment (const char *comment)
{
}
buffer.clear();
}else{
- std::vector<PajeEvent*>::iterator i = buffer.begin();
+ std::vector<simgrid::instr::PajeEvent*>::iterator i = buffer.begin();
for (auto const& event : buffer) {
- double head_timestamp = event->timestamp;
+ double head_timestamp = event->timestamp_;
if (head_timestamp > TRACE_last_timestamp_to_dump)
break;
event->print();
XBT_DEBUG("%s: ends", __FUNCTION__);
}
-void buffer_debug(std::vector<PajeEvent*> *buf);
-void buffer_debug(std::vector<PajeEvent*> *buf) {
+void buffer_debug(std::vector<simgrid::instr::PajeEvent*>* buf);
+void buffer_debug(std::vector<simgrid::instr::PajeEvent*>* buf)
+{
return;
XBT_DEBUG(">>>>>> Dump the state of the buffer. %zu events", buf->size());
for (auto const& event : *buf) {
stream.clear();
}
-static void print_timestamp(PajeEvent* event) {
+static void print_timestamp(simgrid::instr::PajeEvent* event)
+{
stream << " ";
/* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */
- if (event->timestamp < 1e-12)
+ if (event->timestamp_ < 1e-12)
stream << 0;
else
- stream << event->timestamp;
+ stream << event->timestamp_;
}
/* internal do the instrumentation module */
-static void insert_into_buffer (PajeEvent* tbi)
+static void insert_into_buffer(simgrid::instr::PajeEvent* tbi)
{
if (TRACE_buffer() == 0){
tbi->print ();
}
buffer_debug(&buffer);
- XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%zu)",
- __FUNCTION__, (int)tbi->event_type, tbi->timestamp, buffer.size());
- std::vector<PajeEvent*>::reverse_iterator i;
+ XBT_DEBUG("%s: insert event_type=%d, timestamp=%f, buffersize=%zu)", __FUNCTION__, (int)tbi->eventType_,
+ tbi->timestamp_, buffer.size());
+ std::vector<simgrid::instr::PajeEvent*>::reverse_iterator i;
for (i = buffer.rbegin(); i != buffer.rend(); ++i) {
- PajeEvent* e1 = *i;
- XBT_DEBUG("compare to %p is of type %d; timestamp:%f", e1,
- (int)e1->event_type, e1->timestamp);
- if (e1->timestamp <= tbi->timestamp)
+ simgrid::instr::PajeEvent* e1 = *i;
+ XBT_DEBUG("compare to %p is of type %d; timestamp:%f", e1, (int)e1->eventType_, e1->timestamp_);
+ if (e1->timestamp_ <= tbi->timestamp_)
break;
}
if (i == buffer.rend())
buffer_debug(&buffer);
}
-PajeEvent:: ~PajeEvent()
+simgrid::instr::PajeEvent::~PajeEvent()
{
- XBT_DEBUG("%s not implemented for %p: event_type=%d, timestamp=%f", __FUNCTION__,
- this, (int)event_type, timestamp);
+ XBT_DEBUG("%s not implemented for %p: event_type=%d, timestamp=%f", __FUNCTION__, this, (int)eventType_, timestamp_);
}
void TRACE_paje_start() {
XBT_DEBUG("Filename %s is closed", filename);
}
-void DefineContainerEvent(type_t type)
+void LogContainerTypeDefinition(simgrid::instr::Type* type)
{
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineContainerType);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineContainerType);
//print it
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineContainerType, TRACE_precision(), 0.);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineContainerType,
+ TRACE_precision(), 0.);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_DefineContainerType;
- stream << " " << type->id << " " << type->father->id << " " << type->name;
+ stream << simgrid::instr::PAJE_DefineContainerType;
+ stream << " " << type->id_ << " " << type->father_->id_ << " " << type->name_;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
//--
}
-
-
-void LogVariableTypeDefinition(type_t type)
+void LogVariableTypeDefinition(simgrid::instr::Type* type)
{
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineVariableType);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineVariableType);
//print it
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineVariableType, TRACE_precision(), 0.);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_DefineVariableType;
- stream << " " << type->id << " " << type->father->id << " " << type->name;
- if (type->color)
- stream << " \"" << type->color << "\"";
- print_row();
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineVariableType,
+ TRACE_precision(), 0.);
+ stream << std::fixed << std::setprecision(TRACE_precision());
+ stream << simgrid::instr::PAJE_DefineVariableType;
+ stream << " " << type->id_ << " " << type->father_->id_ << " " << type->name_;
+ if (type->color_)
+ stream << " \"" << type->color_ << "\"";
+ print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
} else {
}
}
-
-void LogStateTypeDefinition(type_t type)
+void LogStateTypeDefinition(simgrid::instr::Type* type)
{
//print it
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineStateType, TRACE_precision(), 0.);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_DefineStateType;
- stream << " " << type->id << " " << type->father->id << " " << type->name;
- print_row();
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineStateType, TRACE_precision(),
+ 0.);
+ stream << std::fixed << std::setprecision(TRACE_precision());
+ stream << simgrid::instr::PAJE_DefineStateType;
+ stream << " " << type->id_ << " " << type->father_->id_ << " " << type->name_;
+ print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
} else {
}
}
-
-void LogDefineEventType(type_t type)
+void LogDefineEventType(simgrid::instr::Type* type)
{
//print it
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineEventType, TRACE_precision(), 0.);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineEventType,
+ TRACE_precision(), 0.);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_DefineEventType;
- stream << " " << type->id << " " << type->father->id << " " << type->name;
+ stream << simgrid::instr::PAJE_DefineEventType;
+ stream << " " << type->id_ << " " << type->father_->id_ << " " << type->name_;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-void LogLinkTypeDefinition(type_t type, type_t source, type_t dest)
+void LogLinkTypeDefinition(simgrid::instr::Type* type, simgrid::instr::Type* source, simgrid::instr::Type* dest)
{
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineLinkType);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineLinkType);
//print it
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, PAJE_DefineLinkType, TRACE_precision(), 0.);
- stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_DefineLinkType;
- stream << " " << type->id << " " << type->father->id << " " << source->id << " " << dest->id << " " << type->name;
- print_row();
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, simgrid::instr::PAJE_DefineLinkType, TRACE_precision(),
+ 0.);
+ stream << std::fixed << std::setprecision(TRACE_precision());
+ stream << simgrid::instr::PAJE_DefineLinkType;
+ stream << " " << type->id_ << " " << type->father_->id_ << " " << source->id_ << " " << dest->id_ << " "
+ << type->name_;
+ print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
} else {
}
}
-void LogEntityValue(value* val)
+void LogEntityValue(simgrid::instr::Value* val)
{
- XBT_DEBUG("%s: event_type=%d", __FUNCTION__, PAJE_DefineEntityValue);
+ XBT_DEBUG("%s: event_type=%d", __FUNCTION__, simgrid::instr::PAJE_DefineEntityValue);
//print it
if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_DefineEntityValue;
- stream << " " << val->id << " " << val->father->id << " " << val->name;
- if (val->color)
- stream << " \"" << val->color << "\"";
+ stream << simgrid::instr::PAJE_DefineEntityValue;
+ stream << " " << val->id_ << " " << val->father_->id_ << " " << val->name_;
+ if (val->color_)
+ stream << " \"" << val->color_ << "\"";
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
void LogContainerCreation (container_t container)
{
- double timestamp = SIMIX_get_clock();
+ double timestamp = SIMIX_get_clock();
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_CreateContainer,timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, simgrid::instr::PAJE_CreateContainer, timestamp);
-if (instr_fmt_type == instr_fmt_paje) {
+ if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_CreateContainer;
+ stream << simgrid::instr::PAJE_CreateContainer;
stream << " ";
/* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */
if (timestamp < 1e-12)
stream << 0;
else
stream << timestamp;
- stream << " " << container->id << " " << container->type->id << " " << container->father->id << " \""
- << container->name << "\"";
+ stream << " " << container->id_ << " " << container->type_->id_ << " " << container->father_->id_ << " \""
+ << container->name_ << "\"";
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || ti_unique_file == nullptr) {
char* folder_name = bprintf("%s_files", TRACE_get_filename());
- char* filename = bprintf("%s/%f_%s.txt", folder_name, prefix, container->name);
+ char* filename = bprintf("%s/%f_%s.txt", folder_name, prefix, container->name_);
#ifdef WIN32
_mkdir(folder_name);
#else
xbt_free(filename);
}
- xbt_dict_set(tracing_files, container->name, (void*)ti_unique_file, nullptr);
+ xbt_dict_set(tracing_files, container->name_, (void*)ti_unique_file, nullptr);
} else {
THROW_IMPOSSIBLE;
}
{
double timestamp = SIMIX_get_clock();
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, PAJE_DestroyContainer, timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, simgrid::instr::PAJE_DestroyContainer, timestamp);
-if (instr_fmt_type == instr_fmt_paje) {
+ if (instr_fmt_type == instr_fmt_paje) {
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << PAJE_DestroyContainer;
+ stream << simgrid::instr::PAJE_DestroyContainer;
stream << " ";
/* prevent 0.0000 in the trace - this was the behavior before the transition to c++ */
if (timestamp < 1e-12)
stream << 0;
else
stream << timestamp;
- stream << " " << container->type->id << " " << container->id;
+ stream << " " << container->type_->id_ << " " << container->id_;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
if (not xbt_cfg_get_boolean("tracing/smpi/format/ti-one-file") || xbt_dict_length(tracing_files) == 1) {
- FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, container->name);
+ FILE* f = (FILE*)xbt_dict_get_or_null(tracing_files, container->name_);
fclose(f);
}
- xbt_dict_remove(tracing_files, container->name);
+ xbt_dict_remove(tracing_files, container->name_);
} else {
THROW_IMPOSSIBLE;
}
}
-
-SetVariableEvent::SetVariableEvent (double timestamp, container_t container, type_t type, double value)
+simgrid::instr::SetVariableEvent::SetVariableEvent(double timestamp, container_t container, Type* type, double value)
{
- this->event_type = PAJE_SetVariable;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_SetVariable;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->value = value;
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-void SetVariableEvent::print() {
+void simgrid::instr::SetVariableEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id << " " << value;
+ stream << " " << type->id_ << " " << container->id_ << " " << value;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-AddVariableEvent::AddVariableEvent (double timestamp, container_t container, type_t type, double value)
+simgrid::instr::AddVariableEvent::AddVariableEvent(double timestamp, container_t container, simgrid::instr::Type* type,
+ double value)
{
- this->event_type = PAJE_AddVariable;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_AddVariable;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->value = value;
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-void AddVariableEvent::print() {
+void simgrid::instr::AddVariableEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id << " " << value;
+ stream << " " << type->id_ << " " << container->id_ << " " << value;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-SubVariableEvent::SubVariableEvent (double timestamp, container_t container, type_t type, double value)
+simgrid::instr::SubVariableEvent::SubVariableEvent(double timestamp, container_t container, Type* type, double value)
{
- this->event_type = PAJE_SubVariable;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_SubVariable;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->value = value;
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-void SubVariableEvent::print() {
+void simgrid::instr::SubVariableEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id << " " << value;
+ stream << " " << type->id_ << " " << container->id_ << " " << value;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-SetStateEvent::SetStateEvent(double timestamp, container_t container, type_t type, value* val)
+simgrid::instr::SetStateEvent::SetStateEvent(double timestamp, container_t container, Type* type, Value* val)
{
- this->event_type = PAJE_SetState;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_SetState;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->val = val;
}
#endif
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-void SetStateEvent::print() {
+void simgrid::instr::SetStateEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id;
- stream << " " << val->id;
+ stream << " " << type->id_ << " " << container->id_;
+ stream << " " << val->id_;
#if HAVE_SMPI
if (xbt_cfg_get_boolean("smpi/trace-call-location")) {
stream << " \"" << filename << "\" " << linenumber;
}
}
-PushStateEvent::PushStateEvent(double timestamp, container_t container, type_t type, value* val, void* extra)
+simgrid::instr::PushStateEvent::PushStateEvent(double timestamp, container_t container, Type* type, Value* val,
+ void* extra)
{
- this->event_type = PAJE_PushState;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_PushState;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->val = val;
}
#endif
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-PushStateEvent::PushStateEvent(double timestamp, container_t container, type_t type, value* val)
+simgrid::instr::PushStateEvent::PushStateEvent(double timestamp, container_t container, Type* type, Value* val)
: PushStateEvent(timestamp, container, type, val, nullptr)
{}
-void PushStateEvent::print() {
+void simgrid::instr::PushStateEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id;
- stream << " " << val->id;
+ stream << " " << type->id_ << " " << container->id_;
+ stream << " " << val->id_;
if (TRACE_display_sizes()) {
stream << " ";
char* process_id = nullptr;
// FIXME: dirty extract "rank-" from the name, as we want the bare process id here
- if (strstr(container->name, "rank-") == nullptr)
- process_id = xbt_strdup(container->name);
+ if (strstr(container->name_, "rank-") == nullptr)
+ process_id = xbt_strdup(container->name_);
else
- process_id = xbt_strdup(container->name + 5);
+ process_id = xbt_strdup(container->name_ + 5);
- FILE* trace_file = (FILE*)xbt_dict_get(tracing_files, container->name);
+ FILE* trace_file = (FILE*)xbt_dict_get(tracing_files, container->name_);
switch (extra->type) {
case TRACING_INIT:
case TRACING_SSEND:
case TRACING_ISSEND:
default:
- XBT_WARN("Call from %s impossible to translate into replay command : Not implemented (yet)", val->name);
+ XBT_WARN("Call from %s impossible to translate into replay command : Not implemented (yet)", val->name_);
break;
}
}
}
-
-PopStateEvent::PopStateEvent (double timestamp, container_t container, type_t type)
+simgrid::instr::PopStateEvent::PopStateEvent(double timestamp, container_t container, Type* type)
{
- this->event_type = PAJE_PopState;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_PopState;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-void PopStateEvent::print() {
+void simgrid::instr::PopStateEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id;
+ stream << " " << type->id_ << " " << container->id_;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-ResetStateEvent::ResetStateEvent (double timestamp, container_t container, type_t type)
+simgrid::instr::ResetStateEvent::ResetStateEvent(double timestamp, container_t container, Type* type)
{
- this->event_type = PAJE_ResetState;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_ResetState;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
delete[] this;
}
-void ResetStateEvent::print() {
+void simgrid::instr::ResetStateEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id;
+ stream << " " << type->id_ << " " << container->id_;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-StartLinkEvent::~StartLinkEvent()
+simgrid::instr::StartLinkEvent::~StartLinkEvent()
{
free(value);
free(key);
}
-StartLinkEvent::StartLinkEvent (double timestamp, container_t container,
- type_t type, container_t sourceContainer, const char *value, const char *key)
- : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
+simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t container, Type* type,
+ container_t sourceContainer, const char* value, const char* key)
+ : StartLinkEvent(timestamp, container, type, sourceContainer, value, key, -1)
{}
-StartLinkEvent::StartLinkEvent (double timestamp, container_t container, type_t type, container_t sourceContainer,
- const char *value, const char *key, int size)
+simgrid::instr::StartLinkEvent::StartLinkEvent(double timestamp, container_t container, Type* type,
+ container_t sourceContainer, const char* value, const char* key,
+ int size)
{
- event_type = PAJE_StartLink;
- this->timestamp = timestamp;
+ eventType_ = PAJE_StartLink;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->sourceContainer = sourceContainer;
this->key = xbt_strdup(key);
this->size = size;
- XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__,
- (int)event_type, this->timestamp, this->value);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f, value:%s", __FUNCTION__, (int)eventType_, this->timestamp_, this->value);
insert_into_buffer (this);
}
-void StartLinkEvent::print() {
+void simgrid::instr::StartLinkEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id << " " << value;
- stream << " " << sourceContainer->id << " " << key;
+ stream << " " << type->id_ << " " << container->id_ << " " << value;
+ stream << " " << sourceContainer->id_ << " " << key;
if (TRACE_display_sizes()) {
stream << " " << size;
}
}
-EndLinkEvent::EndLinkEvent (double timestamp, container_t container, type_t type, container_t destContainer,
- const char *value, const char *key)
+simgrid::instr::EndLinkEvent::EndLinkEvent(double timestamp, container_t container, Type* type,
+ container_t destContainer, const char* value, const char* key)
{
- this->event_type = PAJE_EndLink;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_EndLink;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->destContainer = destContainer;
this->value = xbt_strdup(value);
this->key = xbt_strdup(key);
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-EndLinkEvent::~EndLinkEvent()
+simgrid::instr::EndLinkEvent::~EndLinkEvent()
{
free(value);
free(key);
}
-void EndLinkEvent::print() {
+void simgrid::instr::EndLinkEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id << " " << value;
- stream << " " << destContainer->id << " " << key;
+ stream << " " << type->id_ << " " << container->id_ << " " << value;
+ stream << " " << destContainer->id_ << " " << key;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
}
}
-NewEvent::NewEvent(double timestamp, container_t container, type_t type, value* val)
+simgrid::instr::NewEvent::NewEvent(double timestamp, container_t container, Type* type, Value* val)
{
- this->event_type = PAJE_NewEvent;
- this->timestamp = timestamp;
+ this->eventType_ = PAJE_NewEvent;
+ this->timestamp_ = timestamp;
this->type = type;
this->container = container;
this->val = val;
- XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)event_type, this->timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%f", __FUNCTION__, (int)eventType_, this->timestamp_);
insert_into_buffer (this);
}
-void NewEvent::print () {
+void simgrid::instr::NewEvent::print()
+{
if (instr_fmt_type == instr_fmt_paje) {
- XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)event_type, TRACE_precision(), timestamp);
+ XBT_DEBUG("%s: event_type=%d, timestamp=%.*f", __FUNCTION__, (int)eventType_, TRACE_precision(), timestamp_);
stream << std::fixed << std::setprecision(TRACE_precision());
- stream << (int)this->event_type;
+ stream << (int)this->eventType_;
print_timestamp(this);
- stream << " " << type->id << " " << container->id << " " << val->id;
+ stream << " " << type->id_ << " " << container->id_ << " " << val->id_;
print_row();
} else if (instr_fmt_type == instr_fmt_TI) {
/* Nothing to do */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_types, instr, "Paje tracing event system (types)");
-static type_t rootType = nullptr; /* the root type */
+static simgrid::instr::Type* rootType = nullptr; /* the root type */
void PJ_type_release ()
{
rootType = nullptr;
}
-type_t PJ_type_get_root ()
+simgrid::instr::Type* PJ_type_get_root()
{
return rootType;
}
-static type_t newType (const char *typeNameBuff, const char *key, const char *color, e_entity_types kind, type_t father)
+simgrid::instr::Type::Type(const char* typeNameBuff, const char* key, const char* color, e_entity_types kind,
+ Type* father)
+ : kind_(kind), father_(father)
{
if (typeNameBuff == nullptr || key == nullptr){
THROWF(tracing_error, 0, "can't create a new type with name or key equal nullptr");
}
- type_t ret = xbt_new0(s_type, 1);
- ret->name = xbt_strdup (typeNameBuff);
- ret->father = father;
- ret->kind = kind;
- ret->children = xbt_dict_new_homogeneous(nullptr);
- ret->values = xbt_dict_new_homogeneous(nullptr);
- ret->color = xbt_strdup (color);
+ this->name_ = xbt_strdup(typeNameBuff);
+ this->children_ = xbt_dict_new_homogeneous(nullptr);
+ this->values_ = xbt_dict_new_homogeneous(nullptr);
+ this->color_ = xbt_strdup(color);
char str_id[INSTR_DEFAULT_STR_SIZE];
snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
- ret->id = xbt_strdup (str_id);
+ this->id_ = xbt_strdup(str_id);
if (father != nullptr){
- xbt_dict_set (father->children, key, ret, nullptr);
- XBT_DEBUG("new type %s, child of %s", typeNameBuff, father->name);
+ xbt_dict_set(father->children_, key, this, nullptr);
+ XBT_DEBUG("new type %s, child of %s", typeNameBuff, father->name_);
}
- return ret;
}
-void PJ_type_free (type_t type)
+void PJ_type_free(simgrid::instr::Type* type)
{
- value* val;
+ simgrid::instr::Value* val;
char *value_name;
xbt_dict_cursor_t cursor = nullptr;
- xbt_dict_foreach (type->values, cursor, value_name, val) {
- XBT_DEBUG("free value %s, child of %s", val->name, val->father->name);
+ xbt_dict_foreach (type->values_, cursor, value_name, val) {
+ XBT_DEBUG("free value %s, child of %s", val->name_, val->father_->name_);
xbt_free(val);
}
- xbt_dict_free (&type->values);
- xbt_free (type->name);
- xbt_free (type->id);
- xbt_free (type->color);
- xbt_dict_free (&type->children);
- xbt_free (type);
- type = nullptr;
+ xbt_dict_free(&type->values_);
+ xbt_free(type->name_);
+ xbt_free(type->id_);
+ xbt_free(type->color_);
+ xbt_dict_free(&type->children_);
+ delete type;
}
-void recursiveDestroyType (type_t type)
+void recursiveDestroyType(simgrid::instr::Type* type)
{
- XBT_DEBUG("recursiveDestroyType %s", type->name);
+ XBT_DEBUG("recursiveDestroyType %s", type->name_);
xbt_dict_cursor_t cursor = nullptr;
- type_t child;
+ simgrid::instr::Type* child;
char *child_name;
- xbt_dict_foreach(type->children, cursor, child_name, child) {
+ xbt_dict_foreach (type->children_, cursor, child_name, child) {
recursiveDestroyType (child);
}
PJ_type_free(type);
}
-type_t PJ_type_get (const char *name, type_t father)
+simgrid::instr::Type* PJ_type_get(const char* name, simgrid::instr::Type* father)
{
- type_t ret = PJ_type_get_or_null (name, father);
+ simgrid::instr::Type* ret = simgrid::instr::Type::getOrNull(name, father);
if (ret == nullptr){
- THROWF (tracing_error, 2, "type with name (%s) not found in father type (%s)", name, father->name);
+ THROWF(tracing_error, 2, "type with name (%s) not found in father type (%s)", name, father->name_);
}
return ret;
}
-type_t PJ_type_get_or_null (const char *name, type_t father)
+simgrid::instr::Type* simgrid::instr::Type::getOrNull(const char* name, simgrid::instr::Type* father)
{
if (name == nullptr || father == nullptr){
THROWF (tracing_error, 0, "can't get type with a nullptr name or from a nullptr father");
}
- type_t ret = nullptr;
- type_t child;
+ simgrid::instr::Type* ret = nullptr;
+ simgrid::instr::Type* child;
char *child_name;
xbt_dict_cursor_t cursor = nullptr;
- xbt_dict_foreach(father->children, cursor, child_name, child) {
- if (strcmp (child->name, name) == 0){
+ xbt_dict_foreach (father->children_, cursor, child_name, child) {
+ if (strcmp(child->name_, name) == 0) {
if (ret != nullptr){
THROWF (tracing_error, 0, "there are two children types with the same name?");
}else{
return ret;
}
-type_t PJ_type_container_new (const char *name, type_t father)
+simgrid::instr::Type* simgrid::instr::Type::containerNew(const char* name, simgrid::instr::Type* father)
{
if (name == nullptr){
THROWF (tracing_error, 0, "can't create a container type with a nullptr name");
}
- type_t ret = newType(name, name, nullptr, TYPE_CONTAINER, father);
+ simgrid::instr::Type* ret = new simgrid::instr::Type(name, name, nullptr, TYPE_CONTAINER, father);
if (father == nullptr) {
rootType = ret;
} else {
- XBT_DEBUG("ContainerType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
- DefineContainerEvent(ret);
+ XBT_DEBUG("ContainerType %s(%s), child of %s(%s)", ret->name_, ret->id_, father->name_, father->id_);
+ LogContainerTypeDefinition(ret);
}
return ret;
}
-type_t PJ_type_event_new (const char *name, type_t father)
+simgrid::instr::Type* simgrid::instr::Type::eventNew(const char* name, simgrid::instr::Type* father)
{
if (name == nullptr){
THROWF (tracing_error, 0, "can't create an event type with a nullptr name");
}
- type_t ret = newType (name, name, nullptr, TYPE_EVENT, father);
- XBT_DEBUG("EventType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ Type* ret = new Type (name, name, nullptr, TYPE_EVENT, father);
+ XBT_DEBUG("EventType %s(%s), child of %s(%s)", ret->name_, ret->id_, father->name_, father->id_);
LogDefineEventType(ret);
return ret;
}
-type_t PJ_type_variable_new (const char *name, const char *color, type_t father)
+simgrid::instr::Type* simgrid::instr::Type::variableNew(const char* name, const char* color,
+ simgrid::instr::Type* father)
{
if (name == nullptr){
THROWF (tracing_error, 0, "can't create a variable type with a nullptr name");
}
- type_t ret = nullptr;
+ Type* ret = nullptr;
if (not color) {
char white[INSTR_DEFAULT_STR_SIZE] = "1 1 1";
- ret = newType (name, name, white, TYPE_VARIABLE, father);
+ ret = new Type (name, name, white, TYPE_VARIABLE, father);
}else{
- ret = newType (name, name, color, TYPE_VARIABLE, father);
+ ret = new Type (name, name, color, TYPE_VARIABLE, father);
}
- XBT_DEBUG("VariableType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ XBT_DEBUG("VariableType %s(%s), child of %s(%s)", ret->name_, ret->id_, father->name_, father->id_);
LogVariableTypeDefinition (ret);
return ret;
}
-type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest)
+simgrid::instr::Type* simgrid::instr::Type::linkNew(const char* name, Type* father, Type* source, Type* dest)
{
if (name == nullptr){
THROWF (tracing_error, 0, "can't create a link type with a nullptr name");
}
- type_t ret = nullptr;
-
char key[INSTR_DEFAULT_STR_SIZE];
- snprintf (key, INSTR_DEFAULT_STR_SIZE, "%s-%s-%s", name, source->id, dest->id);
- ret = newType (name, key, nullptr, TYPE_LINK, father);
- XBT_DEBUG("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name, ret->id, father->name, father->id,
- source->name, source->id, dest->name, dest->id);
+ snprintf(key, INSTR_DEFAULT_STR_SIZE, "%s-%s-%s", name, source->id_, dest->id_);
+ Type* ret = new Type(name, key, nullptr, TYPE_LINK, father);
+ XBT_DEBUG("LinkType %s(%s), child of %s(%s) %s(%s)->%s(%s)", ret->name_, ret->id_, father->name_, father->id_,
+ source->name_, source->id_, dest->name_, dest->id_);
LogLinkTypeDefinition(ret, source, dest);
return ret;
}
-type_t PJ_type_state_new (const char *name, type_t father)
+simgrid::instr::Type* simgrid::instr::Type::stateNew(const char* name, Type* father)
{
if (name == nullptr){
THROWF (tracing_error, 0, "can't create a state type with a nullptr name");
}
- type_t ret = nullptr;
-
- ret = newType (name, name, nullptr, TYPE_STATE, father);
- XBT_DEBUG("StateType %s(%s), child of %s(%s)", ret->name, ret->id, father->name, father->id);
+ Type* ret = new Type(name, name, nullptr, TYPE_STATE, father);
+ XBT_DEBUG("StateType %s(%s), child of %s(%s)", ret->name_, ret->id_, father->name_, father->id_);
LogStateTypeDefinition(ret);
return ret;
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_paje_values, instr, "Paje tracing event system (values)");
-value::value(const char* name, const char* color, type_t father)
+simgrid::instr::Value::Value(const char* name, const char* color, simgrid::instr::Type* father)
{
if (name == nullptr || father == nullptr){
THROWF (tracing_error, 0, "can't create a value with a nullptr name (or a nullptr father)");
}
- this->ret = xbt_new0(value, 1);
- this->ret->name = xbt_strdup (name);
- this->ret->father = father;
- this->ret->color = xbt_strdup (color);
+ this->ret_ = xbt_new0(Value, 1);
+ this->ret_->name_ = xbt_strdup(name);
+ this->ret_->father_ = father;
+ this->ret_->color_ = xbt_strdup(color);
char str_id[INSTR_DEFAULT_STR_SIZE];
snprintf (str_id, INSTR_DEFAULT_STR_SIZE, "%lld", instr_new_paje_id());
- this->ret->id = xbt_strdup (str_id);
+ this->ret_->id_ = xbt_strdup(str_id);
- xbt_dict_set (father->values, name, ret, nullptr);
- XBT_DEBUG("new value %s, child of %s", ret->name, ret->father->name);
- LogEntityValue(this->ret);
+ xbt_dict_set(father->values_, name, ret_, nullptr);
+ XBT_DEBUG("new value %s, child of %s", ret_->name_, ret_->father_->name_);
+ LogEntityValue(this->ret_);
};
-value::~value()
+simgrid::instr::Value::~Value()
{
/* FIXME: this should be cleanable
xbt_free(name);
*/
}
-value* value::get_or_new(const char* name, const char* color, type_t father)
+simgrid::instr::Value* simgrid::instr::Value::get_or_new(const char* name, const char* color,
+ simgrid::instr::Type* father)
{
- value* ret = 0;
+ Value* ret = 0;
try {
- ret = value::get(name, father);
+ ret = Value::get(name, father);
}
catch(xbt_ex& e) {
- value rett(name, color, father);
- ret = rett.ret;
+ Value rett(name, color, father);
+ ret = rett.ret_;
}
return ret;
}
-value* value::get(const char* name, type_t father)
+simgrid::instr::Value* simgrid::instr::Value::get(const char* name, Type* father)
{
if (name == nullptr || father == nullptr){
THROWF (tracing_error, 0, "can't get a value with a nullptr name (or a nullptr father)");
}
- if (father->kind == TYPE_VARIABLE)
- THROWF(tracing_error, 0, "variables can't have different values (%s)", father->name);
- value* ret = (value*)xbt_dict_get_or_null(father->values, name);
+ if (father->kind_ == TYPE_VARIABLE)
+ THROWF(tracing_error, 0, "variables can't have different values (%s)", father->name_);
+ Value* ret = (Value*)xbt_dict_get_or_null(father->values_, name);
if (ret == nullptr) {
- THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name, father->name);
+ THROWF(tracing_error, 2, "value with name (%s) not found in father type (%s)", name, father->name_);
}
return ret;
}
#include "src/internal_config.h"
#include <set>
-SG_BEGIN_DECL()
-
/* Need to define function drand48 for Windows */
/* FIXME: use _drand48() defined in src/surf/random_mgr.c instead */
#ifdef _WIN32
#include "xbt/graph.h"
#include "xbt/dict.h"
+namespace simgrid {
+namespace instr {
typedef enum {
PAJE_DefineContainerType,
PAJE_DefineVariableType,
} e_entity_types;
//--------------------------------------------------
-class s_type;
-typedef s_type *type_t;
-class s_type {
- public:
- char *id;
- char *name;
- char *color;
- e_entity_types kind;
- s_type *father;
- xbt_dict_t children;
- xbt_dict_t values; //valid for all types except variable and container
-};
-typedef s_type s_type_t;
+class Type {
+public:
+ char* id_;
+ char* name_;
+ char* color_;
+
+ e_entity_types kind_;
+ Type* father_;
+ xbt_dict_t children_;
+ xbt_dict_t values_; // valid for all types except variable and container
+ Type(const char* typeNameBuff, const char* key, const char* color, e_entity_types kind, Type* father);
+ static Type* getOrNull(const char* name, Type* father);
+ static Type* containerNew(const char* name, Type* father);
+ static Type* eventNew(const char* name, Type* father);
+ static Type* variableNew(const char* name, const char* color, Type* father);
+ static Type* linkNew(const char* name, Type* father, Type* source, Type* dest);
+ static Type* stateNew(const char* name, Type* father);
+};
//--------------------------------------------------
-class value {
+class Value {
public:
- char *id;
- char *name;
- char *color;
- type_t father;
- value* ret;
- value(const char* name, const char* color, type_t father);
- ~value();
- static value* get_or_new(const char* name, const char* color, type_t father);
- static value* get(const char* name, type_t father);
+ char* id_;
+ char* name_;
+ char* color_;
+
+ Type* father_;
+ Value* ret_;
+ Value(const char* name, const char* color, Type* father);
+ ~Value();
+ static Value* get_or_new(const char* name, const char* color, Type* father);
+ static Value* get(const char* name, Type* father);
};
} e_container_types;
//--------------------------------------------------
-class s_container;
-typedef s_container *container_t;
-class s_container {
- public:
- sg_netpoint_t netpoint;
- char *name; /* Unique name of this container */
- char *id; /* Unique id of this container */
- type_t type; /* Type of this container */
- int level; /* Level in the hierarchy, root level is 0 */
- e_container_types kind; /* This container is of what kind */
- s_container *father;
- xbt_dict_t children;
+class Container {
+public:
+ Container(const char* name, simgrid::instr::e_container_types kind, Container* father);
+ virtual ~Container();
+
+ sg_netpoint_t netpoint_;
+ char* name_; /* Unique name of this container */
+ char* id_; /* Unique id of this container */
+ Type* type_; /* Type of this container */
+ int level_ = 0; /* Level in the hierarchy, root level is 0 */
+ e_container_types kind_; /* This container is of what kind */
+ Container* father_;
+ xbt_dict_t children_;
};
-typedef s_container s_container_t;
//--------------------------------------------------
class PajeEvent {
public:
- double timestamp;
- e_event_type event_type;
- virtual void print() = 0;
- void *data;
- virtual ~PajeEvent();
+ double timestamp_;
+ e_event_type eventType_;
+ virtual void print() = 0;
+ virtual ~PajeEvent();
};
//--------------------------------------------------
-
-class DefineVariableTypeEvent : public PajeEvent
-{
- public:
- type_t type;
- DefineVariableTypeEvent(type_t type);
- void print() override;
-};
-//--------------------------------------------------
-
-class DefineStateTypeEvent : public PajeEvent {
- type_t type;
- public:
- DefineStateTypeEvent(type_t type);
- void print() override;
-};
-
-
class SetVariableEvent : public PajeEvent {
private:
- container_t container;
- type_t type;
- double value;
+ Container* container;
+ Type* type;
+ double value;
+
public:
- SetVariableEvent (double timestamp, container_t container, type_t type, double value);
- void print() override;
+ SetVariableEvent(double timestamp, Container* container, Type* type, double value);
+ void print() override;
};
-
class AddVariableEvent:public PajeEvent {
private:
- container_t container;
- type_t type;
- double value;
+ Container* container;
+ Type* type;
+ double value;
+
public:
- AddVariableEvent (double timestamp, container_t container, type_t type, double value);
- void print() override;
+ AddVariableEvent(double timestamp, Container* container, Type* type, double value);
+ void print() override;
};
-
//--------------------------------------------------
class SubVariableEvent : public PajeEvent {
private:
- container_t container;
- type_t type;
- double value;
+ Container* container;
+ Type* type;
+ double value;
+
public:
- SubVariableEvent(double timestamp, container_t container, type_t type, double value);
- void print() override;
+ SubVariableEvent(double timestamp, Container* container, Type* type, double value);
+ void print() override;
};
//--------------------------------------------------
class SetStateEvent : public PajeEvent {
private:
- container_t container;
- type_t type;
- value* val;
- const char* filename;
- int linenumber;
+ Container* container;
+ Type* type;
+ Value* val;
+ const char* filename;
+ int linenumber;
+
public:
- SetStateEvent(double timestamp, container_t container, type_t type, value* val);
+ SetStateEvent(double timestamp, Container* container, Type* type, Value* val);
void print() override;
};
class PushStateEvent : public PajeEvent {
public:
- container_t container;
- type_t type;
- value* val;
- int size;
- const char* filename;
- int linenumber;
- void* extra_;
+ Container* container;
+ Type* type;
+ Value* val;
+ int size;
+ const char* filename;
+ int linenumber;
+ void* extra_;
+
public:
- PushStateEvent(double timestamp, container_t container, type_t type, value* val);
- PushStateEvent(double timestamp, container_t container, type_t type, value* val, void* extra);
+ PushStateEvent(double timestamp, Container* container, Type* type, Value* val);
+ PushStateEvent(double timestamp, Container* container, Type* type, Value* val, void* extra);
void print() override;
};
class PopStateEvent : public PajeEvent {
- container_t container;
- type_t type;
- public:
- PopStateEvent (double timestamp, container_t container, type_t type);
+ Container* container;
+ Type* type;
+
+public:
+ PopStateEvent(double timestamp, Container* container, Type* type);
void print() override;
};
class ResetStateEvent : public PajeEvent {
- container_t container;
- type_t type;
- public:
- ResetStateEvent (double timestamp, container_t container, type_t type);
+ Container* container;
+ Type* type;
+
+public:
+ ResetStateEvent(double timestamp, Container* container, Type* type);
void print() override;
};
class StartLinkEvent : public PajeEvent {
public:
- container_t container;
- type_t type;
- container_t sourceContainer;
- char *value;
- char *key;
- int size;
+ Container* container;
+ Type* type;
+ Container* sourceContainer;
+ char* value;
+ char* key;
+ int size;
+
public:
~StartLinkEvent();
- StartLinkEvent(double timestamp, container_t container, type_t type, container_t sourceContainer, const char* value,
+ StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, const char* value,
const char* key);
- StartLinkEvent(double timestamp, container_t container, type_t type, container_t sourceContainer, const char* value,
+ StartLinkEvent(double timestamp, Container* container, Type* type, Container* sourceContainer, const char* value,
const char* key, int size);
void print() override;
};
class EndLinkEvent : public PajeEvent {
- container_t container;
- type_t type;
- container_t destContainer;
+ Container* container;
+ Type* type;
+ Container* destContainer;
char *value;
char *key;
public:
- EndLinkEvent (double timestamp, container_t container, type_t type, container_t destContainer,
- const char *value, const char *key);
- ~EndLinkEvent();
- void print() override;
+ EndLinkEvent(double timestamp, Container* container, Type* type, Container* destContainer, const char* value,
+ const char* key);
+ ~EndLinkEvent();
+ void print() override;
};
class NewEvent : public PajeEvent {
public:
- container_t container;
- type_t type;
- value* val;
-
-public:
- NewEvent(double timestamp, container_t container, type_t type, value* val);
- void print() override;
+ Container* container;
+ Type* type;
+ Value* val;
+ public:
+ NewEvent(double timestamp, Container* container, Type* type, Value* val);
+ void print() override;
};
+}
+} // namespace simgrid::instr
+typedef simgrid::instr::Container* container_t;
+
+SG_BEGIN_DECL()
extern XBT_PRIVATE std::set<std::string> created_categories;
extern XBT_PRIVATE std::set<std::string> declared_marks;
XBT_PRIVATE long long int instr_new_paje_id ();
XBT_PRIVATE void PJ_container_alloc ();
XBT_PRIVATE void PJ_container_release ();
-XBT_PUBLIC(container_t) PJ_container_new (const char *name, e_container_types kind, container_t father);
XBT_PUBLIC(container_t) PJ_container_get (const char *name);
XBT_PUBLIC(container_t) PJ_container_get_or_null (const char *name);
XBT_PUBLIC(container_t) PJ_container_get_root ();
XBT_PUBLIC(void) PJ_container_set_root (container_t root);
-XBT_PUBLIC(void) PJ_container_free (container_t container);
XBT_PUBLIC(void) PJ_container_free_all (void);
XBT_PUBLIC(void) PJ_container_remove_from_parent (container_t container);
/* instr_paje_types.c */
XBT_PRIVATE void PJ_type_release ();
-XBT_PUBLIC(type_t) PJ_type_get_root ();
-XBT_PRIVATE type_t PJ_type_container_new (const char *name, type_t father);
-XBT_PRIVATE type_t PJ_type_event_new (const char *name, type_t father);
-type_t PJ_type_link_new (const char *name, type_t father, type_t source, type_t dest);
-XBT_PRIVATE XBT_PRIVATE type_t PJ_type_variable_new (const char *name, const char *color, type_t father);
-XBT_PRIVATE type_t PJ_type_state_new (const char *name, type_t father);
-XBT_PUBLIC(type_t) PJ_type_get (const char *name, const type_t father);
-XBT_PUBLIC(type_t) PJ_type_get_or_null (const char *name, type_t father);
-XBT_PRIVATE XBT_PRIVATE void PJ_type_free (type_t type);
+XBT_PUBLIC(simgrid::instr::Type*) PJ_type_get_root();
+XBT_PUBLIC(simgrid::instr::Type*) PJ_type_get(const char* name, simgrid::instr::Type* father);
+XBT_PRIVATE XBT_PRIVATE void PJ_type_free(simgrid::instr::Type* type);
/* instr_config.c */
-XBT_PRIVATE void recursiveDestroyType (type_t type);
+XBT_PRIVATE void recursiveDestroyType(simgrid::instr::Type* type);
XBT_PRIVATE void TRACE_TI_start();
XBT_PRIVATE void TRACE_TI_end();
SG_END_DECL()
-void DefineContainerEvent(type_t type);
-void LogVariableTypeDefinition(type_t type);
-void LogStateTypeDefinition(type_t type);
-void LogLinkTypeDefinition(type_t type, type_t source, type_t dest);
-void LogEntityValue(value* val);
+void LogContainerTypeDefinition(simgrid::instr::Type* type);
+void LogVariableTypeDefinition(simgrid::instr::Type* type);
+void LogStateTypeDefinition(simgrid::instr::Type* type);
+void LogLinkTypeDefinition(simgrid::instr::Type* type, simgrid::instr::Type* source, simgrid::instr::Type* dest);
+void LogEntityValue(simgrid::instr::Value* val);
void LogContainerCreation (container_t container);
void LogContainerDestruction (container_t container);
-void LogDefineEventType(type_t type);
+void LogDefineEventType(simgrid::instr::Type* type);
#endif
// check if key exists: if it doesn't, set the variable to zero and mark this in the dict
if (platform_variables.find(key) == platform_variables.end()) {
container_t container = PJ_container_get (resource);
- type_t type = PJ_type_get (variable, container->type);
- new SetVariableEvent (now, container, type, 0);
+ simgrid::instr::Type* type = PJ_type_get(variable, container->type_);
+ new simgrid::instr::SetVariableEvent(now, container, type, 0);
platform_variables[key] = std::string("");
}
}
-static void instr_event (double now, double delta, type_t variable, container_t resource, double value)
+static void instr_event(double now, double delta, simgrid::instr::Type* variable, container_t resource, double value)
{
- __TRACE_surf_check_variable_set_to_zero(now, variable->name, resource->name);
- new AddVariableEvent(now, resource, variable, value);
- new SubVariableEvent(now + delta, resource, variable, value);
+ __TRACE_surf_check_variable_set_to_zero(now, variable->name_, resource->name_);
+ new simgrid::instr::AddVariableEvent(now, resource, variable, value);
+ new simgrid::instr::SubVariableEvent(now + delta, resource, variable, value);
}
/* TRACE_surf_link_set_utilization: entry point from SimGrid */
if (TRACE_uncategorized()){
XBT_DEBUG("UNCAT LINK [%f - %f] %s bandwidth_used %f", now, now+delta, resource, value);
container_t container = PJ_container_get (resource);
- type_t type = PJ_type_get ("bandwidth_used", container->type);
+ simgrid::instr::Type* type = PJ_type_get("bandwidth_used", container->type_);
instr_event (now, delta, type, container, value);
}
snprintf (category_type, INSTR_DEFAULT_STR_SIZE, "b%s", category);
XBT_DEBUG("CAT LINK [%f - %f] %s %s %f", now, now+delta, resource, category_type, value);
container_t container = PJ_container_get (resource);
- type_t type = PJ_type_get (category_type, container->type);
+ simgrid::instr::Type* type = PJ_type_get(category_type, container->type_);
instr_event (now, delta, type, container, value);
}
}
//trace uncategorized host utilization
if (TRACE_uncategorized()){
XBT_DEBUG("UNCAT HOST [%f - %f] %s power_used %f", now, now+delta, resource, value);
- type_t type = PJ_type_get ("power_used", container->type);
+ simgrid::instr::Type* type = PJ_type_get("power_used", container->type_);
instr_event (now, delta, type, container, value);
}
char category_type[INSTR_DEFAULT_STR_SIZE];
snprintf (category_type, INSTR_DEFAULT_STR_SIZE, "p%s", category);
XBT_DEBUG("CAT HOST [%f - %f] %s %s %f", now, now+delta, resource, category_type, value);
- type_t type = PJ_type_get (category_type, container->type);
+ simgrid::instr::Type* type = PJ_type_get(category_type, container->type_);
instr_event (now, delta, type, container, value);
}
}
// Symmetrical YES
if (route->symmetrical == true) {
- if (not route->gw_dst && not route->gw_src)
- XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
- else
- XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->name().c_str(), srcName,
- route->gw_src->name().c_str());
xbt_dynar_t nodes = xbt_graph_get_nodes(routeGraph_);
xbt_node_t node_s_v = xbt_dynar_get_as(nodes, src->id(), xbt_node_t);
xbt_node_t node_e_v = xbt_dynar_get_as(nodes, dst->id(), xbt_node_t);
xbt_edge_t edge = xbt_graph_get_edge(routeGraph_, node_e_v, node_s_v);
- if (edge)
- THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->name().c_str(), srcName,
+ if (not route->gw_dst || not route->gw_src){
+ XBT_DEBUG("Load Route from \"%s\" to \"%s\"", dstName, srcName);
+ if (edge)
+ THROWF(arg_error, 0, "Route from %s to %s already exists", dstName, srcName);
+ } else {
+ XBT_DEBUG("Load NetzoneRoute from %s@%s to %s@%s", dstName, route->gw_dst->name().c_str(), srcName,
+ route->gw_src->name().c_str());
+ if (edge)
+ THROWF(arg_error, 0, "Route from %s@%s to %s@%s already exists", dstName, route->gw_dst->name().c_str(), srcName,
route->gw_src->name().c_str());
+ }
if (route->gw_dst && route->gw_src) {
NetPoint* gw_tmp = route->gw_src;
}
}
-void DragonflyZone::createLink(std::string id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown)
+void DragonflyZone::createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown)
{
*linkup = nullptr;
*linkdown = nullptr;
route->link_list->push_back(currentRouter->blackLinks_[targetCoords[1]]);
if (latency)
*latency += currentRouter->blackLinks_[targetCoords[1]]->latency();
- currentRouter = routers_[targetCoords[0] * (numChassisPerGroup_ * numBladesPerChassis_) +
- targetCoords[1] * numBladesPerChassis_ + targetCoords[2]];
}
}
-/* Copyright (c) 2014-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
void seal() override;
void generateRouters();
void generateLinks();
- void createLink(std::string id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown);
+ void createLink(const std::string& id, int numlinks, surf::LinkImpl** linkup, surf::LinkImpl** linkdown);
private:
void rankId_to_coords(int rankId, unsigned int (*coords)[4]);
route->gw_dst = gw_tmp;
}
- if (not route->gw_src && not route->gw_dst)
+ if (not route->gw_src || not route->gw_dst)
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", route->dst->name().c_str(), route->src->name().c_str());
else
XBT_DEBUG("Load NetzoneRoute from \"%s(%s)\" to \"%s(%s)\"", route->dst->name().c_str(), route->gw_src->name().c_str(),
route->gw_src = route->gw_dst;
route->gw_dst = gw_tmp;
}
- if (route->gw_dst) // inter-zone route (to adapt the error message, if any)
+ if (route->gw_dst && route->gw_src) // inter-zone route (to adapt the error message, if any)
xbt_assert(
nullptr == TO_ROUTE_FULL(dst->id(), src->id()),
"The route between %s@%s and %s@%s already exists. You should not declare the reverse path as symmetrical.",
const char* srcName = src->cname();
const char* dstName = dst->cname();
- if (not route->gw_dst && not route->gw_src) {
+ if (not route->gw_dst || not route->gw_src) {
XBT_DEBUG("Load Route from \"%s\" to \"%s\"", srcName, dstName);
xbt_assert(src, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, srcName);
xbt_assert(dst, "Cannot add a route from %s to %s: %s does not exist.", srcName, dstName, dstName);
std::string link_up = "link_" + netpoint->name() + "_UP";
std::string link_down = "link_" + netpoint->name() + "_DOWN";
- surf::LinkImpl* linkUp = surf_network_model->createLink(link_up.c_str(), bw_out, 0, SURF_LINK_SHARED);
- surf::LinkImpl* linkDown = surf_network_model->createLink(link_down.c_str(), bw_in, 0, SURF_LINK_SHARED);
+ surf::LinkImpl* linkUp = surf_network_model->createLink(link_up, bw_out, 0, SURF_LINK_SHARED);
+ surf::LinkImpl* linkDown = surf_network_model->createLink(link_down, bw_in, 0, SURF_LINK_SHARED);
privateLinks_.insert({netpoint->id(), {linkUp, linkDown}});
}
# endif
#else
// Do we need to do any fixup like this?
- #error Target CPU type is not handled.
+# error Target CPU type is not handled.
#endif
}
-/* Copyright (c) 2015. The SimGrid Team.
+/* Copyright (c) 2015-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
static inline
pid_t _UPT_getpid(void* arg)
{
- struct _UPT_info* info = (_UPT_info*) arg;
+ struct _UPT_info* info = static_cast<_UPT_info*>(arg);
return info->pid;
}
//start link
container_t msg = PJ_container_get (instr_process_id(process, str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_LINK", PJ_type_get_root());
- new StartLinkEvent (MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_LINK", PJ_type_get_root());
+ new simgrid::instr::StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
//destroy existing container of this process
TRACE_msg_process_destroy (MSG_process_get_name (process), MSG_process_get_PID (process));
//end link
msg = PJ_container_get(instr_process_id(process, str, len));
type = PJ_type_get ("MSG_PROCESS_LINK", PJ_type_get_root());
- new EndLinkEvent (MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
+ new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t host_container = PJ_container_get(host->getCname());
- PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container);
+ new simgrid::instr::Container(instr_process_id_2(process_name, process_pid, str, len),
+ simgrid::instr::INSTR_MSG_PROCESS, host_container);
}
}
container_t process = PJ_container_get_or_null(instr_process_id_2(process_name, process_pid, str, len));
if (process) {
PJ_container_remove_from_parent (process);
- PJ_container_free (process);
+ delete process;
}
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(process, str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- value* val = value::get("suspend", type);
- new PushStateEvent(MSG_get_clock(), process_container, type, val);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get("suspend", type);
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(process, str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- new PopStateEvent (MSG_get_clock(), process_container, type);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(process, str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- value* val = value::get("sleep", type);
- new PushStateEvent(MSG_get_clock(), process_container, type, val);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get("sleep", type);
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(process, str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- new PopStateEvent (MSG_get_clock(), process_container, type);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- value* val = value::get("task_execute", type);
- new PushStateEvent(MSG_get_clock(), process_container, type, val);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get("task_execute", type);
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- new PopStateEvent (MSG_get_clock(), process_container, type);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- value* val = value::get("receive", type);
- new PushStateEvent(MSG_get_clock(), process_container, type, val);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get("receive", type);
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- new PopStateEvent (MSG_get_clock(), process_container, type);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type);
char key[INSTR_DEFAULT_STR_SIZE];
snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter);
type = PJ_type_get ("MSG_PROCESS_TASK_LINK", PJ_type_get_root());
- new EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key);
+ new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key);
}
}
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- value* val = value::get("send", type);
- new PushStateEvent(MSG_get_clock(), process_container, type, val);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get("send", type);
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), process_container, type, val);
char key[INSTR_DEFAULT_STR_SIZE];
snprintf (key, INSTR_DEFAULT_STR_SIZE, "p%lld", task->counter);
type = PJ_type_get ("MSG_PROCESS_TASK_LINK", PJ_type_get_root());
- new StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key);
+ new simgrid::instr::StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, process_container, "SR", key);
}
return 1;
char str[INSTR_DEFAULT_STR_SIZE];
container_t process_container = PJ_container_get (instr_process_id(MSG_process_self(), str, len));
- type_t type = PJ_type_get ("MSG_PROCESS_STATE", process_container->type);
- new PopStateEvent (MSG_get_clock(), process_container, type);
+ simgrid::instr::Type* type = PJ_type_get("MSG_PROCESS_STATE", process_container->type_);
+ new simgrid::instr::PopStateEvent(MSG_get_clock(), process_container, type);
}
}
if (TRACE_msg_vm_is_enabled()) {
container_t container = PJ_container_get(vm->getCname());
PJ_container_remove_from_parent(container);
- PJ_container_free(container);
+ delete container;
}
}
vm->start();
if (TRACE_msg_vm_is_enabled()) {
container_t vm_container = PJ_container_get(vm->getCname());
- type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
- value* val = value::get_or_new("start", "0 0 1", type); // start is blue
- new PushStateEvent(MSG_get_clock(), vm_container, type, val);
+ simgrid::instr::Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("start", "0 0 1", type); // start is blue
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val);
}
}
// start link
container_t msg = PJ_container_get(vm->getCname());
- type_t type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
- new StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
+ simgrid::instr::Type* type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
+ new simgrid::instr::StartLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
// destroy existing container of this vm
container_t existing_container = PJ_container_get(vm->getCname());
PJ_container_remove_from_parent(existing_container);
- PJ_container_free(existing_container);
+ delete existing_container;
// create new container on the new_host location
- PJ_container_new(vm->getCname(), INSTR_MSG_VM, PJ_container_get(ms->dst_pm->getCname()));
+ new simgrid::instr::Container(vm->getCname(), simgrid::instr::INSTR_MSG_VM,
+ PJ_container_get(ms->dst_pm->getCname()));
// end link
msg = PJ_container_get(vm->getCname());
type = PJ_type_get("MSG_VM_LINK", PJ_type_get_root());
- new EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
+ new simgrid::instr::EndLinkEvent(MSG_get_clock(), PJ_container_get_root(), type, msg, "M", key);
}
// Inform the SRC that the migration has been correctly performed
if (TRACE_msg_vm_is_enabled()) {
container_t vm_container = PJ_container_get(vm->getCname());
- type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
- value* val = value::get_or_new("suspend", "1 0 0", type); // suspend is red
- new PushStateEvent(MSG_get_clock(), vm_container, type, val);
+ simgrid::instr::Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("suspend", "1 0 0", type); // suspend is red
+ new simgrid::instr::PushStateEvent(MSG_get_clock(), vm_container, type, val);
}
}
if (TRACE_msg_vm_is_enabled()) {
container_t vm_container = PJ_container_get(vm->getCname());
- type_t type = PJ_type_get("MSG_VM_STATE", vm_container->type);
- new PopStateEvent(MSG_get_clock(), vm_container, type);
+ simgrid::instr::Type* type = PJ_type_get("MSG_VM_STATE", vm_container->type_);
+ new simgrid::instr::PopStateEvent(MSG_get_clock(), vm_container, type);
}
}
if (TRACE_msg_vm_is_enabled()) {
container_t host_container = PJ_container_get(pm->getCname());
- PJ_container_new(name, INSTR_MSG_VM, host_container);
+ new simgrid::instr::Container(name, simgrid::instr::INSTR_MSG_VM, host_container);
}
}
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(sd_daxparse, sd, "Parsing DAX files");
extern "C" {
- #undef CLEANUP
- #include "dax_dtd.h"
- #define register /* g++ don't like register, so don't say it */
- #include "dax_dtd.c"
- #undef register
+# undef CLEANUP
+# include "dax_dtd.h"
+# define register /* g++ don't like register, so don't say it */
+# include "dax_dtd.c"
+# undef register
}
/* Ensure that transfer tasks have unique names even though a file is used several times */
static xbt_heap_t simix_timers = nullptr;
/** @brief Timer datatype */
-typedef struct s_smx_timer {
+typedef class s_smx_timer {
double date = 0.0;
- simgrid::xbt::Task<void()> callback;
+ s_smx_timer() = default;
- s_smx_timer()=default;
+public:
+ simgrid::xbt::Task<void()> callback;
+ double getDate() { return date; }
s_smx_timer(double date, simgrid::xbt::Task<void()> callback) : date(date), callback(std::move(callback)) {}
} s_smx_timer_t;
/** @brief cancels a timer that was added earlier */
void SIMIX_timer_remove(smx_timer_t timer) {
- xbt_heap_rm_elm(simix_timers, timer, timer->date);
+ xbt_heap_rm_elm(simix_timers, timer, timer->getDate());
}
/** @brief Returns the date at which the timer will trigger (or 0 if nullptr timer) */
double SIMIX_timer_get_date(smx_timer_t timer) {
- return timer?timer->date:0;
+ return timer ? timer->getDate() : 0;
}
/**
} else {
if (n == 0) {
*newgroup = group;
- if (group != MPI_COMM_WORLD->group()
- && group != MPI_COMM_SELF->group() && group != MPI_GROUP_EMPTY)
- group->ref();
+ if (group != MPI_COMM_WORLD->group() && group != MPI_COMM_SELF->group() && group != MPI_GROUP_EMPTY)
+ group->ref();
return MPI_SUCCESS;
} else if (n == group->size()) {
*newgroup = MPI_GROUP_EMPTY;
} else if (*request == MPI_REQUEST_NULL) {
retval = MPI_SUCCESS;
} else {
-
- int rank = (request!=nullptr && (*request)->comm() != MPI_COMM_NULL) ? smpi_process()->index() : -1;
+ int rank = (*request)->comm() != MPI_COMM_NULL ? smpi_process()->index() : -1;
int src_traced = (*request)->src();
int dst_traced = (*request)->dst();
if (index == nullptr)
return MPI_ERR_ARG;
+ if (count <= 0)
+ return MPI_SUCCESS;
+
smpi_bench_end();
//save requests information for tracing
typedef struct {
int tag;
MPI_Comm comm;
} savedvalstype;
- savedvalstype* savedvals=nullptr;
- if(count>0){
- savedvals = xbt_new0(savedvalstype, count);
- }
+ savedvalstype* savedvals = xbt_new0(savedvalstype, count);
+
for (int i = 0; i < count; i++) {
MPI_Request req = requests[i]; //already received requests are no longer valid
if (req) {
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
+ } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
+ ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process()->index();
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
+ } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
+ ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
+ } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
+ ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process()->index();
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
+ } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
+ ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else if(request == nullptr){
retval = MPI_ERR_REQUEST;
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
+ } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
+ ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
} else if ((origin_count < 0 || target_count < 0) ||
(origin_addr==nullptr && origin_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((not origin_datatype->is_valid()) || (not target_datatype->is_valid())) {
+ } else if (((origin_datatype == MPI_DATATYPE_NULL) || (target_datatype == MPI_DATATYPE_NULL)) ||
+ ((not origin_datatype->is_valid()) || (not target_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
(origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
(result_addr==nullptr && result_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
- (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
+ } else if (((target_datatype == MPI_DATATYPE_NULL) || (result_datatype == MPI_DATATYPE_NULL)) ||
+ (((origin_datatype != MPI_DATATYPE_NULL) && (not origin_datatype->is_valid())) || (not target_datatype->is_valid()) || (not result_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
(origin_addr==nullptr && origin_count > 0 && op != MPI_NO_OP) ||
(result_addr==nullptr && result_count > 0)){
retval = MPI_ERR_COUNT;
- } else if ((origin_datatype != MPI_DATATYPE_NULL && not origin_datatype->is_valid()) ||
- (not target_datatype->is_valid()) || (not result_datatype->is_valid())) {
+ } else if (((target_datatype == MPI_DATATYPE_NULL) || (result_datatype == MPI_DATATYPE_NULL)) ||
+ (((origin_datatype != MPI_DATATYPE_NULL) && (not origin_datatype->is_valid())) || (not target_datatype->is_valid()) || (not result_datatype->is_valid()))) {
retval = MPI_ERR_TYPE;
} else if (op == MPI_OP_NULL) {
retval = MPI_ERR_OP;
retval = MPI_ERR_ARG;
} else if (origin_addr==nullptr || result_addr==nullptr || compare_addr==nullptr){
retval = MPI_ERR_COUNT;
- } else if (not datatype->is_valid()) {
+ } else if ((datatype == MPI_DATATYPE_NULL) || (not datatype->is_valid())) {
retval = MPI_ERR_TYPE;
} else {
int rank = smpi_process()->index();
{
/* just use geometric progression formula for sum:
a^0+a^1+...a^(n-1) = (a^n-1)/(a-1) */
- return ((pown(fanout,level) - 1)/(fanout - 1));
+ if(fanout > 1)
+ return ((pown(fanout,level) - 1)/(fanout - 1));
+ else
+ return 0; // is this right ?
}
/*
#define TRACE_AUTO_COLL(cat) \
if (TRACE_is_enabled()) { \
- type_t type = PJ_type_get_or_null(#cat, PJ_type_get_root()); \
+ simgrid::instr::Type* type = simgrid::instr::Type::getOrNull(#cat, PJ_type_get_root()); \
if (not type) { \
- type = PJ_type_event_new(#cat, PJ_type_get_root()); \
+ type = simgrid::instr::Type::eventNew(#cat, PJ_type_get_root()); \
} \
char cont_name[25]; \
snprintf(cont_name, 25, "rank-%d", smpi_process()->index()); \
- value* val = value::get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type); \
- new NewEvent(SIMIX_get_clock(), PJ_container_get(cont_name), type, val); \
+ simgrid::instr::Value* val = \
+ simgrid::instr::Value::get_or_new(Colls::mpi_coll_##cat##_description[i].name, "1.0 1.0 1.0", type); \
+ new simgrid::instr::NewEvent(SIMIX_get_clock(), PJ_container_get(cont_name), type, val); \
}
#define AUTOMATIC_COLL_BENCH(cat, ret, args, args2) \
int rank = comm->rank();
int size = comm->size();
+ if(size==0)
+ return MPI_ERR_COMM;
//non commutative case, use a working algo from openmpi
if (op != MPI_OP_NULL && not op->is_commutative()) {
return Coll_reduce_ompi_basic_linear::reduce(sendtmpbuf, recvbuf, count, datatype, op, root, comm);
||nbytes > mv2_alltoall_thresholds_table[conf_index][range].in_place_algo_table[range_threshold].max
) {
tmp_buf = (char *)smpi_get_tmp_sendbuffer( comm_size * recvcount * recvtype_size );
- mpi_errno = Datatype::copy((char *)recvbuf,
+ Datatype::copy((char *)recvbuf,
comm_size*recvcount, recvtype,
(char *)tmp_buf,
comm_size*recvcount, recvtype);
{
shmem_comm = comm->get_intra_comm();
if (not is_contig || not is_homogeneous) {
- mpi_errno = MPIR_Bcast_tune_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE, root, comm);
+ MPIR_Bcast_tune_inter_node_helper_MV2(tmp_buf, nbytes, MPI_BYTE, root, comm);
} else {
- mpi_errno =
- MPIR_Bcast_tune_inter_node_helper_MV2(buffer, count, datatype, root,
- comm);
+ MPIR_Bcast_tune_inter_node_helper_MV2(buffer, count, datatype, root, comm);
}
/* We are now done with the inter-node phase */
while (pof2 < comm_size) pof2 <<= 1;
if (pof2 == comm_size && is_block_regular) {
/* noncommutative, pof2 size, and block regular */
- mpi_errno = MPIR_Reduce_scatter_non_comm_MV2(sendbuf, recvbuf,
+ MPIR_Reduce_scatter_non_comm_MV2(sendbuf, recvbuf,
recvcnts, datatype,
op, comm);
}
#include "smpi/smpi.h"
#include "smpi_f2c.hpp"
#include <string>
-#include <unordered_map>
+#include <map>
namespace simgrid{
namespace smpi{
class Info : public F2C{
private:
- std::unordered_map<std::string, std::string> map_;
+ std::map<std::string, std::string> map_;
int refcount_ = 1;
public:
#if HAVE_PAPI
container_t container =
#endif
- PJ_container_new(str, INSTR_SMPI, father);
+ new simgrid::instr::Container(str, simgrid::instr::INSTR_SMPI, father);
#if HAVE_PAPI
papi_counter_t counters = smpi_process()->papi_counters();
* Check whether this variable already exists or not. Otherwise, it will be created
* multiple times but only the last one would be used...
*/
- if (PJ_type_get_or_null(it.first.c_str(), container->type) == nullptr) {
- PJ_type_variable_new(it.first.c_str(), nullptr, container->type);
+ if (s_type::getOrNull(it.first.c_str(), container->type_) == nullptr) {
+ Type::variableNew(it.first.c_str(), nullptr, container->type_);
}
}
#endif
char str[INSTR_DEFAULT_STR_SIZE];
container_t container = PJ_container_get(smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE));
PJ_container_remove_from_parent (container);
- PJ_container_free (container);
+ delete container;
}
void TRACE_smpi_collective_in(int rank, const char *operation, instr_extra_data extra)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
const char *color = instr_find_color (operation);
- value* val = value::get_or_new(operation, color, type);
- new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new(operation, color, type);
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_collective_out(int rank, const char *operation)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
- new PopStateEvent (SIMIX_get_clock(), container, type);
+ new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type);
}
void TRACE_smpi_computing_init(int rank)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get(str);
- type_t type = PJ_type_get("MPI_STATE", container->type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
const char* color = instr_find_color("computing");
- new PushStateEvent(SIMIX_get_clock(), container, type, value::get_or_new("computing", color, type));
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type,
+ simgrid::instr::Value::get_or_new("computing", color, type));
}
void TRACE_smpi_computing_in(int rank, instr_extra_data extra)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
- value* val = value::get_or_new("computing", nullptr, type);
- new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("computing", nullptr, type);
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_computing_out(int rank)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
- new PopStateEvent (SIMIX_get_clock(), container, type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
+ new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type);
}
void TRACE_smpi_sleeping_init(int rank)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
const char *color = instr_find_color ("sleeping");
- value* val = value::get_or_new("sleeping", color, type);
- new PushStateEvent(SIMIX_get_clock(), container, type, val);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("sleeping", color, type);
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val);
}
void TRACE_smpi_sleeping_in(int rank, instr_extra_data extra)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
- value* val = value::get_or_new("sleeping", nullptr, type);
- new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("sleeping", nullptr, type);
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_sleeping_out(int rank)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
- new PopStateEvent (SIMIX_get_clock(), container, type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
+ new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type);
}
void TRACE_smpi_testing_in(int rank, instr_extra_data extra)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
- value* val = value::get_or_new("test", nullptr, type);
- new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new("test", nullptr, type);
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_testing_out(int rank)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
- new PopStateEvent (SIMIX_get_clock(), container, type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
+ new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type);
}
void TRACE_smpi_ptp_in(int rank, const char *operation, instr_extra_data extra)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
const char *color = instr_find_color (operation);
- value* val = value::get_or_new(operation, color, type);
- new PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
+ simgrid::instr::Value* val = simgrid::instr::Value::get_or_new(operation, color, type);
+ new simgrid::instr::PushStateEvent(SIMIX_get_clock(), container, type, val, static_cast<void*>(extra));
}
void TRACE_smpi_ptp_out(int rank, int dst, const char *operation)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(rank, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_STATE", container->type);
+ simgrid::instr::Type* type = PJ_type_get("MPI_STATE", container->type_);
- new PopStateEvent (SIMIX_get_clock(), container, type);
+ new simgrid::instr::PopStateEvent(SIMIX_get_clock(), container, type);
}
void TRACE_smpi_send(int rank, int src, int dst, int tag, int size)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(src, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root());
+ simgrid::instr::Type* type = PJ_type_get("MPI_LINK", PJ_type_get_root());
XBT_DEBUG("Send tracing from %d to %d, tag %d, with key %s", src, dst, tag, key);
- new StartLinkEvent (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key, size);
+ new simgrid::instr::StartLinkEvent(SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key, size);
}
void TRACE_smpi_recv(int src, int dst, int tag)
char str[INSTR_DEFAULT_STR_SIZE];
smpi_container(dst, str, INSTR_DEFAULT_STR_SIZE);
container_t container = PJ_container_get (str);
- type_t type = PJ_type_get ("MPI_LINK", PJ_type_get_root());
+ simgrid::instr::Type* type = PJ_type_get("MPI_LINK", PJ_type_get_root());
XBT_DEBUG("Recv tracing from %d to %d, tag %d, with key %s", src, dst, tag, key);
- new EndLinkEvent (SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key);
+ new simgrid::instr::EndLinkEvent(SIMIX_get_clock(), PJ_container_get_root(), type, container, "PTP", key);
}
// Load the copy and resolve the entry point:
void* handle = dlopen(target_executable.c_str(), RTLD_LAZY | RTLD_LOCAL | RTLD_DEEPBIND);
+ int saved_errno = errno;
if (xbt_cfg_get_boolean("smpi/keep-temps") == false)
unlink(target_executable.c_str());
if (handle == nullptr)
- xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), errno, strerror(errno));
+ xbt_die("dlopen failed: %s (errno: %d -- %s)", dlerror(), saved_errno, strerror(saved_errno));
smpi_entry_point_type entry_point = smpi_resolve_function(handle);
if (not entry_point)
xbt_die("Could not resolve entry point");
int smpi_is_privatization_file(char* file)
{
- const std::string buffer_path {"/dev/shm/my-buffer-"};
- return buffer_path.compare(file) == 0;
+ const std::string buffer_path("/dev/shm/my-buffer-");
+ return buffer_path.compare(0, std::string::npos, file, buffer_path.length()) == 0;
}
void smpi_initialize_global_memory_segments()
*newgroup = MPI_GROUP_EMPTY;
} else if (n == size_) {
*newgroup = this;
- if(this!= MPI_COMM_WORLD->group()
- && this != MPI_COMM_SELF->group()
- && this != MPI_GROUP_EMPTY)
- this->ref();
+ if (this != MPI_COMM_WORLD->group() && this != MPI_COMM_SELF->group() && this != MPI_GROUP_EMPTY)
+ this->ref();
} else {
*newgroup = new Group(n);
for (i = 0; i < n; i++) {
if (flag) {
finish_wait(request,status);
nsleeps=1;//reset the number of sleeps we will do next time
- if (*request != MPI_REQUEST_NULL && ((*request)->flags_ & PERSISTENT)==0)
- *request = MPI_REQUEST_NULL;
+ if (*request != MPI_REQUEST_NULL && ((*request)->flags_ & PERSISTENT) == 0)
+ *request = MPI_REQUEST_NULL;
} else if (xbt_cfg_get_boolean("smpi/grow-injected-times")){
nsleeps++;
}
status[index] = *pstat;
}
if (requests[index] != MPI_REQUEST_NULL && (requests[index]->flags_ & NON_PERSISTENT))
- requests[index]=MPI_REQUEST_NULL;
+ requests[index] = MPI_REQUEST_NULL;
}else{
return MPI_UNDEFINED;
}
}
XBT_DEBUG("Entering MPI_Compare_and_swap with %d", target_rank);
- MPI_Request req;
+ MPI_Request req = MPI_REQUEST_NULL;
xbt_mutex_acquire(send_win->atomic_mut_);
get(result_addr, 1, datatype, target_rank,
target_disp, 1, datatype, &req);
PRIVATIZE="--cfg=smpi/privatization:@HAVE_PRIVATIZATION@"
-SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI --cfg=network/TCP-gamma:4194304"
+SIMOPTS="--cfg=surf/precision:1e-9 --cfg=network/model:SMPI"
#usage to print the way this script should be called
usage () {
static container_t lowestCommonAncestor (container_t a1, container_t a2)
{
//this is only an optimization (since most of a1 and a2 share the same parent)
- if (a1->father == a2->father)
- return a1->father;
+ if (a1->father_ == a2->father_)
+ return a1->father_;
//create an array with all ancestors of a1
std::vector<container_t> ancestors_a1;
- container_t p = a1->father;
+ container_t p = a1->father_;
while (p){
ancestors_a1.push_back(p);
- p = p->father;
+ p = p->father_;
}
//create an array with all ancestors of a2
std::vector<container_t> ancestors_a2;
- p = a2->father;
+ p = a2->father_;
while (p){
ancestors_a2.push_back(p);
- p = p->father;
+ p = p->father_;
}
//find the lowest ancestor
static void linkContainers (container_t src, container_t dst, xbt_dict_t filter)
{
//ignore loopback
- if (strcmp (src->name, "__loopback__") == 0 || strcmp (dst->name, "__loopback__") == 0){
+ if (strcmp(src->name_, "__loopback__") == 0 || strcmp(dst->name_, "__loopback__") == 0) {
XBT_DEBUG (" linkContainers: ignoring loopback link");
return;
}
//check if we already register this pair (we only need one direction)
char aux1[INSTR_DEFAULT_STR_SIZE];
char aux2[INSTR_DEFAULT_STR_SIZE];
- snprintf (aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", src->name, dst->name);
- snprintf (aux2, INSTR_DEFAULT_STR_SIZE, "%s%s", dst->name, src->name);
+ snprintf(aux1, INSTR_DEFAULT_STR_SIZE, "%s%s", src->name_, dst->name_);
+ snprintf(aux2, INSTR_DEFAULT_STR_SIZE, "%s%s", dst->name_, src->name_);
if (xbt_dict_get_or_null (filter, aux1)){
- XBT_DEBUG (" linkContainers: already registered %s <-> %s (1)", src->name, dst->name);
+ XBT_DEBUG(" linkContainers: already registered %s <-> %s (1)", src->name_, dst->name_);
return;
}
if (xbt_dict_get_or_null (filter, aux2)){
- XBT_DEBUG (" linkContainers: already registered %s <-> %s (2)", dst->name, src->name);
+ XBT_DEBUG(" linkContainers: already registered %s <-> %s (2)", dst->name_, src->name_);
return;
}
//declare type
char link_typename[INSTR_DEFAULT_STR_SIZE];
- snprintf (link_typename, INSTR_DEFAULT_STR_SIZE, "%s-%s%s-%s%s",
- father->type->name,
- 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);
+ snprintf(link_typename, INSTR_DEFAULT_STR_SIZE, "%s-%s%s-%s%s", father->type_->name_, src->type_->name_,
+ src->type_->id_, dst->type_->name_, dst->type_->id_);
+ simgrid::instr::Type* link_type = simgrid::instr::Type::getOrNull(link_typename, father->type_);
if (link_type == nullptr){
- link_type = PJ_type_link_new (link_typename, father->type, src->type, dst->type);
+ link_type = simgrid::instr::Type::linkNew(link_typename, father->type_, src->type_, dst->type_);
}
//register EDGE types for triva configuration
- trivaEdgeTypes.insert(link_type->name);
+ trivaEdgeTypes.insert(link_type->name_);
//create the link
static long long counter = 0;
snprintf (key, INSTR_DEFAULT_STR_SIZE, "%lld", counter);
counter++;
- new StartLinkEvent(SIMIX_get_clock(), father, link_type, src, "topology", key);
- new EndLinkEvent(SIMIX_get_clock(), father, link_type, dst, "topology", key);
+ new simgrid::instr::StartLinkEvent(SIMIX_get_clock(), father, link_type, src, "topology", key);
+ new simgrid::instr::EndLinkEvent(SIMIX_get_clock(), father, link_type, dst, "topology", key);
- XBT_DEBUG (" linkContainers %s <-> %s", src->name, dst->name);
+ XBT_DEBUG(" linkContainers %s <-> %s", src->name_, dst->name_);
}
static void recursiveGraphExtraction(simgrid::s4u::NetZone* netzone, container_t container, xbt_dict_t filter)
if (not netzone->getChildren()->empty()) {
//bottom-up recursion
for (auto const& nz_son : *netzone->getChildren()) {
- container_t child_container = static_cast<container_t>(xbt_dict_get(container->children, nz_son->getCname()));
+ container_t child_container = static_cast<container_t>(xbt_dict_get(container->children_, nz_son->getCname()));
recursiveGraphExtraction(nz_son, child_container, filter);
}
}
if (PJ_container_get_root() == nullptr){
PJ_container_alloc ();
- container_t root = PJ_container_new (id, INSTR_AS, nullptr);
+ container_t root = new simgrid::instr::Container(id, simgrid::instr::INSTR_AS, nullptr);
PJ_container_set_root (root);
if (TRACE_smpi_is_enabled()) {
- type_t mpi = PJ_type_get_or_null ("MPI", root->type);
+ simgrid::instr::Type* mpi = simgrid::instr::Type::getOrNull("MPI", root->type_);
if (mpi == nullptr){
- mpi = PJ_type_container_new("MPI", root->type);
+ mpi = simgrid::instr::Type::containerNew("MPI", root->type_);
if (not TRACE_smpi_is_grouped())
- PJ_type_state_new ("MPI_STATE", mpi);
- PJ_type_link_new ("MPI_LINK", PJ_type_get_root(), mpi, mpi);
+ simgrid::instr::Type::stateNew("MPI_STATE", mpi);
+ simgrid::instr::Type::linkNew("MPI_LINK", PJ_type_get_root(), mpi, mpi);
}
}
if (TRACE_needs_platform()){
container_t father = currentContainer.back();
- container_t container = PJ_container_new (id, INSTR_AS, father);
+ container_t container = new simgrid::instr::Container(id, simgrid::instr::INSTR_AS, father);
currentContainer.push_back(container);
}
}
double bandwidth_value = link.bandwidth();
double latency_value = link.latency();
- container_t container = PJ_container_new(link.name(), INSTR_LINK, father);
+ container_t container = new simgrid::instr::Container(link.name(), simgrid::instr::INSTR_LINK, father);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_link())) {
- type_t bandwidth = PJ_type_get_or_null("bandwidth", container->type);
+ simgrid::instr::Type* bandwidth = simgrid::instr::Type::getOrNull("bandwidth", container->type_);
if (bandwidth == nullptr) {
- bandwidth = PJ_type_variable_new("bandwidth", nullptr, container->type);
+ bandwidth = simgrid::instr::Type::variableNew("bandwidth", nullptr, container->type_);
}
- type_t latency = PJ_type_get_or_null("latency", container->type);
+ simgrid::instr::Type* latency = simgrid::instr::Type::getOrNull("latency", container->type_);
if (latency == nullptr) {
- latency = PJ_type_variable_new("latency", nullptr, container->type);
+ latency = simgrid::instr::Type::variableNew("latency", nullptr, container->type_);
}
- new SetVariableEvent(0, container, bandwidth, bandwidth_value);
- new SetVariableEvent(0, container, latency, latency_value);
+ new simgrid::instr::SetVariableEvent(0, container, bandwidth, bandwidth_value);
+ new simgrid::instr::SetVariableEvent(0, container, latency, latency_value);
}
if (TRACE_uncategorized()) {
- type_t bandwidth_used = PJ_type_get_or_null("bandwidth_used", container->type);
+ simgrid::instr::Type* bandwidth_used = simgrid::instr::Type::getOrNull("bandwidth_used", container->type_);
if (bandwidth_used == nullptr) {
- PJ_type_variable_new("bandwidth_used", "0.5 0.5 0.5", container->type);
+ simgrid::instr::Type::variableNew("bandwidth_used", "0.5 0.5 0.5", container->type_);
}
}
}
static void sg_instr_new_host(simgrid::s4u::Host& host)
{
container_t father = currentContainer.back();
- container_t container = PJ_container_new(host.getCname(), INSTR_HOST, father);
+ container_t container = new simgrid::instr::Container(host.getCname(), simgrid::instr::INSTR_HOST, father);
if ((TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) && (not TRACE_disable_speed())) {
- type_t speed = PJ_type_get_or_null ("power", container->type);
+ simgrid::instr::Type* speed = simgrid::instr::Type::getOrNull("power", container->type_);
if (speed == nullptr){
- speed = PJ_type_variable_new ("power", nullptr, container->type);
+ speed = simgrid::instr::Type::variableNew("power", nullptr, container->type_);
}
double current_speed_state = host.getSpeed();
- new SetVariableEvent (0, container, speed, current_speed_state);
+ new simgrid::instr::SetVariableEvent(0, container, speed, current_speed_state);
}
if (TRACE_uncategorized()){
- type_t speed_used = PJ_type_get_or_null ("power_used", container->type);
+ simgrid::instr::Type* speed_used = simgrid::instr::Type::getOrNull("power_used", container->type_);
if (speed_used == nullptr){
- PJ_type_variable_new ("power_used", "0.5 0.5 0.5", container->type);
+ simgrid::instr::Type::variableNew("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);
+ simgrid::instr::Type* mpi = simgrid::instr::Type::getOrNull("MPI", container->type_);
if (mpi == nullptr){
- mpi = PJ_type_container_new("MPI", container->type);
- PJ_type_state_new ("MPI_STATE", mpi);
+ mpi = simgrid::instr::Type::containerNew("MPI", container->type_);
+ simgrid::instr::Type::stateNew("MPI_STATE", mpi);
}
}
if (TRACE_msg_process_is_enabled()) {
- type_t msg_process = PJ_type_get_or_null ("MSG_PROCESS", container->type);
+ simgrid::instr::Type* msg_process = simgrid::instr::Type::getOrNull("MSG_PROCESS", container->type_);
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);
- value PJ_value("suspend", "1 0 1", state);
- value::get_or_new("sleep", "1 1 0", state);
- value::get_or_new("receive", "1 0 0", state);
- value::get_or_new("send", "0 0 1", state);
- value::get_or_new("task_execute", "0 1 1", state);
- PJ_type_link_new ("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process);
- PJ_type_link_new ("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process);
+ msg_process = simgrid::instr::Type::containerNew("MSG_PROCESS", container->type_);
+ simgrid::instr::Type* state = simgrid::instr::Type::stateNew("MSG_PROCESS_STATE", msg_process);
+ simgrid::instr::Value PJ_value("suspend", "1 0 1", state);
+ simgrid::instr::Value::get_or_new("sleep", "1 1 0", state);
+ simgrid::instr::Value::get_or_new("receive", "1 0 0", state);
+ simgrid::instr::Value::get_or_new("send", "0 0 1", state);
+ simgrid::instr::Value::get_or_new("task_execute", "0 1 1", state);
+ simgrid::instr::Type::linkNew("MSG_PROCESS_LINK", PJ_type_get_root(), msg_process, msg_process);
+ simgrid::instr::Type::linkNew("MSG_PROCESS_TASK_LINK", PJ_type_get_root(), msg_process, msg_process);
}
}
if (TRACE_msg_vm_is_enabled()) {
- type_t msg_vm = PJ_type_get_or_null ("MSG_VM", container->type);
+ simgrid::instr::Type* msg_vm = simgrid::instr::Type::getOrNull("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);
- value PJ_value("suspend", "1 0 1", state);
- value::get_or_new("sleep", "1 1 0", state);
- value::get_or_new("receive", "1 0 0", state);
- value::get_or_new("send", "0 0 1", state);
- value::get_or_new("task_execute", "0 1 1", state);
- PJ_type_link_new ("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm);
- PJ_type_link_new ("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm);
+ msg_vm = simgrid::instr::Type::containerNew("MSG_VM", container->type_);
+ simgrid::instr::Type* state = simgrid::instr::Type::stateNew("MSG_VM_STATE", msg_vm);
+ simgrid::instr::Value PJ_value("suspend", "1 0 1", state);
+ simgrid::instr::Value::get_or_new("sleep", "1 1 0", state);
+ simgrid::instr::Value::get_or_new("receive", "1 0 0", state);
+ simgrid::instr::Value::get_or_new("send", "0 0 1", state);
+ simgrid::instr::Value::get_or_new("task_execute", "0 1 1", state);
+ simgrid::instr::Type::linkNew("MSG_VM_LINK", PJ_type_get_root(), msg_vm, msg_vm);
+ simgrid::instr::Type::linkNew("MSG_VM_PROCESS_LINK", PJ_type_get_root(), msg_vm, msg_vm);
}
}
return;
if (TRACE_is_enabled() && TRACE_needs_platform()) {
container_t father = currentContainer.back();
- PJ_container_new(netpoint->cname(), INSTR_ROUTER, father);
+ new simgrid::instr::Container(netpoint->cname(), simgrid::instr::INSTR_ROUTER, father);
}
}
/*
* user categories support
*/
-static void recursiveNewVariableType (const char *new_typename, const char *color, type_t root)
+static void recursiveNewVariableType(const char* new_typename, const char* color, simgrid::instr::Type* root)
{
- if (not strcmp(root->name, "HOST")) {
+ if (not strcmp(root->name_, "HOST")) {
char tnstr[INSTR_DEFAULT_STR_SIZE];
snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename);
- PJ_type_variable_new (tnstr, color, root);
+ simgrid::instr::Type::variableNew(tnstr, color, root);
}
- if (not strcmp(root->name, "MSG_VM")) {
+ if (not strcmp(root->name_, "MSG_VM")) {
char tnstr[INSTR_DEFAULT_STR_SIZE];
snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "p%s", new_typename);
- PJ_type_variable_new (tnstr, color, root);
+ simgrid::instr::Type::variableNew(tnstr, color, root);
}
- if (not strcmp(root->name, "LINK")) {
+ if (not strcmp(root->name_, "LINK")) {
char tnstr[INSTR_DEFAULT_STR_SIZE];
snprintf (tnstr, INSTR_DEFAULT_STR_SIZE, "b%s", new_typename);
- PJ_type_variable_new (tnstr, color, root);
+ simgrid::instr::Type::variableNew(tnstr, color, root);
}
xbt_dict_cursor_t cursor = nullptr;
- type_t child_type;
+ simgrid::instr::Type* child_type;
char *name;
- xbt_dict_foreach(root->children, cursor, name, child_type) {
+ xbt_dict_foreach (root->children_, cursor, name, child_type) {
recursiveNewVariableType (new_typename, color, child_type);
}
}
recursiveNewVariableType (new_typename, color, PJ_type_get_root());
}
-static void recursiveNewUserVariableType (const char *father_type, const char *new_typename, const char *color, type_t root)
+static void recursiveNewUserVariableType(const char* father_type, const char* new_typename, const char* color,
+ simgrid::instr::Type* root)
{
- if (not strcmp(root->name, father_type)) {
- PJ_type_variable_new (new_typename, color, root);
+ if (not strcmp(root->name_, father_type)) {
+ simgrid::instr::Type::variableNew(new_typename, color, root);
}
xbt_dict_cursor_t cursor = nullptr;
- type_t child_type;
+ simgrid::instr::Type* child_type;
char *name;
- xbt_dict_foreach(root->children, cursor, name, child_type) {
+ xbt_dict_foreach (root->children_, cursor, name, child_type) {
recursiveNewUserVariableType (father_type, new_typename, color, child_type);
}
}
recursiveNewUserVariableType (father_type, new_typename, color, PJ_type_get_root());
}
-static void recursiveNewUserStateType (const char *father_type, const char *new_typename, type_t root)
+static void recursiveNewUserStateType(const char* father_type, const char* new_typename, simgrid::instr::Type* root)
{
- if (not strcmp(root->name, father_type)) {
- PJ_type_state_new (new_typename, root);
+ if (not strcmp(root->name_, father_type)) {
+ simgrid::instr::Type::stateNew(new_typename, root);
}
xbt_dict_cursor_t cursor = nullptr;
- type_t child_type;
+ simgrid::instr::Type* child_type;
char *name;
- xbt_dict_foreach(root->children, cursor, name, child_type) {
+ xbt_dict_foreach (root->children_, cursor, name, child_type) {
recursiveNewUserStateType (father_type, new_typename, child_type);
}
}
recursiveNewUserStateType (father_type, new_typename, PJ_type_get_root());
}
-static void recursiveNewValueForUserStateType(const char* type_name, const char* val, const char* color, type_t root)
+static void recursiveNewValueForUserStateType(const char* type_name, const char* val, const char* color,
+ simgrid::instr::Type* root)
{
- if (not strcmp(root->name, type_name)) {
- value PJ_value(val, color, root);
+ if (not strcmp(root->name_, type_name)) {
+ simgrid::instr::Value PJ_value(val, color, root);
}
xbt_dict_cursor_t cursor = nullptr;
- type_t child_type;
+ simgrid::instr::Type* child_type;
char *name;
- xbt_dict_foreach(root->children, cursor, name, child_type) {
+ xbt_dict_foreach (root->children_, cursor, name, child_type) {
recursiveNewValueForUserStateType(type_name, val, color, child_type);
}
}
//bottom-up recursion
for (auto const& netzone_child : *netzone->getChildren()) {
container_t child_container =
- static_cast<container_t>(xbt_dict_get(container->children, netzone_child->getCname()));
+ static_cast<container_t>(xbt_dict_get(container->children_, netzone_child->getCname()));
recursiveXBTGraphExtraction(graph, nodes, edges, netzone_child, child_container);
}
}
{
if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) {
container_t container = PJ_container_get(resource);
- type_t type = PJ_type_get ("power", container->type);
- new SetVariableEvent(date, container, type, speed);
+ simgrid::instr::Type* type = PJ_type_get("power", container->type_);
+ new simgrid::instr::SetVariableEvent(date, container, type, speed);
}
}
{
if (TRACE_categorized() || TRACE_uncategorized() || TRACE_platform()) {
container_t container = PJ_container_get(resource);
- type_t type = PJ_type_get ("bandwidth", container->type);
- new SetVariableEvent(date, container, type, bandwidth);
+ simgrid::instr::Type* type = PJ_type_get("bandwidth", container->type_);
+ new simgrid::instr::SetVariableEvent(date, container, type, bandwidth);
}
}
maxminSystem_->solve_fun = specificSolveFun;
}
-LinkImpl* NetworkCm02Model::createLink(const char* name, double bandwidth, double latency,
+LinkImpl* NetworkCm02Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
return new NetworkCm02Link(this, name, bandwidth, latency, policy, maxminSystem_);
/************
* Resource *
************/
-NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
+NetworkCm02Link::NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy, lmm_system_t system)
: LinkImpl(model, name, lmm_constraint_new(system, this, sg_bandwidth_factor * bandwidth))
{
NetworkCm02Model();
explicit NetworkCm02Model(void (*solve_fun)(lmm_system_t self));
virtual ~NetworkCm02Model() = default;
- LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
void updateActionsStateLazy(double now, double delta) override;
void updateActionsStateFull(double now, double delta) override;
class NetworkCm02Link : public LinkImpl {
public:
- NetworkCm02Link(NetworkCm02Model* model, const char* name, double bandwidth, double latency,
+ NetworkCm02Link(NetworkCm02Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy, lmm_system_t system);
virtual ~NetworkCm02Link() = default;
void apply_event(tmgr_trace_event_t event, double value) override;
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
namespace simgrid {
namespace surf {
-LinkImpl* NetworkConstantModel::createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy)
+LinkImpl* NetworkConstantModel::createLink(const std::string& name, double bw, double lat,
+ e_surf_link_sharing_policy_t policy)
{
xbt_die("Refusing to create the link %s: there is no link in the Constant network model. "
"Please remove any link from your platform (and switch to routing='None')",
- name);
+ name.c_str());
return nullptr;
}
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2013-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
double nextOccuringEvent(double now) override;
void updateActionsState(double now, double delta) override;
- LinkImpl* createLink(const char* name, double bw, double lat, e_surf_link_sharing_policy_t policy) override;
+ LinkImpl* createLink(const std::string& name, double bw, double lat,
+ e_surf_link_sharing_policy_t policy) override;
};
/**********
* Resource *
************/
- LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint)
+ LinkImpl::LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, lmm_constraint_t constraint)
: Resource(model, name, constraint), piface_(this)
{
- if (strcmp(name,"__loopback__"))
- xbt_assert(not LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name);
+ if (name != "__loopback__")
+ xbt_assert(not LinkImpl::byName(name), "Link '%s' declared several times in the platform.", name.c_str());
latency_.scale = 1;
bandwidth_.scale = 1;
links->insert({name, this});
- XBT_DEBUG("Create link '%s'",name);
-
+ XBT_DEBUG("Create link '%s'", name.c_str());
}
/** @brief use destroy() instead of this destructor */
* @param latency The initial latency of the Link in seconds
* @param policy The sharing policy of the Link
*/
- virtual LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ virtual LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) = 0;
/**
*/
class LinkImpl : public simgrid::surf::Resource, public simgrid::surf::PropertyHolder {
protected:
- LinkImpl(simgrid::surf::NetworkModel* model, const char* name, lmm_constraint_t constraint);
+ LinkImpl(simgrid::surf::NetworkModel* model, const std::string& name, lmm_constraint_t constraint);
~LinkImpl() override;
public:
NetworkNS3Model::NetworkNS3Model() : NetworkModel() {
NetPointNs3::EXTENSION_ID = simgrid::kernel::routing::NetPoint::extension_create<NetPointNs3>();
+ flowFromSock = xbt_dict_new_homogeneous([](void* p) { delete static_cast<SgFlow*>(p); });
ns3_initialize(ns3_tcp_model.get().c_str());
simgrid::kernel::routing::NetPoint::onCreation.connect([](simgrid::kernel::routing::NetPoint* pt) {
xbt_dict_free(&flowFromSock);
}
-LinkImpl* NetworkNS3Model::createLink(const char* name, double bandwidth, double latency,
+LinkImpl* NetworkNS3Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
return new LinkNS3(this, name, bandwidth, latency);
xbt_dynar_pop(socket_to_destroy,&ns3Socket);
if (XBT_LOG_ISENABLED(ns3, xbt_log_priority_debug)) {
- SgFlow *flow = (SgFlow*)xbt_dict_get (flowFromSock, ns3Socket);
+ SgFlow* flow = static_cast<SgFlow*>(xbt_dict_get(flowFromSock, ns3Socket));
XBT_DEBUG ("Removing socket %p of action %p", ns3Socket, flow->action_);
}
xbt_dict_remove(flowFromSock, ns3Socket);
* Resource *
************/
-LinkNS3::LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency)
+LinkNS3::LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwidth, double latency)
: LinkImpl(model, name, nullptr)
{
bandwidth_.peak = bandwidth;
public:
NetworkNS3Model();
~NetworkNS3Model();
- LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
double nextOccuringEvent(double now) override;
************/
class LinkNS3 : public LinkImpl {
public:
- explicit LinkNS3(NetworkNS3Model* model, const char* name, double bandwidth, double latency);
+ explicit LinkNS3(NetworkNS3Model* model, const std::string& name, double bandwidth, double latency);
~LinkNS3();
void apply_event(tmgr_trace_event_t event, double value) override;
#include <algorithm>
-xbt_dict_t flowFromSock = xbt_dict_new_homogeneous([](void *p) {
- delete (SgFlow*)p;
-}); // ns3::sock -> SgFlow
+xbt_dict_t flowFromSock = nullptr; // ns3::sock -> SgFlow
static void receive_callback(ns3::Ptr<ns3::Socket> socket);
static void datasent_callback(ns3::Ptr<ns3::Socket> socket, uint32_t dataSent);
-/* Copyright (c) 2007-2010, 2013-2015. The SimGrid Team.
+/* Copyright (c) 2007-2010, 2013-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
return new CpuL07(this, host, speedPerPstate, core);
}
-LinkImpl* NetworkL07Model::createLink(const char* name, double bandwidth, double latency,
+LinkImpl* NetworkL07Model::createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
{
return new LinkL07(this, name, bandwidth, latency, policy);
CpuL07::~CpuL07()=default;
-LinkL07::LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
+LinkL07::LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
: LinkImpl(model, name, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth))
{
-/* Copyright (c) 2013-2015. The SimGrid Team.
+/* Copyright (c) 2013-2017. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
public:
NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys);
~NetworkL07Model();
- LinkImpl* createLink(const char* name, double bandwidth, double latency,
+ LinkImpl* createLink(const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy) override;
Action* communicate(s4u::Host* src, s4u::Host* dst, double size, double rate) override;
class LinkL07 : public LinkImpl {
public:
- LinkL07(NetworkL07Model* model, const char* name, double bandwidth, double latency,
+ LinkL07(NetworkL07Model* model, const std::string& name, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy);
~LinkL07() override;
bool isUsed() override;
}
for (auto const& link_name : names) {
simgrid::surf::LinkImpl* l =
- surf_network_model->createLink(link_name.c_str(), link->bandwidth, link->latency, link->policy);
+ surf_network_model->createLink(link_name, link->bandwidth, link->latency, link->policy);
if (link->properties) {
for (auto const& elm : *link->properties)
l->setProperty(elm.first, elm.second);
- delete link->properties;
}
if (link->latency_trace)
if (link->state_trace)
l->setStateTrace(link->state_trace);
}
+ delete link->properties;
}
void sg_platf_new_cluster(ClusterCreationArgs* cluster)
XBT_DEBUG("<router id=\"%s\"/>", cluster->router_id.c_str());
if (cluster->router_id.empty()) {
std::string newid = std::string(cluster->prefix) + cluster->id + "_router" + cluster->suffix;
- current_as->router_ = sg_platf_new_router(newid.c_str(), NULL);
+ current_as->router_ = sg_platf_new_router(newid, NULL);
} else {
current_as->router_ = sg_platf_new_router(cluster->router_id, NULL);
}
namespace simgrid {
namespace surf {
-Resource::Resource(Model* model, const char* name, lmm_constraint_t constraint)
+Resource::Resource(Model* model, const std::string& name, lmm_constraint_t constraint)
: name_(name), model_(model), constraint_(constraint)
{}
* @param name The name of the Resource
* @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
*/
- Resource(Model *model, const char *name, lmm_constraint_t constraint);
+ Resource(Model * model, const std::string& name, lmm_constraint_t constraint);
virtual ~Resource();
}
namespace std {
- template <>
- struct hash<simgrid::surf::Resource>
- {
- std::size_t operator()(const simgrid::surf::Resource& r) const
- {
- return (std::size_t) xbt_str_hash(r.cname());
- }
+template <> class hash<simgrid::surf::Resource> {
+public:
+ std::size_t operator()(const simgrid::surf::Resource& r) const { return (std::size_t)xbt_str_hash(r.cname()); }
};
}
#include "xbt/cunit.h"
#include "xbt/dynar.h"
+#define STRLEN 1024
+
/* collection of all suites */
static xbt_dynar_t _xbt_test_suites = nullptr;
/* global statistics */
/* for the parsing */
char *sel = selection;
int done = 0;
- char dir[1024]; /* the directive */
+ char dir[STRLEN]; /* the directive */
/* iterators */
unsigned int it_suite;
xbt_test_suite_t suite;
xbt_test_unit_t unit;
unsigned int it_unit;
- char suitename[512];
- char unitname[512];
+ char suitename[STRLEN];
+ char unitname[STRLEN];
if (not selection || selection[0] == '\0')
return;
char *p = strchr(sel, ',');
if (p) {
- strncpy(dir, sel, p - sel);
- dir[p - sel] = '\0';
+ snprintf(dir, STRLEN, "%.*s", (int)(p - sel), sel);
sel = p + 1;
} else {
- strncpy(dir, sel,1024);
+ snprintf(dir, STRLEN, "%s", sel);
done = 1;
}
p = strchr(dir, ':');
if (p) {
- strncpy(unitname, p + 1,512);
- strncpy(suitename, dir, p - dir);
- suitename[p - dir] = '\0';
+ snprintf(suitename, STRLEN, "%.*s", (int)(p - dir), dir);
+ snprintf(unitname, STRLEN, "%s", p + 1);
} else {
- strncpy(suitename, dir,512);
+ snprintf(suitename, STRLEN, "%s", dir);
unitname[0] = '\0';
}
} else {
xbt_test_log("Seen #%d: %s", ++i, key);
}
- xbt_test_assert(not data || not strcmp(key, data), "Key(%s) != value(%s). Aborting", key, data);
+ xbt_test_assert(key && data && strcmp(key, data) == 0, "Key(%s) != value(%s). Aborting", key, data);
}
}
/* RETRIEVE */
xbt_test_add("Search 123");
char* data = (char*)xbt_dict_get(head, "123");
- xbt_test_assert(data);
- xbt_test_assert(not strcmp("123", data));
+ xbt_test_assert(data && strcmp("123", data) == 0);
search_not_found(head, "Can't be found");
search_not_found(head, "123 Can't be found");
xbt_test_log("Seen: %s", key);
}
- if (not strcmp(key, "null"))
+ if (key && strcmp(key, "null") == 0)
found = 1;
}
xbt_test_assert(found, "the key 'null', associated to nullptr is not found");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_ex, xbt, "Exception mechanism");
+// Don't define ~xbt_ex() in ex.hpp. It is defined here to ensure that there is an unique definition of xt_ex in
+// libsimgrid, but not in libsimgrid-java. Otherwise, sone tests are broken (seen with clang/libc++ on freebsd).
+xbt_ex::~xbt_ex() = default;
+
void _xbt_throw(char* message, xbt_errcat_t errcat, int value, const char* file, int line, const char* func)
{
xbt_ex e(simgrid::xbt::ThrowPoint(file, line, func), message);
" -> warning: minor issue encountered\n"
" -> error: issue encountered\n"
" -> critical: major issue encountered\n"
+ " The default priority level is 'info'.\n"
"\n"
- " Format configuration: --log=CATEGORY_NAME.fmt:OPTIONS\n"
- " OPTIONS may be:\n"
+ " Format configuration: --log=CATEGORY_NAME.fmt:FORMAT\n"
+ " FORMAT string may contain:\n"
" -> %%%%: the %% char\n"
" -> %%n: platform-dependent line separator (LOG4J compatible)\n"
" -> %%e: plain old space (SimGrid extension)\n"
}
}
-
-void mmcheck(xbt_mheap_t heap) {return;
- if (!heap->heapinfo)
- return;
- malloc_info* heapinfo = NULL;
- for (size_t i=1; i < heap->heaplimit; i += mmalloc_get_increment(heapinfo)) {
- heapinfo = heap->heapinfo + i;
- switch (heapinfo->type) {
- case MMALLOC_TYPE_HEAPINFO:
- case MMALLOC_TYPE_FREE:
- if (heapinfo->free_block.size==0) {
- xbt_die("Block size == 0");
- }
- break;
- case MMALLOC_TYPE_UNFRAGMENTED:
- if (heapinfo->busy_block.size==0) {
- xbt_die("Block size == 0");
- }
- if (heapinfo->busy_block.busy_size==0 && heapinfo->busy_block.size!=0) {
- xbt_die("Empty busy block");
- }
- break;
- default:
- if (heapinfo->type<0) {
- xbt_die("Unkown mmalloc block type.");
- }
- }
- }
-}
}
}
-XBT_PRIVATE void mmcheck(xbt_mheap_t heap);
-
XBT_PRIVATE int malloc_use_mmalloc(void);
XBT_PRIVATE int mmalloc_exec_using_mm(int argc, const char** argv);
if ((char *) ptr < (char *) mdp->heapbase || BLOCK(ptr) > mdp->heapsize) {
printf("FIXME. Ouch, this pointer is not mine, refusing to proceed (another solution would be to malloc "
"it instead of reallocing it, see source code)\n");
- result = mmalloc(mdp, size);
abort();
- return result;
}
size_t requested_size = size; // The amount of memory requested by user, for real
case 'm': { /* user-provided message; LOG4J compliant */
int sz;
set_sz_from_precision();
- int len = vsnprintf(p, sz, msg_fmt, ev->ap);
+ va_list ap;
+ va_copy(ap, ev->ap);
+ int len = vsnprintf(p, sz, msg_fmt, ap);
+ va_end(ap);
check_overflow(MIN(sz, len));
break;
}
#include "src/internal_config.h"
#include <cstdio>
#ifdef _WIN32
-#include <csignal> /* To silence MSVC on abort() */
+# include <csignal> /* To silence MSVC on abort() */
#endif
#if HAVE_UNISTD_H
-# include <unistd.h>
+# include <unistd.h>
#endif
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(module, xbt, "module handling");
#elif HAVE_SYSCONF
xbt_pagesize = sysconf(_SC_PAGESIZE);
#else
- #error Cannot get page size.
+# error Cannot get page size.
#endif
xbt_pagebits = log2(xbt_pagesize);
# Smpi Alltoall collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test allgather
int* sb = (int *) xbt_malloc(recv_counts[rank] * sizeof(int));
int* rb = (int *) xbt_malloc(recv_sb_size * sizeof(int));
- for (i = 0; i < recv_counts[rank]; ++i)
- sb[i] = recv_disps[rank] + i;
- for (i = 0; i < recv_sb_size; ++i)
- rb[i] = -1;
-
printf("[%d] sndbuf=[", rank);
- for (i = 0; i < recv_counts[rank]; i++)
+ for (i = 0; i < recv_counts[rank]; i++){
+ sb[i] = recv_disps[rank] + i;
printf("%d ", sb[i]);
+ }
printf("]\n");
+ for (i = 0; i < recv_sb_size; i++)
+ rb[i] = -1;
+
status = MPI_Allgatherv(sb, recv_counts[rank], MPI_INT, rb, recv_counts, recv_disps, MPI_INT, MPI_COMM_WORLD);
printf("[%d] rcvbuf=[", rank);
# Smpi Allgatherv collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test allgatherv
# Smpi Allreduce collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
p Test allreduce
! output sort
# Smpi Allreduce collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
! timeout 20
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
if (maxlen > 1)
- mult = size;
+ mult = maxlen > size ? size : maxlen;
int* sb = (int *) xbt_malloc(size *maxlen * sizeof(int));
int* rb = (int *) xbt_malloc(size *maxlen * sizeof(int));
# Smpi Allreduce collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test allreduce
# Smpi Alltoall on various cluster files, with several routings
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test classic - backbone
# Smpi Alltoall collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test all to all
/* Create the buffer */
MPI_Comm_size(comm, &size);
+ if(size<=0){
+ printf("error : comm size <= 0, run with mpirun\n");
+ return -1;
+ }
MPI_Comm_rank(comm, &rank);
int* sbuf = (int *) xbt_malloc(size * size * sizeof(int));
int* rbuf = (int *) xbt_malloc(size * size * sizeof(int));
# Smpi Alltoall collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test all to all
# Smpi scatter collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test barrier
p Test Broadcast with more processes than hosts
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile_coll -platform ../../../examples/platforms/small_platform.xml -np 16 --log=xbt_cfg.thres:critical ${bindir:=.}/coll-bcast --log=smpi_kernel.thres:warning --log=smpi_coll.thres:error
# Smpi Alltoall collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
! timeout 30
# Smpi reduce scatter collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test reduce_scatter
# Smpi Allreduce collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test allreduce
# Smpi scatter collectives tests
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
p Test scatter
p Test compute
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
! timeout 5
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/macro-partial-shared-communication --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
p Test compute
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
! timeout 5
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/macro-partial-shared --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
p Test compute
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
! timeout 5
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/macro-shared --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
p Test privatization
-! setenv LD_LIBRARY_PATH=../../lib
! timeout 5
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 32 ${bindir:=.}/privatization --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/privatization:1 --log=simix_context.thres:error --log=xbt_memory_map.thres:critical
> You requested to use 32 ranks, but there is only 5 processes in your hostfile...
p Test privatization with dlopen
-! setenv LD_LIBRARY_PATH=../../lib
! timeout 5
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 32 ${bindir:=.}/privatization --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning --cfg=smpi/privatization:dlopen --log=simix_context.thres:error
> You requested to use 32 ranks, but there is only 5 processes in your hostfile...
p Test dsend
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
> [Jupiter:1:(2) 0.000000] [dsend/INFO] rank 1: data exchanged
p message size is 4 bytes
p process 1 will finish at 0.5+2*4 (send) + 1+0.1*4 (isend) = 9.9s
p process 2 will finish at 0.5+2*4 (time before first send) + 2*(1+0.5*4) (recv+irecv) + 0.005890 (network time, same as before) = 14.505890s
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/pt2pt-dsend -q --log=smpi_kernel.thres:warning --cfg=smpi/or:0:1:0.5 --cfg=smpi/os:0:0.5:2 --cfg=smpi/ois:0:1:0.1 --log=xbt_cfg.thres:warning
> [Jupiter:1:(2) 9.900000] [dsend/INFO] rank 1: data exchanged
p Test output of time independent tracing
p generate a trace with pingpong, and replay itself, then check that output trace of the second run is the same as in the first (once sorted)
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -trace-ti --cfg=tracing/filename:out_in_ti.txt --cfg=smpi/simulate-computation:no -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
>
-! setenv LD_LIBRARY_PATH=../../lib
! expect return 1
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -hostfile ../hostfile_empty -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning
> [smpirun] ** error: the hostfile '../hostfile_empty' is empty. Aborting.
p Test pingpong
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 4 ${bindir:=.}/pt2pt-pingpong -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
> *** Ping-pong test (MPI_Send/MPI_Recv) ***
p Test timers
-! setenv LD_LIBRARY_PATH=../../lib
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 1 ${bindir:=.}/timers -q --log=smpi_kernel.thres:warning --cfg=smpi/simulate-computation:no --cfg=smpi/host-speed:100000 --log=xbt_cfg.thres:warning
> [rank 0] -> Tremblay
p Test hvector
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-hvector -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
> [rank 0] -> Tremblay
p Test indexed
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-indexed -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
> [rank 0] -> Tremblay
p Test struct
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-struct -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
> [rank 0] -> Tremblay
p Test vector
-! setenv LD_LIBRARY_PATH=../../lib
! output sort
$ ${bindir:=.}/../../../smpi_script/bin/smpirun -map -hostfile ../hostfile -platform ${srcdir:=.}/../../../examples/platforms/small_platform.xml -np 2 ${bindir:=.}/type-vector -q --log=smpi_kernel.thres:warning --log=xbt_cfg.thres:warning
> [rank 0] -> Tremblay
#include <xbt/parmap.hpp>
#include <cstdlib>
-#include <iomanip>
-#include <iostream>
#include <numeric> // std::iota
#include <string>
#include <vector>
+XBT_LOG_NEW_DEFAULT_CATEGORY(parmap_bench, "Bench for parmap");
+
#define MODES_DEFAULT 0x7
#define TIMEOUT 10.0
#define ARRAY_SIZE 10007
return name;
}
-static bool parmap_skip_mode(e_xbt_parmap_mode_t mode)
-{
- if (mode == XBT_PARMAP_FUTEX && not HAVE_FUTEX_H) {
- std::cout << "not available\n";
- return true;
- } else {
- return false;
- }
-}
-
static unsigned fibonacci(unsigned n)
{
if (n < 2)
*arg = fibonacci(*arg % FIBO_MAX);
}
-static void bench_parmap_full(int nthreads, e_xbt_parmap_mode_t mode)
+static void bench_parmap(int nthreads, e_xbt_parmap_mode_t mode, bool full_bench)
{
- std::cout << "** mode = " << std::left << std::setw(15) << parmap_mode_name(mode) << " ";
- std::cout.flush();
-
- if (parmap_skip_mode(mode))
- return;
+ XBT_INFO("** mode = %s", parmap_mode_name(mode).c_str());
- std::vector<unsigned> a(ARRAY_SIZE);
- std::vector<unsigned*> data(ARRAY_SIZE);
- std::iota(begin(a), end(a), 0);
- std::iota(begin(data), end(data), &a[0]);
-
- int i = 0;
- double start_time = xbt_os_time();
- double elapsed_time;
- do {
- {
- simgrid::xbt::Parmap<unsigned*> parmap(nthreads, mode);
- parmap.apply(fun_to_apply, data);
- } // enclosing block to ensure that the parmap is destroyed here.
- elapsed_time = xbt_os_time() - start_time;
- i++;
- } while (elapsed_time < TIMEOUT);
-
- std::cout << "ran " << i << " times in " << elapsed_time << " seconds (" << (i / elapsed_time) << "/s)\n";
-}
-
-static void bench_parmap_apply(int nthreads, e_xbt_parmap_mode_t mode)
-{
- std::cout << "** mode = " << std::left << std::setw(15) << parmap_mode_name(mode) << " ";
- std::cout.flush();
-
- if (parmap_skip_mode(mode))
+ if (mode == XBT_PARMAP_FUTEX && not HAVE_FUTEX_H) {
+ XBT_INFO(" not available");
return;
+ }
std::vector<unsigned> a(ARRAY_SIZE);
std::vector<unsigned*> data(ARRAY_SIZE);
std::iota(begin(a), end(a), 0);
std::iota(begin(data), end(data), &a[0]);
- simgrid::xbt::Parmap<unsigned*> parmap(nthreads, mode);
+ auto* parmap = new simgrid::xbt::Parmap<unsigned*>(nthreads, mode);
int i = 0;
double start_time = xbt_os_time();
double elapsed_time;
do {
- parmap.apply(fun_to_apply, data);
+ if (full_bench) {
+ delete parmap;
+ parmap = new simgrid::xbt::Parmap<unsigned*>(nthreads, mode);
+ }
+ parmap->apply(fun_to_apply, data);
elapsed_time = xbt_os_time() - start_time;
i++;
} while (elapsed_time < TIMEOUT);
+ delete parmap;
- std::cout << "ran " << i << " times in " << elapsed_time << " seconds (" << (i / elapsed_time) << "/s)\n";
+ XBT_INFO(" ran %d times in %g seconds (%g/s)", i, elapsed_time, i / elapsed_time);
}
-static void bench_all_modes(void (*bench_fun)(int, e_xbt_parmap_mode_t), int nthreads, unsigned modes)
+static void bench_all_modes(int nthreads, unsigned modes, bool full_bench)
{
std::vector<e_xbt_parmap_mode_t> all_modes = {XBT_PARMAP_POSIX, XBT_PARMAP_FUTEX, XBT_PARMAP_BUSY_WAIT,
XBT_PARMAP_DEFAULT};
for (unsigned i = 0; i < all_modes.size(); i++) {
if (1U << i & modes)
- bench_fun(nthreads, all_modes[i]);
+ bench_parmap(nthreads, all_modes[i], full_bench);
}
}
int nthreads;
unsigned modes = MODES_DEFAULT;
+ xbt_log_control_set("parmap_bench.fmt:[%c/%p]%e%m%n");
MSG_init(&argc, argv);
if (argc != 2 && argc != 3) {
- std::cerr << "Usage: " << argv[0] << " nthreads [modes]\n"
- << " nthreads - number of working threads\n"
- << " modes - bitmask of modes to test\n";
+ XBT_INFO("Usage: %s nthreads [modes]", argv[0]);
+ XBT_INFO(" nthreads - number of working threads");
+ XBT_INFO(" modes - bitmask of modes to test");
return EXIT_FAILURE;
}
nthreads = atoi(argv[1]);
if (nthreads < 1) {
- std::cerr << "ERROR: invalid thread count: " << nthreads << "\n";
+ XBT_ERROR("Invalid thread count: %d", nthreads);
return EXIT_FAILURE;
}
if (argc == 3)
modes = strtol(argv[2], NULL, 0);
- std::cout << "Parmap benchmark with " << nthreads << " workers (modes = " << std::hex << modes << std::dec
- << ")...\n\n";
+ XBT_INFO("Parmap benchmark with %d workers (modes = %#x)...", nthreads, modes);
+ XBT_INFO("%s", "");
fun_to_apply = &fun_small_comp;
- std::cout << "Benchmark for parmap create+apply+destroy (small comp):\n";
- bench_all_modes(bench_parmap_full, nthreads, modes);
- std::cout << std::endl;
+ XBT_INFO("Benchmark for parmap create+apply+destroy (small comp):");
+ bench_all_modes(nthreads, modes, true);
+ XBT_INFO("%s", "");
- std::cout << "Benchmark for parmap apply only (small comp):\n";
- bench_all_modes(bench_parmap_apply, nthreads, modes);
- std::cout << std::endl;
+ XBT_INFO("Benchmark for parmap apply only (small comp):");
+ bench_all_modes(nthreads, modes, false);
+ XBT_INFO("%s", "");
fun_to_apply = &fun_big_comp;
- std::cout << "Benchmark for parmap create+apply+destroy (big comp):\n";
- bench_all_modes(bench_parmap_full, nthreads, modes);
- std::cout << std::endl;
+ XBT_INFO("Benchmark for parmap create+apply+destroy (big comp):");
+ bench_all_modes(nthreads, modes, true);
+ XBT_INFO("%s", "");
- std::cout << "Benchmark for parmap apply only (big comp):\n";
- bench_all_modes(bench_parmap_apply, nthreads, modes);
- std::cout << std::endl;
+ XBT_INFO("Benchmark for parmap apply only (big comp):");
+ bench_all_modes(nthreads, modes, false);
+ XBT_INFO("%s", "");
return EXIT_SUCCESS;
}
int main(int argc, char** argv)
{
int status = 0;
+ xbt_log_control_set("parmap_test.fmt:[%c/%p]%e%m%n");
MSG_init(&argc, argv);
XBT_INFO("Basic testing posix");
! timeout 120
-$ ${bindir:=.}/parmap_test --log=root.fmt:%m%n
+$ ${bindir:=.}/parmap_test --log=parmap_test.fmt:%m%n
> Basic testing posix
> Basic testing futex
> Basic testing busy wait
JACOCO_PATH="/usr/local/share/jacoco"
export JAVA_TOOL_OPTIONS="-javaagent:${JACOCO_PATH}/lib/jacocoagent.jar"
-ctest -D ExperimentalTest -j$NUMPROC || true
+ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
ctest -D ExperimentalCoverage || true
unset JAVA_TOOL_OPTIONS
make -j$NUMPROC
-ctest -D ExperimentalTest -j$NUMPROC || true
+ctest --no-compress-output -D ExperimentalTest -j$NUMPROC || true
cd $WORKSPACE/build
if [ -f Testing/TAG ] ; then
-Denable_fortran=OFF ${SANITIZER_OPTIONS} $WORKSPACE
make -j$NUMPROC
-ctest -D ExperimentalTest || true
+ctest --no-compress-output -D ExperimentalTest || true
if [ -f Testing/TAG ] ; then
xsltproc $WORKSPACE/tools/jenkins/ctest2junit.xsl Testing/$(head -n 1 < Testing/TAG)/Test.xml > CTestResults_${SANITIZER}.xml
#! /usr/bin/env perl
-# Copyright (c) 2005-2012, 2014. The SimGrid Team. All rights reserved.
+# Copyright (c) 2005-2012, 2014-2017. The SimGrid Team. All rights reserved.
# This program is free software; you can redistribute it and/or modify it
# under the terms of the license (GNU LGPL) which comes with this package.
print OUT "#include <stdio.h>\n\n";
print OUT "#include \"xbt.h\"\n\n";
print OUT "extern xbt_test_unit_t _xbt_current_unit;\n\n";
+ print OUT "#define STRLEN 1024\n";
print OUT "/* SGU: BEGIN PROTOTYPES */\n";
print OUT "/* SGU: END PROTOTYPES */\n\n";
print OUT $GENERATED;
print OUT <<EOF;
int main(int argc, char *argv[]) {
xbt_test_suite_t suite;
- char selection[1024];
+ char selection[STRLEN];
int verbosity = 0;
int i;
int res;
for (i=1;i<argc;i++) {
if (!strncmp(argv[i],\"--tests=\",strlen(\"--tests=\"))) {
char *p=strchr(argv[i],'=')+1;
- if (selection[0] == '\\0') {
- strncpy(selection,p,1024);
- } else {
- strncat(selection, \",\",1);
- strncat(selection, p, 1023);
- }
+ if (selection[0] != '\\0')
+ strncat(selection, \",\", STRLEN - 1 - strlen(selection));
+ strncat(selection, p, STRLEN - 1 - strlen(selection));
} else if (!strcmp(argv[i], \"--verbose\")) {
verbosity++;
} else if (!strcmp(argv[i], \"--dump-only\")||